Line data Source code
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_JavaScriptChild_h_
9 : #define mozilla_jsipc_JavaScriptChild_h_
10 :
11 : #include "JavaScriptBase.h"
12 : #include "mozilla/jsipc/PJavaScriptChild.h"
13 :
14 : namespace mozilla {
15 : namespace jsipc {
16 :
17 : class JavaScriptChild : public JavaScriptBase<PJavaScriptChild>
18 : {
19 : public:
20 2 : JavaScriptChild() : strongReferenceObjIdMinimum_(0) {}
21 : virtual ~JavaScriptChild();
22 :
23 : bool init();
24 : void trace(JSTracer* trc);
25 : void updateWeakPointers();
26 :
27 : void drop(JSObject* obj);
28 :
29 0 : bool allowMessage(JSContext* cx) override { return true; }
30 :
31 : protected:
32 0 : virtual bool isParent() override { return false; }
33 : virtual JSObject* scopeForTargetObjects() override;
34 :
35 : mozilla::ipc::IPCResult RecvDropTemporaryStrongReferences(const uint64_t& upToObjId) override;
36 :
37 : private:
38 : bool fail(JSContext* cx, ReturnStatus* rs);
39 : bool ok(ReturnStatus* rs);
40 :
41 : // JavaScriptChild will keep strong references to JS objects that are
42 : // referenced by the parent only if their ID is >=
43 : // strongReferenceObjIdMinimum_.
44 : uint64_t strongReferenceObjIdMinimum_;
45 : };
46 :
47 : } // namespace jsipc
48 : } // namespace mozilla
49 :
50 : #endif
|