summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_value.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-16 21:35:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-16 21:35:06 +0000
commit98b356a36bc9291a4f222d092afeeea0d5b5f379 (patch)
tree71fbda3964df30ef354afd36e3a9aba32978f762 /fxjs/cfxjse_value.h
parent31781107f6bda92e732fed805f62e8512bc78149 (diff)
downloadpdfium-98b356a36bc9291a4f222d092afeeea0d5b5f379.tar.xz
Use UnownedPtr<> to v8::Isolates.
Isolates are long-lived, but this may catch a few things. Introduce CFX_V8IsolateDeleter for unique_ptr<v8::Isolate> usage. Fix Dispose()/SetIsolate(nullptr) ordering in cjs_runtime.cpp Remove one unused isolate member. Flip protected -> private in one place. Change-Id: I26cdd120f799192e93b0d9d04dcde8f348dc21f3 Reviewed-on: https://pdfium-review.googlesource.com/37931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_value.h')
-rw-r--r--fxjs/cfxjse_value.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h
index 52bb036b95..5fbac4d58a 100644
--- a/fxjs/cfxjse_value.h
+++ b/fxjs/cfxjse_value.h
@@ -12,6 +12,7 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/unowned_ptr.h"
#include "fxjs/cfxjse_isolatetracker.h"
#include "fxjs/cfxjse_runtimedata.h"
#include "v8/include/v8.h"
@@ -69,15 +70,15 @@ class CFXJSE_Value {
CFXJSE_Value* lpPropValue);
bool SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis);
- v8::Isolate* GetIsolate() const { return m_pIsolate; }
+ v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); }
const v8::Global<v8::Value>& DirectGetValue() const { return m_hValue; }
void ForceSetValue(v8::Local<v8::Value> hValue) {
- m_hValue.Reset(m_pIsolate, hValue);
+ m_hValue.Reset(GetIsolate(), hValue);
}
void Assign(const CFXJSE_Value* lpValue) {
ASSERT(lpValue);
if (lpValue) {
- m_hValue.Reset(m_pIsolate, lpValue->m_hValue);
+ m_hValue.Reset(GetIsolate(), lpValue->m_hValue);
} else {
m_hValue.Reset();
}
@@ -91,7 +92,7 @@ class CFXJSE_Value {
CFXJSE_Value(const CFXJSE_Value&);
CFXJSE_Value& operator=(const CFXJSE_Value&);
- v8::Isolate* m_pIsolate;
+ UnownedPtr<v8::Isolate> m_pIsolate;
v8::Global<v8::Value> m_hValue;
};