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

Side by Side Diff: Source/bindings/core/v8/ScriptController.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) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple 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 are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (frame()->settings()) 168 if (frame()->settings())
169 v8CacheOptions = frame()->settings()->v8CacheOptions(); 169 v8CacheOptions = frame()->settings()->v8CacheOptions();
170 170
171 // Isolate exceptions that occur when compiling and executing 171 // Isolate exceptions that occur when compiling and executing
172 // the code. These exceptions should not interfere with 172 // the code. These exceptions should not interfere with
173 // javascript code we might evaluate from C++ when returning 173 // javascript code we might evaluate from C++ when returning
174 // from here. 174 // from here.
175 v8::TryCatch tryCatch; 175 v8::TryCatch tryCatch;
176 tryCatch.SetVerbose(true); 176 tryCatch.SetVerbose(true);
177 177
178 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, is olate(), corsStatus, v8CacheOptions); 178 v8::Local<v8::Script> script;
179 if (!v8Call(V8ScriptRunner::compileScript(source, isolate(), corsStatus, v8CacheOptions), script, tryCatch))
180 return result;
179 181
180 if (compilationFinishTime) { 182 if (compilationFinishTime) {
181 *compilationFinishTime = WTF::monotonicallyIncreasingTime(); 183 *compilationFinishTime = WTF::monotonicallyIncreasingTime();
182 } 184 }
183 // Keep LocalFrame (and therefore ScriptController) alive. 185 // Keep LocalFrame (and therefore ScriptController) alive.
184 RefPtrWillBeRawPtr<LocalFrame> protect(frame()); 186 RefPtrWillBeRawPtr<LocalFrame> protect(frame());
185 result = V8ScriptRunner::runCompiledScript(isolate(), script, frame()->d ocument()); 187 if (!v8Call(V8ScriptRunner::runCompiledScript(isolate(), script, frame() ->document()), result, tryCatch))
186 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); 188 return result;
187 } 189 }
188 190
189 InspectorInstrumentation::didEvaluateScript(cookie); 191 InspectorInstrumentation::didEvaluateScript(cookie);
190 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data()); 192 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data());
191 193
192 return result; 194 return result;
193 } 195 }
194 196
195 bool ScriptController::initializeMainWorld() 197 bool ScriptController::initializeMainWorld()
196 { 198 {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 resultArray->Set(i, evaluationResult); 586 resultArray->Set(i, evaluationResult);
585 } 587 }
586 588
587 if (results) { 589 if (results) {
588 for (size_t i = 0; i < resultArray->Length(); ++i) 590 for (size_t i = 0; i < resultArray->Length(); ++i)
589 results->append(resultArray->Get(i)); 591 results->append(resultArray->Get(i));
590 } 592 }
591 } 593 }
592 594
593 } // namespace blink 595 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698