summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/cjs_runtime.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-08 10:25:55 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-08 10:25:55 -0700
commit8832fbf53cf71d4d4cb53986d9cfc024edd2bf1f (patch)
tree00e9dbcc91f89f95552bac3326ac828f8b495507 /fpdfsdk/javascript/cjs_runtime.cpp
parentd827111fb10c7d8b89bc954ab0934b4009d6643c (diff)
downloadpdfium-8832fbf53cf71d4d4cb53986d9cfc024edd2bf1f.tar.xz
Replace CJS_Runtime::Observer with CFX_Runtime<CJS_Runtime>::Observer
Previously, the observer set a flag which conditionalized a null pointer return. Now, we just clear the pointer. Destruction order matters, so add a method to trigger notifications. Review-Url: https://codereview.chromium.org/2322743002
Diffstat (limited to 'fpdfsdk/javascript/cjs_runtime.cpp')
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index b12a3f5eeb..67d45d5e4a 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -124,9 +124,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
}
CJS_Runtime::~CJS_Runtime() {
- for (auto* obs : m_observers)
- obs->OnDestroyed();
-
+ NotifyObservers();
ReleaseEngine();
if (m_isolateManaged) {
GetIsolate()->Dispose();
@@ -255,16 +253,6 @@ void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) {
m_FieldEventSet.erase(event);
}
-void CJS_Runtime::AddObserver(Observer* observer) {
- ASSERT(!pdfium::ContainsKey(m_observers, observer));
- m_observers.insert(observer);
-}
-
-void CJS_Runtime::RemoveObserver(Observer* observer) {
- ASSERT(pdfium::ContainsKey(m_observers, observer));
- m_observers.erase(observer);
-}
-
#ifdef PDF_ENABLE_XFA
CFX_WideString ChangeObjName(const CFX_WideString& str) {
CFX_WideString sRet = str;