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

Side by Side Diff: fxjs/fxjs_v8.cpp

Issue 2151023002: Do not try to v8::Object::Clone() any objects (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 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 | « fpdfsdk/javascript/JS_Value.cpp ('k') | fxjs/include/fxjs_v8.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 #include "fxjs/include/fxjs_v8.h" 7 #include "fxjs/include/fxjs_v8.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 772 }
773 773
774 v8::Local<v8::Value> FXJS_NewNumber(v8::Isolate* pIsolate, float number) { 774 v8::Local<v8::Value> FXJS_NewNumber(v8::Isolate* pIsolate, float number) {
775 return v8::Number::New(pIsolate, (float)number); 775 return v8::Number::New(pIsolate, (float)number);
776 } 776 }
777 777
778 v8::Local<v8::Value> FXJS_NewBoolean(v8::Isolate* pIsolate, bool b) { 778 v8::Local<v8::Value> FXJS_NewBoolean(v8::Isolate* pIsolate, bool b) {
779 return v8::Boolean::New(pIsolate, b); 779 return v8::Boolean::New(pIsolate, b);
780 } 780 }
781 781
782 v8::Local<v8::Value> FXJS_NewObject(v8::Isolate* pIsolate,
783 v8::Local<v8::Object> pObj) {
784 if (pObj.IsEmpty())
785 return v8::Local<v8::Value>();
786 return pObj->Clone();
787 }
788
789 v8::Local<v8::Value> FXJS_NewObject2(v8::Isolate* pIsolate,
790 v8::Local<v8::Array> pObj) {
791 if (pObj.IsEmpty())
792 return v8::Local<v8::Value>();
793 return pObj->Clone();
794 }
795
796 v8::Local<v8::Value> FXJS_NewString(v8::Isolate* pIsolate, const wchar_t* str) { 782 v8::Local<v8::Value> FXJS_NewString(v8::Isolate* pIsolate, const wchar_t* str) {
797 return FXJS_WSToJSString(pIsolate, str); 783 return FXJS_WSToJSString(pIsolate, str);
798 } 784 }
799 785
800 v8::Local<v8::Value> FXJS_NewNull() { 786 v8::Local<v8::Value> FXJS_NewNull(v8::Isolate* pIsolate) {
801 return v8::Local<v8::Value>(); 787 return v8::Local<v8::Value>();
802 } 788 }
803 789
804 v8::Local<v8::Value> FXJS_NewDate(v8::Isolate* pIsolate, double d) { 790 v8::Local<v8::Value> FXJS_NewDate(v8::Isolate* pIsolate, double d) {
805 return v8::Date::New(pIsolate->GetCurrentContext(), d).ToLocalChecked(); 791 return v8::Date::New(pIsolate->GetCurrentContext(), d).ToLocalChecked();
806 } 792 }
807 793
808 int FXJS_ToInt32(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) { 794 int FXJS_ToInt32(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) {
809 if (pValue.IsEmpty()) 795 if (pValue.IsEmpty())
810 return 0; 796 return 0;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 v8::Local<v8::Value> pValue) { 833 v8::Local<v8::Value> pValue) {
848 if (pValue.IsEmpty()) 834 if (pValue.IsEmpty())
849 return v8::Local<v8::Array>(); 835 return v8::Local<v8::Array>();
850 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); 836 v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
851 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); 837 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
852 } 838 }
853 839
854 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { 840 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) {
855 pTo = pFrom; 841 pTo = pFrom;
856 } 842 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/JS_Value.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698