• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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 #ifndef FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
8 #define FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
9 
10 #include <memory>
11 
12 #include "fxjs/cfxjs_engine.h"
13 #include "v8/include/v8-forward.h"
14 #include "v8/include/v8-persistent-handle.h"
15 
16 class CFXJSE_RuntimeData final : public FXJS_PerIsolateData::ExtensionIface {
17  public:
18   CFXJSE_RuntimeData(const CFXJSE_RuntimeData&) = delete;
19   CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&) = delete;
20   ~CFXJSE_RuntimeData() override;
21 
22   static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);
23 
GetRootContext()24   const v8::Global<v8::Context>& GetRootContext() { return m_hRootContext; }
25 
26  private:
27   static std::unique_ptr<CFXJSE_RuntimeData> Create(v8::Isolate* pIsolate);
28 
29   CFXJSE_RuntimeData();
30 
31   v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate;
32   v8::Global<v8::Context> m_hRootContext;
33 };
34 
35 #endif  // FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
36