From 4d4731c620ea1fa95c07f8855f84d28c78090119 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 23 Jan 2018 00:43:09 +0000 Subject: Tidy fxjs/cfxjse_isolatetracker.h Move constructors to .cpp file. Remove unused member and its accessor method. Remove unused system includes. IsolateHandleRootContext is-a IsolateHandle (not has-a). Change-Id: Ifcba44f3ea7ad963fee731c24b2e79c5a8124539 Reviewed-on: https://pdfium-review.googlesource.com/23171 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- BUILD.gn | 1 + fxjs/cfxjse_isolatetracker.cpp | 23 +++++++++++++++++++++++ fxjs/cfxjse_isolatetracker.h | 24 +++++++----------------- 3 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 fxjs/cfxjse_isolatetracker.cpp diff --git a/BUILD.gn b/BUILD.gn index 23bf477125..abdd414562 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1299,6 +1299,7 @@ jumbo_static_library("fxjs") { "fxjs/cfxjse_engine.h", "fxjs/cfxjse_formcalc_context.cpp", "fxjs/cfxjse_formcalc_context.h", + "fxjs/cfxjse_isolatetracker.cpp", "fxjs/cfxjse_isolatetracker.h", "fxjs/cfxjse_resolveprocessor.cpp", "fxjs/cfxjse_resolveprocessor.h", diff --git a/fxjs/cfxjse_isolatetracker.cpp b/fxjs/cfxjse_isolatetracker.cpp new file mode 100644 index 0000000000..2a66a74a8b --- /dev/null +++ b/fxjs/cfxjse_isolatetracker.cpp @@ -0,0 +1,23 @@ +// Copyright 2018 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "fxjs/cfxjse_isolatetracker.h" + +CFXJSE_ScopeUtil_IsolateHandle::CFXJSE_ScopeUtil_IsolateHandle( + v8::Isolate* pIsolate) + : m_iscope(pIsolate), m_hscope(pIsolate) {} + +CFXJSE_ScopeUtil_IsolateHandle::~CFXJSE_ScopeUtil_IsolateHandle() = default; + +CFXJSE_ScopeUtil_IsolateHandleRootContext:: + CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate) + : CFXJSE_ScopeUtil_IsolateHandle(pIsolate), + m_cscope(v8::Local::New( + pIsolate, + CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext)) {} + +CFXJSE_ScopeUtil_IsolateHandleRootContext:: + ~CFXJSE_ScopeUtil_IsolateHandleRootContext() = default; diff --git a/fxjs/cfxjse_isolatetracker.h b/fxjs/cfxjse_isolatetracker.h index 2bb16ca7ba..103b2757f6 100644 --- a/fxjs/cfxjse_isolatetracker.h +++ b/fxjs/cfxjse_isolatetracker.h @@ -7,19 +7,13 @@ #ifndef FXJS_CFXJSE_ISOLATETRACKER_H_ #define FXJS_CFXJSE_ISOLATETRACKER_H_ -#include -#include -#include - -#include "v8/include/v8.h" - #include "fxjs/cfxjse_runtimedata.h" +#include "v8/include/v8.h" class CFXJSE_ScopeUtil_IsolateHandle { public: - explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate) - : m_isolate(pIsolate), m_iscope(pIsolate), m_hscope(pIsolate) {} - v8::Isolate* GetIsolate() { return m_isolate; } + explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate); + ~CFXJSE_ScopeUtil_IsolateHandle(); private: CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle&) = @@ -28,18 +22,15 @@ class CFXJSE_ScopeUtil_IsolateHandle { void* operator new(size_t size) = delete; void operator delete(void*, size_t) = delete; - v8::Isolate* m_isolate; v8::Isolate::Scope m_iscope; v8::HandleScope m_hscope; }; -class CFXJSE_ScopeUtil_IsolateHandleRootContext { +class CFXJSE_ScopeUtil_IsolateHandleRootContext + : public CFXJSE_ScopeUtil_IsolateHandle { public: - explicit CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate) - : m_parent(pIsolate), - m_cscope(v8::Local::New( - pIsolate, - CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext)) {} + explicit CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate); + ~CFXJSE_ScopeUtil_IsolateHandleRootContext(); private: CFXJSE_ScopeUtil_IsolateHandleRootContext( @@ -48,7 +39,6 @@ class CFXJSE_ScopeUtil_IsolateHandleRootContext { void* operator new(size_t size) = delete; void operator delete(void*, size_t) = delete; - CFXJSE_ScopeUtil_IsolateHandle m_parent; v8::Context::Scope m_cscope; }; -- cgit v1.2.3