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

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

Issue 1061503005: bindings: Use Maybe version of Call() (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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 double start = currentTime(); 134 double start = currentTime();
135 m_windowProxyManager->clearForClose(); 135 m_windowProxyManager->clearForClose();
136 blink::Platform::current()->histogramCustomCounts("WebCore.ScriptController. clearForClose", (currentTime() - start) * 1000, 0, 10000, 50); 136 blink::Platform::current()->histogramCustomCounts("WebCore.ScriptController. clearForClose", (currentTime() - start) * 1000, 0, 10000, 50);
137 } 137 }
138 138
139 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) 139 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin)
140 { 140 {
141 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin); 141 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin);
142 } 142 }
143 143
144 v8::Local<v8::Value> ScriptController::callFunction(v8::Local<v8::Function> func tion, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) 144 v8::MaybeLocal<v8::Value> ScriptController::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[])
145 { 145 {
146 // Keep LocalFrame (and therefore ScriptController) alive. 146 // Keep LocalFrame (and therefore ScriptController) alive.
147 RefPtrWillBeRawPtr<LocalFrame> protect(frame()); 147 RefPtrWillBeRawPtr<LocalFrame> protect(frame());
148 return ScriptController::callFunction(frame()->document(), function, receive r, argc, info, isolate()); 148 return ScriptController::callFunction(frame()->document(), function, receive r, argc, info, isolate());
149 } 149 }
150 150
151 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v 8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Lo cal<v8::Value> info[], v8::Isolate* isolate) 151 v8::MaybeLocal<v8::Value> ScriptController::callFunction(ExecutionContext* conte xt, v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v 8::Local<v8::Value> info[], v8::Isolate* isolate)
152 { 152 {
153 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(isolate, context, function)); 153 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(isolate, context, function));
154 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu nction(context, DevToolsFunctionInfo(function)); 154 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu nction(context, DevToolsFunctionInfo(function));
155 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context , receiver, argc, info, isolate); 155 v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callFunction(function, co ntext, receiver, argc, info, isolate);
156 InspectorInstrumentation::didCallFunction(cookie); 156 InspectorInstrumentation::didCallFunction(cookie);
157 return result; 157 return result;
158 } 158 }
159 159
160 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Local<v8: :Context> context, const ScriptSourceCode& source, AccessControlStatus corsStatu s, double* compilationFinishTime) 160 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Local<v8: :Context> context, const ScriptSourceCode& source, AccessControlStatus corsStatu s, double* compilationFinishTime)
161 { 161 {
162 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript ", "data", InspectorEvaluateScriptEvent::data(frame(), source.url().string(), so urce.startLine())); 162 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript ", "data", InspectorEvaluateScriptEvent::data(frame(), source.url().string(), so urce.startLine()));
163 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua teScript(frame(), source.url().string(), source.startLine()); 163 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua teScript(frame(), source.url().string(), source.startLine());
164 164
165 v8::Local<v8::Value> result; 165 v8::Local<v8::Value> result;
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 for (size_t i = 0; i < resultArray->Length(); ++i) { 590 for (size_t i = 0; i < resultArray->Length(); ++i) {
591 v8::Local<v8::Value> value; 591 v8::Local<v8::Value> value;
592 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 592 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
593 return; 593 return;
594 results->append(value); 594 results->append(value);
595 } 595 }
596 } 596 }
597 } 597 }
598 598
599 } // namespace blink 599 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptController.h ('k') | Source/bindings/core/v8/ScriptFunctionCall.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698