From 98b356a36bc9291a4f222d092afeeea0d5b5f379 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 16 Jul 2018 21:35:06 +0000 Subject: Use UnownedPtr<> to v8::Isolates. Isolates are long-lived, but this may catch a few things. Introduce CFX_V8IsolateDeleter for unique_ptr 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 Commit-Queue: Tom Sepez --- fxjs/cfxjse_context.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fxjs/cfxjse_context.h') diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h index b4db8f7a30..91c76d4c7a 100644 --- a/fxjs/cfxjse_context.h +++ b/fxjs/cfxjse_context.h @@ -10,6 +10,7 @@ #include #include +#include "core/fxcrt/unowned_ptr.h" #include "fxjs/fxjse.h" #include "v8/include/v8.h" @@ -28,7 +29,7 @@ class CFXJSE_Context { explicit CFXJSE_Context(v8::Isolate* pIsolate); ~CFXJSE_Context(); - v8::Isolate* GetIsolate() const { return m_pIsolate; } + v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); } v8::Local GetContext(); std::unique_ptr GetGlobalObject(); void AddClass(std::unique_ptr pClass); @@ -38,12 +39,12 @@ class CFXJSE_Context { CFXJSE_Value* lpRetValue, CFXJSE_Value* lpNewThisObject = nullptr); - protected: + private: CFXJSE_Context(const CFXJSE_Context&) = delete; CFXJSE_Context& operator=(const CFXJSE_Context&) = delete; v8::Global m_hContext; - v8::Isolate* m_pIsolate; + UnownedPtr m_pIsolate; std::vector> m_rgClasses; }; -- cgit v1.2.3