ByteLengthQueuingStrategy.h (1671B)
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_ByteLengthQueuingStrategy_h 8 #define mozilla_dom_ByteLengthQueuingStrategy_h 9 10 #include "js/TypeDecls.h" 11 #include "mozilla/ErrorResult.h" 12 #include "mozilla/dom/BaseQueuingStrategy.h" 13 #include "mozilla/dom/BindingDeclarations.h" 14 #include "mozilla/dom/FunctionBinding.h" 15 #include "mozilla/dom/QueuingStrategyBinding.h" 16 #include "nsCycleCollectionParticipant.h" 17 #include "nsIGlobalObject.h" 18 #include "nsWrapperCache.h" 19 20 namespace mozilla::dom { 21 class ByteLengthQueuingStrategy final : public BaseQueuingStrategy, 22 public nsWrapperCache { 23 public: 24 NS_DECL_ISUPPORTS_INHERITED 25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS_INHERITED( 26 ByteLengthQueuingStrategy, BaseQueuingStrategy) 27 28 public: 29 explicit ByteLengthQueuingStrategy(nsISupports* aGlobal, 30 double aHighWaterMark) 31 : BaseQueuingStrategy(aGlobal, aHighWaterMark) {} 32 33 protected: 34 ~ByteLengthQueuingStrategy() override = default; 35 36 public: 37 JSObject* WrapObject(JSContext* aCx, 38 JS::Handle<JSObject*> aGivenProto) override; 39 40 static already_AddRefed<ByteLengthQueuingStrategy> Constructor( 41 const GlobalObject& aGlobal, const QueuingStrategyInit& aInit); 42 43 already_AddRefed<Function> GetSize(ErrorResult& aRv); 44 }; 45 46 } // namespace mozilla::dom 47 48 #endif