ReadRequest.h (1475B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_ReadRequest_h 8 #define mozilla_dom_ReadRequest_h 9 10 #include "js/TypeDecls.h" 11 #include "js/Value.h" 12 #include "mozilla/ErrorResult.h" 13 #include "mozilla/LinkedList.h" 14 #include "mozilla/RefPtr.h" 15 #include "nsCycleCollectionParticipant.h" 16 #include "nsISupportsImpl.h" 17 18 namespace mozilla::dom { 19 20 // List Owners must traverse this class. 21 struct ReadRequest : public nsISupports, 22 public LinkedListElement<RefPtr<ReadRequest>> { 23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 24 NS_DECL_CYCLE_COLLECTION_CLASS(ReadRequest) 25 26 // PipeToReadRequest::ChunkSteps can run script, for example. 27 MOZ_CAN_RUN_SCRIPT virtual void ChunkSteps(JSContext* aCx, 28 JS::Handle<JS::Value> aChunk, 29 ErrorResult& aRv) = 0; 30 MOZ_CAN_RUN_SCRIPT virtual void CloseSteps(JSContext* aCx, 31 ErrorResult& aRv) = 0; 32 virtual void ErrorSteps(JSContext* aCx, JS::Handle<JS::Value> e, 33 ErrorResult& aRv) = 0; 34 35 protected: 36 virtual ~ReadRequest() = default; 37 }; 38 39 } // namespace mozilla::dom 40 41 #endif