summaryrefslogtreecommitdiff
path: root/xfa/src/fxjse/scope_inline.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-08 15:03:11 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-08 15:03:11 -0500
commite2a774a4b841829ef089d0cbfd15a08895eecf0e (patch)
tree094545ac4603e5d2ed2c3138f9183cc4a7d4e67b /xfa/src/fxjse/scope_inline.h
parent6cdf084fa40a62eb33185171622ad12d95c6009e (diff)
downloadpdfium-e2a774a4b841829ef089d0cbfd15a08895eecf0e.tar.xz
Remove xfa/src/fxjse/src and move code up a level.
This CL removes the xfa/src/fxjse/src and moves all of the .h and .cpp files up to the, previously empty, xfa/src/fxjse directory. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1776643002 .
Diffstat (limited to 'xfa/src/fxjse/scope_inline.h')
-rw-r--r--xfa/src/fxjse/scope_inline.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/xfa/src/fxjse/scope_inline.h b/xfa/src/fxjse/scope_inline.h
new file mode 100644
index 0000000000..6105590966
--- /dev/null
+++ b/xfa/src/fxjse/scope_inline.h
@@ -0,0 +1,108 @@
+// Copyright 2014 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
+
+#ifndef XFA_SRC_FXJSE_SCOPE_INLINE_H_
+#define XFA_SRC_FXJSE_SCOPE_INLINE_H_
+
+#include "xfa/src/fxjse/context.h"
+#include "xfa/src/fxjse/runtime.h"
+
+class CFXJSE_ScopeUtil_IsolateHandle {
+ protected:
+ v8::Isolate* m_isolate;
+ v8::Locker m_locker;
+ v8::Isolate::Scope m_iscope;
+ v8::HandleScope m_hscope;
+
+ public:
+ explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate)
+ : m_isolate(pIsolate),
+ m_locker(pIsolate),
+ m_iscope(pIsolate),
+ m_hscope(pIsolate) {}
+ v8::Isolate* GetIsolate() { return m_isolate; }
+
+ private:
+ CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle&);
+ void operator=(const CFXJSE_ScopeUtil_IsolateHandle&);
+ void* operator new(size_t size);
+ void operator delete(void*, size_t);
+};
+class CFXJSE_ScopeUtil_IsolateHandleRootContext {
+ CFXJSE_ScopeUtil_IsolateHandle m_parent;
+ v8::Context::Scope m_cscope;
+
+ public:
+ explicit CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate)
+ : m_parent(pIsolate),
+ m_cscope(v8::Local<v8::Context>::New(
+ pIsolate,
+ CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext)) {}
+
+ private:
+ CFXJSE_ScopeUtil_IsolateHandleRootContext(
+ const CFXJSE_ScopeUtil_IsolateHandleRootContext&);
+ void operator=(const CFXJSE_ScopeUtil_IsolateHandleRootContext&);
+ void* operator new(size_t size);
+ void operator delete(void*, size_t);
+};
+class CFXJSE_ScopeUtil_IsolateHandleContext {
+ CFXJSE_Context* m_context;
+ CFXJSE_ScopeUtil_IsolateHandle m_parent;
+ v8::Context::Scope m_cscope;
+
+ public:
+ explicit CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context* pContext)
+ : m_context(pContext),
+ m_parent(pContext->m_pIsolate),
+ m_cscope(v8::Local<v8::Context>::New(pContext->m_pIsolate,
+ pContext->m_hContext)) {}
+ v8::Isolate* GetIsolate() { return m_context->m_pIsolate; }
+ v8::Local<v8::Context> GetLocalContext() {
+ return v8::Local<v8::Context>::New(m_context->m_pIsolate,
+ m_context->m_hContext);
+ }
+
+ private:
+ CFXJSE_ScopeUtil_IsolateHandleContext(
+ const CFXJSE_ScopeUtil_IsolateHandleContext&);
+ void operator=(const CFXJSE_ScopeUtil_IsolateHandleContext&);
+ void* operator new(size_t size);
+ void operator delete(void*, size_t);
+};
+class CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext {
+ CFXJSE_Context* m_context;
+ CFXJSE_ScopeUtil_IsolateHandle m_parent;
+ v8::Context::Scope m_cscope;
+
+ public:
+ explicit CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext(
+ v8::Isolate* pIsolate,
+ CFXJSE_Context* pContext)
+ : m_context(pContext),
+ m_parent(pIsolate),
+ m_cscope(v8::Local<v8::Context>::New(
+ pIsolate,
+ pContext ? pContext->m_hContext
+ : CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext)) {}
+ v8::Isolate* GetIsolate() { return m_parent.GetIsolate(); }
+ v8::Local<v8::Context> GetLocalContext() {
+ v8::Isolate* pIsolate = m_parent.GetIsolate();
+ return v8::Local<v8::Context>::New(
+ pIsolate, m_context
+ ? m_context->m_hContext
+ : CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext);
+ }
+
+ private:
+ CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext(
+ const CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext&);
+ void operator=(const CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext&);
+ void* operator new(size_t size);
+ void operator delete(void*, size_t);
+};
+
+#endif // XFA_SRC_FXJSE_SCOPE_INLINE_H_