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

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

Issue 1003043002: bindings: Use Maybe APIs in V8ScriptRunner (part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // on the object into an array. 548 // on the object into an array.
549 const char enumeratorCode[] = 549 const char enumeratorCode[] =
550 "(function (obj) {" 550 "(function (obj) {"
551 " var props = [];" 551 " var props = [];"
552 " for (var prop in obj) {" 552 " for (var prop in obj) {"
553 " props[props.length] = prop;" 553 " props[props.length] = prop;"
554 " }" 554 " }"
555 " return props;" 555 " return props;"
556 "});"; 556 "});";
557 v8::Handle<v8::String> source = v8AtomicString(isolate, enumeratorCode); 557 v8::Handle<v8::String> source = v8AtomicString(isolate, enumeratorCode);
558 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScri pt(source, isolate); 558 v8::Local<v8::Value> result;
559 ASSERT(!result.IsEmpty()); 559 if (!V8ScriptRunner::compileAndRunInternalScript(source, isolate).ToLoca l(&result))
dcarney 2015/03/13 08:15:45 use macros to remove the if(!whatever) block in mo
bashi 2015/03/17 02:01:36 We discussed how we handle ToLocal failure, and we
560 return false;
560 ASSERT(result->IsFunction()); 561 ASSERT(result->IsFunction());
561 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res ult); 562 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res ult);
562 v8::Handle<v8::Value> argv[] = { obj }; 563 v8::Handle<v8::Value> argv[] = { obj };
563 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, iso late); 564 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, iso late);
564 if (propsObj.IsEmpty()) 565 if (propsObj.IsEmpty())
565 return false; 566 return false;
566 567
567 // Convert the results into an array of NPIdentifiers. 568 // Convert the results into an array of NPIdentifiers.
568 v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj); 569 v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj);
569 *count = props->Length(); 570 *count = props->Length();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 616
616 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); 617 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result);
617 return true; 618 return true;
618 } 619 }
619 620
620 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)
621 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
622 623
623 return false; 624 return false;
624 } 625 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/PrivateScriptRunner.cpp » ('j') | Source/bindings/core/v8/ScriptDebugServer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698