summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/javascript/JS_Runtime.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-04 16:01:52 -0700
committerLei Zhang <thestig@chromium.org>2015-10-04 16:01:52 -0700
commit794c9b67d3d519342aa7e15052766f7d4a99f551 (patch)
treee21fdbf59ce171b978126b9f94e69085ff30d211 /fpdfsdk/include/javascript/JS_Runtime.h
parent4f277fc8d41303cbf007335dfbbff60b81fffde0 (diff)
downloadpdfium-794c9b67d3d519342aa7e15052766f7d4a99f551.tar.xz
CJS_Timer should observe CJS_Runtime destruction.
Also remove dead CJS_EmbedObj::{Begin,End}Timer code. BUG=539107 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1384883002 .
Diffstat (limited to 'fpdfsdk/include/javascript/JS_Runtime.h')
-rw-r--r--fpdfsdk/include/javascript/JS_Runtime.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index dd21e6d2f1..6fdc4b0708 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -19,6 +19,14 @@ class CJS_Context;
class CJS_Runtime : public IFXJS_Runtime {
public:
+ class Observer {
+ public:
+ virtual void OnDestroyed() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>;
explicit CJS_Runtime(CPDFDoc_Environment* pApp);
@@ -44,6 +52,9 @@ class CJS_Runtime : public IFXJS_Runtime {
v8::Isolate* GetIsolate() const { return m_isolate; }
v8::Local<v8::Context> NewJSContext();
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
private:
void DefineJSObjects();
@@ -55,6 +66,7 @@ class CJS_Runtime : public IFXJS_Runtime {
v8::Isolate* m_isolate;
bool m_isolateManaged;
v8::Global<v8::Context> m_context;
+ std::set<Observer*> m_observers;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_