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

Side by Side Diff: Source/bindings/core/v8/NPV8Object.cpp

Issue 1036803002: binidngs: Make callInternalFunction return MaybeLocal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptDebugServer.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 /* 1 /*
2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 " }" 554 " }"
555 " return props;" 555 " return props;"
556 "});"; 556 "});";
557 v8::Local<v8::String> source = v8AtomicString(isolate, enumeratorCode); 557 v8::Local<v8::String> source = v8AtomicString(isolate, enumeratorCode);
558 v8::Local<v8::Value> result; 558 v8::Local<v8::Value> result;
559 if (!V8ScriptRunner::compileAndRunInternalScript(source, isolate).ToLoca l(&result)) 559 if (!V8ScriptRunner::compileAndRunInternalScript(source, isolate).ToLoca l(&result))
560 return false; 560 return false;
561 ASSERT(result->IsFunction()); 561 ASSERT(result->IsFunction());
562 v8::Local<v8::Function> enumerator = v8::Local<v8::Function>::Cast(resul t); 562 v8::Local<v8::Function> enumerator = v8::Local<v8::Function>::Cast(resul t);
563 v8::Local<v8::Value> argv[] = { obj }; 563 v8::Local<v8::Value> argv[] = { obj };
564 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu merator, v8::Local<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, isol ate); 564 v8::Local<v8::Value> propsObj;
565 if (propsObj.IsEmpty()) 565 if (!V8ScriptRunner::callInternalFunction(enumerator, v8::Local<v8::Obje ct>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, isolate).ToLocal(&propsObj))
566 return false; 566 return false;
567 567
568 // Convert the results into an array of NPIdentifiers. 568 // Convert the results into an array of NPIdentifiers.
569 v8::Local<v8::Array> props = v8::Local<v8::Array>::Cast(propsObj); 569 v8::Local<v8::Array> props = v8::Local<v8::Array>::Cast(propsObj);
570 *count = props->Length(); 570 *count = props->Length();
571 *identifier = static_cast<NPIdentifier*>(calloc(*count, sizeof(NPIdentif ier))); 571 *identifier = static_cast<NPIdentifier*>(calloc(*count, sizeof(NPIdentif ier)));
572 for (uint32_t i = 0; i < *count; ++i) { 572 for (uint32_t i = 0; i < *count; ++i) {
573 v8::Local<v8::Value> name = props->Get(v8::Integer::New(isolate, i)) ; 573 v8::Local<v8::Value> name = props->Get(v8::Integer::New(isolate, i)) ;
574 (*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(n ame)); 574 (*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(n ame));
575 } 575 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); 617 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result);
618 return true; 618 return true;
619 } 619 }
620 620
621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
623 623
624 return false; 624 return false;
625 } 625 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698