Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: fpdfsdk/include/javascript/IJavaScript.h

Issue 1338993005: Get CJS_RuntimeFactory out of the CJS_GlobalData management business. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use pre-increment operator. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/include/javascript/JS_GlobalData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_
9 9
10 #include "../../../core/include/fxcrt/fx_string.h" 10 #include "../../../core/include/fxcrt/fx_string.h"
11 #include "../../../core/include/fxcrt/fx_system.h" 11 #include "../../../core/include/fxcrt/fx_system.h"
12 12
13 class CPDFDoc_Environment;
14 class CPDFSDK_Annot;
15 class CPDFSDK_Document;
13 class CPDF_Bookmark; 16 class CPDF_Bookmark;
14 class CPDF_FormField; 17 class CPDF_FormField;
15 class CPDFSDK_Annot;
16 class CPDFSDK_Document;
17 18
18 class IFXJS_Context { 19 class IFXJS_Context {
19 public: 20 public:
20 virtual FX_BOOL RunScript(const CFX_WideString& script, 21 virtual FX_BOOL RunScript(const CFX_WideString& script,
21 CFX_WideString& info) = 0; 22 CFX_WideString& info) = 0;
22 23
23 virtual void OnApp_Init() = 0; 24 virtual void OnApp_Init() = 0;
24 25
25 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, 26 virtual void OnDoc_Open(CPDFSDK_Document* pDoc,
26 const CFX_WideString& strTargetName) = 0; 27 const CFX_WideString& strTargetName) = 0;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 virtual void ReleaseContext(IFXJS_Context* pContext) = 0; 137 virtual void ReleaseContext(IFXJS_Context* pContext) = 0;
137 virtual IFXJS_Context* GetCurrentContext() = 0; 138 virtual IFXJS_Context* GetCurrentContext() = 0;
138 139
139 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; 140 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
140 virtual CPDFSDK_Document* GetReaderDocument() = 0; 141 virtual CPDFSDK_Document* GetReaderDocument() = 0;
141 142
142 protected: 143 protected:
143 virtual ~IFXJS_Runtime() {} 144 virtual ~IFXJS_Runtime() {}
144 }; 145 };
145 146
146 class CPDFDoc_Environment;
147 class CJS_GlobalData;
148
149 class CJS_RuntimeFactory { 147 class CJS_RuntimeFactory {
150 public: 148 public:
151 CJS_RuntimeFactory() 149 CJS_RuntimeFactory() : m_bInit(FALSE), m_nRef(0) {}
152 : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {}
153 ~CJS_RuntimeFactory(); 150 ~CJS_RuntimeFactory();
151
154 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); 152 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
155 void DeleteJSRuntime(IFXJS_Runtime* pRuntime); 153 void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
156 void AddRef(); 154 void AddRef();
157 void Release(); 155 void Release();
158 156
159 CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
160 void ReleaseGlobalData();
161
162 private: 157 private:
163 FX_BOOL m_bInit; 158 FX_BOOL m_bInit;
164 int m_nRef; 159 int m_nRef;
165 CJS_GlobalData* m_pGlobalData;
166 int32_t m_nGlobalDataCount;
167 }; 160 };
168 161
169 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ 162 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/include/javascript/JS_GlobalData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698