1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim: set ts=4 sw=4 et tw=80:
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 
8 #ifndef mozilla_jsipc_JavaScriptParent__
9 #define mozilla_jsipc_JavaScriptParent__
10 
11 #include "JavaScriptBase.h"
12 #include "mozilla/jsipc/PJavaScriptParent.h"
13 
14 namespace mozilla {
15 namespace jsipc {
16 
17 class JavaScriptParent : public JavaScriptBase<PJavaScriptParent> {
18  public:
JavaScriptParent()19   JavaScriptParent() : savedNextCPOWNumber_(1) {}
20   virtual ~JavaScriptParent();
21 
22   bool init();
23   void trace(JSTracer* trc);
24 
25   void drop(JSObject* obj);
26 
27   bool allowMessage(JSContext* cx) override;
28   void afterProcessTask();
29 
30  protected:
isParent()31   virtual bool isParent() override { return true; }
32   virtual JSObject* scopeForTargetObjects() override;
33 
34  private:
35   uint64_t savedNextCPOWNumber_;
36 };
37 
38 }  // namespace jsipc
39 }  // namespace mozilla
40 
41 #endif  // mozilla_jsipc_JavaScriptWrapper_h__
42