| 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 #include "fxjs/include/fxjs_v8.h" | 7 #include "fxjs/include/fxjs_v8.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 } | 751 } |
| 752 | 752 |
| 753 v8::Local<v8::Value> FXJS_NewString(v8::Isolate* pIsolate, const wchar_t* str) { | 753 v8::Local<v8::Value> FXJS_NewString(v8::Isolate* pIsolate, const wchar_t* str) { |
| 754 return FXJS_WSToJSString(pIsolate, str); | 754 return FXJS_WSToJSString(pIsolate, str); |
| 755 } | 755 } |
| 756 | 756 |
| 757 v8::Local<v8::Value> FXJS_NewNull(v8::Isolate* pIsolate) { | 757 v8::Local<v8::Value> FXJS_NewNull(v8::Isolate* pIsolate) { |
| 758 return v8::Local<v8::Value>(); | 758 return v8::Local<v8::Value>(); |
| 759 } | 759 } |
| 760 | 760 |
| 761 v8::Local<v8::Value> FXJS_NewDate(v8::Isolate* pIsolate, double d) { | 761 v8::Local<v8::Date> FXJS_NewDate(v8::Isolate* pIsolate, double d) { |
| 762 return v8::Date::New(pIsolate->GetCurrentContext(), d).ToLocalChecked(); | 762 return v8::Date::New(pIsolate->GetCurrentContext(), d) |
| 763 .ToLocalChecked() |
| 764 .As<v8::Date>(); |
| 763 } | 765 } |
| 764 | 766 |
| 765 int FXJS_ToInt32(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) { | 767 int FXJS_ToInt32(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) { |
| 766 if (pValue.IsEmpty()) | 768 if (pValue.IsEmpty()) |
| 767 return 0; | 769 return 0; |
| 768 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 770 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 769 return pValue->ToInt32(context).ToLocalChecked()->Value(); | 771 return pValue->ToInt32(context).ToLocalChecked()->Value(); |
| 770 } | 772 } |
| 771 | 773 |
| 772 bool FXJS_ToBoolean(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) { | 774 bool FXJS_ToBoolean(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 800 return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length())); | 802 return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length())); |
| 801 } | 803 } |
| 802 | 804 |
| 803 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, | 805 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
| 804 v8::Local<v8::Value> pValue) { | 806 v8::Local<v8::Value> pValue) { |
| 805 if (pValue.IsEmpty()) | 807 if (pValue.IsEmpty()) |
| 806 return v8::Local<v8::Array>(); | 808 return v8::Local<v8::Array>(); |
| 807 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 809 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 808 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 810 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
| 809 } | 811 } |
| 810 | |
| 811 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | |
| 812 pTo = pFrom; | |
| 813 } | |
| OLD | NEW |