ChildProcessMessageManager.h (1313B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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_ChildProcessMessageManager_h 8 #define mozilla_dom_ChildProcessMessageManager_h 9 10 #include "mozilla/HoldDropJSObjects.h" 11 #include "mozilla/dom/MessageManagerBinding.h" 12 #include "mozilla/dom/SyncMessageSender.h" 13 14 namespace mozilla::dom { 15 16 class ChildProcessMessageManager final : public SyncMessageSender { 17 public: 18 explicit ChildProcessMessageManager(ipc::MessageManagerCallback* aCallback) 19 : SyncMessageSender(aCallback, MessageManagerFlags::MM_PROCESSMANAGER | 20 MessageManagerFlags::MM_OWNSCALLBACK) { 21 mozilla::HoldJSObjects(this); 22 } 23 24 virtual JSObject* WrapObject(JSContext* aCx, 25 JS::Handle<JSObject*> aGivenProto) override { 26 return ChildProcessMessageManager_Binding::Wrap(aCx, this, aGivenProto); 27 } 28 29 protected: 30 virtual ~ChildProcessMessageManager() { mozilla::DropJSObjects(this); } 31 }; 32 33 } // namespace mozilla::dom 34 35 #endif // mozilla_dom_ChildProcessMessageManager_h