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

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

Issue 1399273003: fpdfsdk/ differences with XFA (for didactic purposes only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Regenerate after taking juns patch 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
31 // FXJS_V8 places no interpreation on this calass; it merely passes it
32 // along to XFA.
33 class CFXJSE_RuntimeData;
34
35 #endif
30 enum FXJSOBJTYPE { 36 enum FXJSOBJTYPE {
31 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. 37 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS.
32 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. 38 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object.
33 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). 39 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once).
34 }; 40 };
35 41
36 struct FXJSErr { 42 struct FXJSErr {
37 const wchar_t* message; 43 const wchar_t* message;
38 const wchar_t* srcline; 44 const wchar_t* srcline;
39 unsigned linnum; 45 unsigned linnum;
40 }; 46 };
41 47
42 class FXJS_PerIsolateData { 48 class FXJS_PerIsolateData {
43 public: 49 public:
44 static void SetUp(v8::Isolate* pIsolate); 50 static void SetUp(v8::Isolate* pIsolate);
45 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); 51 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate);
46 52
47 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; 53 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray;
54 #ifdef PDF_ENABLE_XFA
55 CFXJSE_RuntimeData* m_pFXJSERuntimeData;
56 #endif
48 57
49 protected: 58 protected:
59 #ifndef PDF_ENABLE_XFA
50 FXJS_PerIsolateData() {} 60 FXJS_PerIsolateData() {}
61 #else
62 FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {}
63 #endif
51 }; 64 };
52 65
53 extern const wchar_t kFXJSValueNameString[]; 66 extern const wchar_t kFXJSValueNameString[];
54 extern const wchar_t kFXJSValueNameNumber[]; 67 extern const wchar_t kFXJSValueNameNumber[];
55 extern const wchar_t kFXJSValueNameBoolean[]; 68 extern const wchar_t kFXJSValueNameBoolean[];
56 extern const wchar_t kFXJSValueNameDate[]; 69 extern const wchar_t kFXJSValueNameDate[];
57 extern const wchar_t kFXJSValueNameObject[]; 70 extern const wchar_t kFXJSValueNameObject[];
58 extern const wchar_t kFXJSValueNameFxobj[]; 71 extern const wchar_t kFXJSValueNameFxobj[];
59 extern const wchar_t kFXJSValueNameNull[]; 72 extern const wchar_t kFXJSValueNameNull[];
60 extern const wchar_t kFXJSValueNameUndefined[]; 73 extern const wchar_t kFXJSValueNameUndefined[];
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void FXJS_InitializeRuntime( 138 void FXJS_InitializeRuntime(
126 v8::Isolate* pIsolate, 139 v8::Isolate* pIsolate,
127 IJS_Runtime* pIRuntime, 140 IJS_Runtime* pIRuntime,
128 v8::Global<v8::Context>* pV8PersistentContext, 141 v8::Global<v8::Context>* pV8PersistentContext,
129 std::vector<v8::Global<v8::Object>*>* pStaticObjects); 142 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
130 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, 143 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
131 v8::Global<v8::Context>* pV8PersistentContext, 144 v8::Global<v8::Context>* pV8PersistentContext,
132 std::vector<v8::Global<v8::Object>*>* pStaticObjects); 145 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
133 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); 146 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate);
134 147
148 #ifdef PDF_ENABLE_XFA
149 // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its
150 // own contexts compatible with XFA or vice versa.
151 void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context,
152 IJS_Runtime* pIRuntime);
153
154 #endif
135 // Called after FXJS_InitializeRuntime call made. 155 // Called after FXJS_InitializeRuntime call made.
136 int FXJS_Execute(v8::Isolate* pIsolate, 156 int FXJS_Execute(v8::Isolate* pIsolate,
137 IJS_Context* pJSContext, 157 IJS_Context* pJSContext,
138 const wchar_t* script, 158 const wchar_t* script,
139 FXJSErr* perror); 159 FXJSErr* perror);
140 160
141 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, 161 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
142 IJS_Runtime* pJSContext, 162 IJS_Runtime* pJSContext,
143 int nObjDefnID); 163 int nObjDefnID);
144 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
219 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); 239 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
220 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, 240 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate,
221 v8::Local<v8::Value> pValue); 241 v8::Local<v8::Value> pValue);
222 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, 242 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate,
223 v8::Local<v8::Value> pValue); 243 v8::Local<v8::Value> pValue);
224 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, 244 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate,
225 v8::Local<v8::Value> pValue); 245 v8::Local<v8::Value> pValue);
226 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);
227 247
228 #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