summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Context.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-22 15:39:15 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-22 15:39:15 -0700
commitd8d223127d706aa4961b2c9b0037ab256fce9a8f (patch)
treeb0fb81449394f1c9f7832684988293dffdfc6396 /fpdfsdk/src/javascript/JS_Context.cpp
parentdd7a7f012424ec8505830710ac0dd0183203c189 (diff)
downloadpdfium-d8d223127d706aa4961b2c9b0037ab256fce9a8f.tar.xz
Use std::set<> to track active event handlers.
This avoids some custom linked-list code. Also note that we use a local copy to be sure we removed the same thing that was added no matter how our callees may muck with the handler. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1352393003 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Context.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Context.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp
index 41146ed591..342616d301 100644
--- a/fpdfsdk/src/javascript/JS_Context.cpp
+++ b/fpdfsdk/src/javascript/JS_Context.cpp
@@ -46,8 +46,9 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
m_bBusy = TRUE;
ASSERT(m_pEventHandler->IsValid());
- if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(),
- m_pEventHandler->EventType())) {
+ CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(),
+ m_pEventHandler->EventType());
+ if (!m_pRuntime->AddEventToSet(event)) {
info = JSGetStringFromID(this, IDS_STRING_JSEVENT);
return FALSE;
}
@@ -68,9 +69,7 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
info = JSGetStringFromID(this, IDS_STRING_RUN);
}
- m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(),
- m_pEventHandler->EventType());
-
+ m_pRuntime->RemoveEventFromSet(event);
m_pEventHandler->Destroy();
m_bBusy = FALSE;