Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: fpdfsdk/javascript/app.cpp

Issue 2262473002: Introduce pdfium::FakeUniquePtr for keys to sets of unique ptrs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Poiner is spelt with a "t" Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/app.h ('k') | third_party/base/stl_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/app.cpp
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 573de4030abacc7dbc0c357f89f809d48e5cb71b..f95ec0b09b9eaeed40f3b08e9e483485235286e2 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -19,6 +19,7 @@
#include "fpdfsdk/javascript/cjs_context.h"
#include "fpdfsdk/javascript/cjs_runtime.h"
#include "fpdfsdk/javascript/resource.h"
+#include "third_party/base/stl_util.h"
class GlobalTimer : public CJS_Runtime::Observer {
public:
@@ -510,10 +511,9 @@ FX_BOOL app::setInterval(IJS_Context* cc,
uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000;
CPDFDoc_Environment* pApp = pRuntime->GetReaderApp();
- std::unique_ptr<GlobalTimer> timer(
- new GlobalTimer(this, pApp, pRuntime, 0, script, dwInterval, 0));
- GlobalTimer* timerRef = timer.get();
- m_Timers[timerRef] = std::move(timer);
+ GlobalTimer* timerRef =
+ new GlobalTimer(this, pApp, pRuntime, 0, script, dwInterval, 0);
+ m_Timers.insert(std::unique_ptr<GlobalTimer>(timerRef));
v8::Local<v8::Object> pRetObj =
pRuntime->NewFxDynamicObj(CJS_TimerObj::g_nObjDefnID);
@@ -547,10 +547,9 @@ FX_BOOL app::setTimeOut(IJS_Context* cc,
uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000;
CPDFDoc_Environment* pApp = pRuntime->GetReaderApp();
- std::unique_ptr<GlobalTimer> timer(
- new GlobalTimer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut));
- GlobalTimer* timerRef = timer.get();
- m_Timers[timerRef] = std::move(timer);
+ GlobalTimer* timerRef =
+ new GlobalTimer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut);
+ m_Timers.insert(std::unique_ptr<GlobalTimer>(timerRef));
v8::Local<v8::Object> pRetObj =
pRuntime->NewFxDynamicObj(CJS_TimerObj::g_nObjDefnID);
@@ -626,7 +625,7 @@ void app::TimerProc(GlobalTimer* pTimer) {
}
void app::CancelProc(GlobalTimer* pTimer) {
- m_Timers.erase(pTimer);
+ m_Timers.erase(pdfium::FakeUniquePtr<GlobalTimer>(pTimer));
}
void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) {
« no previous file with comments | « fpdfsdk/javascript/app.h ('k') | third_party/base/stl_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698