OLD | NEW |
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_SRC_JAVASCRIPT_JS_DEFINE_H_ | 7 #ifndef FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
8 #define FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ | 8 #define FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
9 | 9 |
10 #include "../../include/jsapi/fxjs_v8.h" | 10 #include "../../include/jsapi/fxjs_v8.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 CFX_WideString propname = | 428 CFX_WideString propname = |
429 CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); | 429 CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); |
430 CFX_WideString sError; | 430 CFX_WideString sError; |
431 if (!pObj->DelProperty(pContext, propname.c_str(), sError)) { | 431 if (!pObj->DelProperty(pContext, propname.c_str(), sError)) { |
432 CFX_ByteString cbName; | 432 CFX_ByteString cbName; |
433 cbName.Format("%s.%s", class_name, "DelProperty"); | 433 cbName.Format("%s.%s", class_name, "DelProperty"); |
434 // Probably a missing call to JSFX_Error(). | 434 // Probably a missing call to JSFX_Error(). |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 template <FX_BOOL (*F)(IJS_Context* cc, | 438 template <FX_BOOL ( |
439 const CJS_Parameters& params, | 439 *F)(IJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)> |
440 CJS_Value& vRet, | |
441 CFX_WideString& sError)> | |
442 void JSGlobalFunc(const char* func_name_string, | 440 void JSGlobalFunc(const char* func_name_string, |
443 const v8::FunctionCallbackInfo<v8::Value>& info) { | 441 const v8::FunctionCallbackInfo<v8::Value>& info) { |
444 CJS_Runtime* pRuntime = | 442 CJS_Runtime* pRuntime = |
445 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(info.GetIsolate())); | 443 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(info.GetIsolate())); |
446 if (!pRuntime) | 444 if (!pRuntime) |
447 return; | 445 return; |
448 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 446 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
449 CJS_Parameters parameters; | 447 CJS_Parameters parameters; |
450 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { | 448 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { |
451 parameters.push_back(CJS_Value(pRuntime, info[i], CJS_Value::VT_unknown)); | 449 parameters.push_back(CJS_Value(pRuntime, info[i], CJS_Value::VT_unknown)); |
(...skipping 30 matching lines...) Expand all Loading... |
482 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ | 480 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ |
483 FXJS_DefineGlobalMethod(pIsolate, \ | 481 FXJS_DefineGlobalMethod(pIsolate, \ |
484 js_class_name::global_methods[i].pName, \ | 482 js_class_name::global_methods[i].pName, \ |
485 js_class_name::global_methods[i].pMethodCall); \ | 483 js_class_name::global_methods[i].pMethodCall); \ |
486 } \ | 484 } \ |
487 } | 485 } |
488 | 486 |
489 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); | 487 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); |
490 | 488 |
491 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ | 489 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
OLD | NEW |