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

Side by Side Diff: fpdfsdk/include/jsapi/fxjs_v8.h

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Remove fsdk_actionhandler.cpp Created 5 years 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 | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/include/pdfwindow/PWL_Edit.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 // FXJS_V8 is a layer that makes it easier to define native objects in V8, but 7 // FXJS_V8 is a layer that makes it easier to define native objects in V8, but
8 // has no knowledge of PDF-specific native objects. It could in theory be used 8 // has no knowledge of PDF-specific native objects. It could in theory be used
9 // to implement other sets of native objects. 9 // to implement other sets of native objects.
10 10
11 // PDFium code should include this file rather than including V8 headers 11 // PDFium code should include this file rather than including V8 headers
12 // directly. 12 // directly.
13 13
14 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 14 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
15 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 15 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
16 16
17 #include <v8.h> 17 #include <v8.h>
18 18
19 #include <vector> 19 #include <vector>
20 20
21 #include "core/include/fxcrt/fx_string.h" 21 #include "core/include/fxcrt/fx_string.h"
22 22
23 class CFXJS_ObjDefinition; 23 class CFXJS_ObjDefinition;
24 24
25 // FXJS_V8 places no restrictions on these two classes; it merely passes them 25 // FXJS_V8 places no restrictions on these two classes; it merely passes them
26 // on to caller-provided methods. 26 // on to caller-provided methods.
27 class IJS_Context; // A description of the event that caused JS execution. 27 class IJS_Context; // A description of the event that caused JS execution.
28 class IJS_Runtime; // A native runtime, typically owns the v8::Context. 28 class IJS_Runtime; // A native runtime, typically owns the v8::Context.
29 29
30 #ifdef PDF_ENABLE_XFA
30 // FXJS_V8 places no interpreation on this calass; it merely passes it 31 // FXJS_V8 places no interpreation on this calass; it merely passes it
31 // along to XFA. 32 // along to XFA.
32 class CFXJSE_RuntimeData; 33 class CFXJSE_RuntimeData;
33 34
35 #endif
34 enum FXJSOBJTYPE { 36 enum FXJSOBJTYPE {
35 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. 37 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS.
36 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. 38 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object.
37 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). 39 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once).
38 }; 40 };
39 41
40 struct FXJSErr { 42 struct FXJSErr {
41 const wchar_t* message; 43 const wchar_t* message;
42 const wchar_t* srcline; 44 const wchar_t* srcline;
43 unsigned linnum; 45 unsigned linnum;
44 }; 46 };
45 47
46 class FXJS_PerIsolateData { 48 class FXJS_PerIsolateData {
47 public: 49 public:
48 static void SetUp(v8::Isolate* pIsolate); 50 static void SetUp(v8::Isolate* pIsolate);
49 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); 51 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate);
50 52
51 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; 53 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray;
54 #ifdef PDF_ENABLE_XFA
52 CFXJSE_RuntimeData* m_pFXJSERuntimeData; 55 CFXJSE_RuntimeData* m_pFXJSERuntimeData;
56 #endif
53 57
54 protected: 58 protected:
59 #ifndef PDF_ENABLE_XFA
60 FXJS_PerIsolateData() {}
61 #else
55 FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {} 62 FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {}
63 #endif
56 }; 64 };
57 65
58 extern const wchar_t kFXJSValueNameString[]; 66 extern const wchar_t kFXJSValueNameString[];
59 extern const wchar_t kFXJSValueNameNumber[]; 67 extern const wchar_t kFXJSValueNameNumber[];
60 extern const wchar_t kFXJSValueNameBoolean[]; 68 extern const wchar_t kFXJSValueNameBoolean[];
61 extern const wchar_t kFXJSValueNameDate[]; 69 extern const wchar_t kFXJSValueNameDate[];
62 extern const wchar_t kFXJSValueNameObject[]; 70 extern const wchar_t kFXJSValueNameObject[];
63 extern const wchar_t kFXJSValueNameFxobj[]; 71 extern const wchar_t kFXJSValueNameFxobj[];
64 extern const wchar_t kFXJSValueNameNull[]; 72 extern const wchar_t kFXJSValueNameNull[];
65 extern const wchar_t kFXJSValueNameUndefined[]; 73 extern const wchar_t kFXJSValueNameUndefined[];
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void FXJS_InitializeRuntime( 138 void FXJS_InitializeRuntime(
131 v8::Isolate* pIsolate, 139 v8::Isolate* pIsolate,
132 IJS_Runtime* pIRuntime, 140 IJS_Runtime* pIRuntime,
133 v8::Global<v8::Context>* pV8PersistentContext, 141 v8::Global<v8::Context>* pV8PersistentContext,
134 std::vector<v8::Global<v8::Object>*>* pStaticObjects); 142 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
135 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, 143 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
136 v8::Global<v8::Context>* pV8PersistentContext, 144 v8::Global<v8::Context>* pV8PersistentContext,
137 std::vector<v8::Global<v8::Object>*>* pStaticObjects); 145 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
138 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); 146 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate);
139 147
148 #ifdef PDF_ENABLE_XFA
140 // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its 149 // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its
141 // own contexts compatible with XFA or vice versa. 150 // own contexts compatible with XFA or vice versa.
142 void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context, 151 void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context,
143 IJS_Runtime* pIRuntime); 152 IJS_Runtime* pIRuntime);
144 153
154 #endif
145 // Called after FXJS_InitializeRuntime call made. 155 // Called after FXJS_InitializeRuntime call made.
146 int FXJS_Execute(v8::Isolate* pIsolate, 156 int FXJS_Execute(v8::Isolate* pIsolate,
147 IJS_Context* pJSContext, 157 IJS_Context* pJSContext,
148 const wchar_t* script, 158 const wchar_t* script,
149 FXJSErr* perror); 159 FXJSErr* perror);
150 160
151 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, 161 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
152 IJS_Runtime* pJSContext, 162 IJS_Runtime* pJSContext,
153 int nObjDefnID); 163 int nObjDefnID);
154 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate); 164 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); 239 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
230 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, 240 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate,
231 v8::Local<v8::Value> pValue); 241 v8::Local<v8::Value> pValue);
232 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, 242 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate,
233 v8::Local<v8::Value> pValue); 243 v8::Local<v8::Value> pValue);
234 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, 244 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate,
235 v8::Local<v8::Value> pValue); 245 v8::Local<v8::Value> pValue);
236 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); 246 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
237 247
238 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 248 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/include/pdfwindow/PWL_Edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698