• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
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 #ifndef FXJS_XFA_CFXJSE_ISOLATETRACKER_H_
8 #define FXJS_XFA_CFXJSE_ISOLATETRACKER_H_
9 
10 #include "v8/include/v8.h"
11 
12 class CFXJSE_ScopeUtil_IsolateHandle {
13  public:
14   explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate);
15   CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle&) =
16       delete;
17   CFXJSE_ScopeUtil_IsolateHandle& operator=(
18       const CFXJSE_ScopeUtil_IsolateHandle&) = delete;
19   ~CFXJSE_ScopeUtil_IsolateHandle();
20 
21  private:
22   void* operator new(size_t size) = delete;
23   void operator delete(void*, size_t) = delete;
24 
25   v8::Isolate::Scope m_iscope;
26   v8::HandleScope m_hscope;
27 };
28 
29 class CFXJSE_ScopeUtil_IsolateHandleRootContext final
30     : public CFXJSE_ScopeUtil_IsolateHandle {
31  public:
32   explicit CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate);
33   CFXJSE_ScopeUtil_IsolateHandleRootContext(
34       const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
35   CFXJSE_ScopeUtil_IsolateHandleRootContext& operator=(
36       const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
37   ~CFXJSE_ScopeUtil_IsolateHandleRootContext();
38 
39  private:
40   void* operator new(size_t size) = delete;
41   void operator delete(void*, size_t) = delete;
42 
43   v8::Context::Scope m_cscope;
44 };
45 
46 #endif  // FXJS_XFA_CFXJSE_ISOLATETRACKER_H_
47