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

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

Issue 1354593004: Merge to master: contention over isolate data slots (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove stray whitespace-only change. 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/src/jsapi/fxjs_v8.cpp » ('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 // PDFium wrapper around V8 APIs. PDFium code should include this file rather 7 // PDFium wrapper around V8 APIs. PDFium code should include this file rather
8 // than including V8 headers directly. 8 // than including V8 headers directly.
9 9
10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
11 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 11 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
12 12
13 #include <v8.h> 13 #include <v8.h>
14 #include "../../../core/include/fxcrt/fx_string.h" // For CFX_WideString 14 #include "../../../core/include/fxcrt/fx_basic.h"
15
16 // FXJS_V8 places no interpretation on these two classes; it merely
17 // passes them on to the caller-provided FXJS_CONSTRUCTORs.
18 class IFXJS_Context;
19 class IFXJS_Runtime;
15 20
16 enum FXJSOBJTYPE { 21 enum FXJSOBJTYPE {
17 FXJS_DYNAMIC = 0, 22 FXJS_DYNAMIC = 0,
18 FXJS_STATIC = 1, 23 FXJS_STATIC = 1,
19 }; 24 };
20 25
21 struct FXJSErr { 26 struct FXJSErr {
22 const wchar_t* message; 27 const wchar_t* message;
23 const wchar_t* srcline; 28 const wchar_t* srcline;
24 unsigned linnum; 29 unsigned linnum;
25 }; 30 };
26 31
32 class FXJS_PerIsolateData {
33 public:
34 static void SetUp(v8::Isolate* pIsolate);
35 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate);
36
37 CFX_PtrArray m_ObjectDefnArray;
38 IFXJS_Runtime* m_pFXJSRuntime;
39
40 protected:
41 FXJS_PerIsolateData() : m_pFXJSRuntime(nullptr) {}
42 };
43
27 extern const wchar_t kFXJSValueNameString[]; 44 extern const wchar_t kFXJSValueNameString[];
28 extern const wchar_t kFXJSValueNameNumber[]; 45 extern const wchar_t kFXJSValueNameNumber[];
29 extern const wchar_t kFXJSValueNameBoolean[]; 46 extern const wchar_t kFXJSValueNameBoolean[];
30 extern const wchar_t kFXJSValueNameDate[]; 47 extern const wchar_t kFXJSValueNameDate[];
31 extern const wchar_t kFXJSValueNameObject[]; 48 extern const wchar_t kFXJSValueNameObject[];
32 extern const wchar_t kFXJSValueNameFxobj[]; 49 extern const wchar_t kFXJSValueNameFxobj[];
33 extern const wchar_t kFXJSValueNameNull[]; 50 extern const wchar_t kFXJSValueNameNull[];
34 extern const wchar_t kFXJSValueNameUndefined[]; 51 extern const wchar_t kFXJSValueNameUndefined[];
35 52
36 // FXJS_V8 places no interpretation on these two classes; it merely
37 // passes them on to the caller-provided FXJS_CONSTRUCTORs.
38 class IFXJS_Context;
39 class IFXJS_Runtime;
40 53
41 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 54 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
42 void* Allocate(size_t length) override; 55 void* Allocate(size_t length) override;
43 void* AllocateUninitialized(size_t length) override; 56 void* AllocateUninitialized(size_t length) override;
44 void Free(void* data, size_t length) override; 57 void Free(void* data, size_t length) override;
45 }; 58 };
46 59
47 using FXJS_CONSTRUCTOR = void (*)(IFXJS_Context* cc, 60 using FXJS_CONSTRUCTOR = void (*)(IFXJS_Context* cc,
48 v8::Local<v8::Object> obj, 61 v8::Local<v8::Object> obj,
49 v8::Local<v8::Object> global); 62 v8::Local<v8::Object> global);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); 209 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
197 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, 210 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate,
198 v8::Local<v8::Value> pValue); 211 v8::Local<v8::Value> pValue);
199 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, 212 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate,
200 v8::Local<v8::Value> pValue); 213 v8::Local<v8::Value> pValue);
201 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, 214 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate,
202 v8::Local<v8::Value> pValue); 215 v8::Local<v8::Value> pValue);
203 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); 216 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
204 217
205 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 218 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698