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

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

Issue 1140033004: Merge V8 API updates to xfa branch (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 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 | « OWNERS ('k') | fpdfsdk/include/javascript/JS_Object.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 _JS_DEFINE_H_ 7 #ifndef _JS_DEFINE_H_
8 #define _JS_DEFINE_H_ 8 #define _JS_DEFINE_H_
9 9
10 #include "../jsapi/fxjs_v8.h" 10 #include "../jsapi/fxjs_v8.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext(); 62 IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
63 CJS_PropValue value(isolate); 63 CJS_PropValue value(isolate);
64 value.StartGetting(); 64 value.StartGetting();
65 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder()); 65 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
66 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); 66 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
67 CFX_WideString sError; 67 CFX_WideString sError;
68 if (!(pObj->*M)(pRuntimeContext, value, sError)) { 68 if (!(pObj->*M)(pRuntimeContext, value, sError)) {
69 JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, s Error)); 69 JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, s Error));
70 return; 70 return;
71 } 71 }
72 info.GetReturnValue().Set((v8::Handle<v8::Value>)value); 72 info.GetReturnValue().Set((v8::Local<v8::Value>)value);
73 } 73 }
74 74
75 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideStrin g&)> 75 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideStrin g&)>
76 void JSPropSetter(const char* prop_name_string, 76 void JSPropSetter(const char* prop_name_string,
77 const char* class_name_string, 77 const char* class_name_string,
78 v8::Local<v8::String> property, 78 v8::Local<v8::String> property,
79 v8::Local<v8::Value> value, 79 v8::Local<v8::Value> value,
80 const v8::PropertyCallbackInfo<void>& info) { 80 const v8::PropertyCallbackInfo<void>& info) {
81 v8::Isolate* isolate = info.GetIsolate(); 81 v8::Isolate* isolate = info.GetIsolate();
82 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2); 82 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); 248 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
249 v8::String::Utf8Value utf8_value(property); 249 v8::String::Utf8Value utf8_value(property);
250 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.len gth()); 250 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.len gth());
251 CFX_WideString sError; 251 CFX_WideString sError;
252 CJS_PropValue value(isolate); 252 CJS_PropValue value(isolate);
253 value.StartGetting(); 253 value.StartGetting();
254 if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) { 254 if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) {
255 JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError)); 255 JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
256 return; 256 return;
257 } 257 }
258 info.GetReturnValue().Set((v8::Handle<v8::Value>)value); 258 info.GetReturnValue().Set((v8::Local<v8::Value>)value);
259 } 259 }
260 260
261 template <class Alt> 261 template <class Alt>
262 void JSSpecialPropPut(const char* class_name, 262 void JSSpecialPropPut(const char* class_name,
263 v8::Local<v8::String> property, 263 v8::Local<v8::String> property,
264 v8::Local<v8::Value> value, 264 v8::Local<v8::Value> value,
265 const v8::PropertyCallbackInfo<v8::Value>& info) { 265 const v8::PropertyCallbackInfo<v8::Value>& info) {
266 v8::Isolate* isolate = info.GetIsolate(); 266 v8::Isolate* isolate = info.GetIsolate();
267 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 267 v8::Local<v8::Context> context = isolate->GetCurrentContext();
268 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2); 268 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 #define VALUE_NAME_STRING L"string" 439 #define VALUE_NAME_STRING L"string"
440 #define VALUE_NAME_NUMBER L"number" 440 #define VALUE_NAME_NUMBER L"number"
441 #define VALUE_NAME_BOOLEAN L"boolean" 441 #define VALUE_NAME_BOOLEAN L"boolean"
442 #define VALUE_NAME_DATE L"date" 442 #define VALUE_NAME_DATE L"date"
443 #define VALUE_NAME_OBJECT L"object" 443 #define VALUE_NAME_OBJECT L"object"
444 #define VALUE_NAME_FXOBJ L"fxobj" 444 #define VALUE_NAME_FXOBJ L"fxobj"
445 #define VALUE_NAME_NULL L"null" 445 #define VALUE_NAME_NULL L"null"
446 #define VALUE_NAME_UNDEFINED L"undefined" 446 #define VALUE_NAME_UNDEFINED L"undefined"
447 447
448 FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p); 448 FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p);
449 449
450 #endif //_JS_DEFINE_H_ 450 #endif //_JS_DEFINE_H_
OLDNEW
« no previous file with comments | « OWNERS ('k') | fpdfsdk/include/javascript/JS_Object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698