xref: /aosp_15_r20/external/pdfium/fxjs/xfa/cfxjse_isolatetracker.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2018 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "fxjs/xfa/cfxjse_isolatetracker.h"
8 
9 #include "fxjs/xfa/cfxjse_context.h"
10 #include "fxjs/xfa/cfxjse_runtimedata.h"
11 
CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate * pIsolate)12 CFXJSE_ScopeUtil_IsolateHandle::CFXJSE_ScopeUtil_IsolateHandle(
13     v8::Isolate* pIsolate)
14     : isolate_scope_(pIsolate), handle_scope_(pIsolate) {}
15 
16 CFXJSE_ScopeUtil_IsolateHandle::~CFXJSE_ScopeUtil_IsolateHandle() = default;
17 
CFXJSE_ScopeUtil_Context(CFXJSE_Context * pContext)18 CFXJSE_ScopeUtil_Context::CFXJSE_ScopeUtil_Context(CFXJSE_Context* pContext)
19     : context_scope_(pContext->GetContext()) {}
20 
21 CFXJSE_ScopeUtil_Context::~CFXJSE_ScopeUtil_Context() = default;
22 
CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context * pContext)23 CFXJSE_ScopeUtil_IsolateHandleContext::CFXJSE_ScopeUtil_IsolateHandleContext(
24     CFXJSE_Context* pContext)
25     : isolate_handle_(pContext->GetIsolate()), context_(pContext) {}
26 
27 CFXJSE_ScopeUtil_IsolateHandleContext::
28     ~CFXJSE_ScopeUtil_IsolateHandleContext() = default;
29 
CFXJSE_ScopeUtil_RootContext(v8::Isolate * pIsolate)30 CFXJSE_ScopeUtil_RootContext::CFXJSE_ScopeUtil_RootContext(
31     v8::Isolate* pIsolate)
32     : context_scope_(v8::Local<v8::Context>::New(
33           pIsolate,
34           CFXJSE_RuntimeData::Get(pIsolate)->GetRootContext())) {}
35 
36 CFXJSE_ScopeUtil_RootContext::~CFXJSE_ScopeUtil_RootContext() = default;
37 
38 CFXJSE_ScopeUtil_IsolateHandleRootContext::
CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate * pIsolate)39     CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate)
40     : isolate_handle_(pIsolate), root_context_(pIsolate) {}
41 
42 CFXJSE_ScopeUtil_IsolateHandleRootContext::
43     ~CFXJSE_ScopeUtil_IsolateHandleRootContext() = default;
44