| OLD | NEW |
| 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 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 double start = currentTime(); | 139 double start = currentTime(); |
| 140 clearForClose(false); | 140 clearForClose(false); |
| 141 WebKit::Platform::current()->histogramCustomCounts("WebCore.ScriptController
.clearForClose", (currentTime() - start) * 1000, 0, 10000, 50); | 141 WebKit::Platform::current()->histogramCustomCounts("WebCore.ScriptController
.clearForClose", (currentTime() - start) * 1000, 0, 10000, 50); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ScriptController::updateSecurityOrigin() | 144 void ScriptController::updateSecurityOrigin() |
| 145 { | 145 { |
| 146 m_windowShell->updateSecurityOrigin(); | 146 m_windowShell->updateSecurityOrigin(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) | 149 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> info[]) |
| 150 { | 150 { |
| 151 // Keep Frame (and therefore ScriptController) alive. | 151 // Keep Frame (and therefore ScriptController) alive. |
| 152 RefPtr<Frame> protect(m_frame); | 152 RefPtr<Frame> protect(m_frame); |
| 153 return ScriptController::callFunction(m_frame->document(), function, receive
r, argc, args, m_isolate); | 153 return ScriptController::callFunction(m_frame->document(), function, receive
r, argc, info, m_isolate); |
| 154 } | 154 } |
| 155 | 155 |
| 156 static void resourceInfo(const v8::Handle<v8::Function> function, String& resour
ceName, int& lineNumber) | 156 static void resourceInfo(const v8::Handle<v8::Function> function, String& resour
ceName, int& lineNumber) |
| 157 { | 157 { |
| 158 v8::ScriptOrigin origin = function->GetScriptOrigin(); | 158 v8::ScriptOrigin origin = function->GetScriptOrigin(); |
| 159 if (origin.ResourceName().IsEmpty()) { | 159 if (origin.ResourceName().IsEmpty()) { |
| 160 resourceName = "undefined"; | 160 resourceName = "undefined"; |
| 161 lineNumber = 1; | 161 lineNumber = 1; |
| 162 } else { | 162 } else { |
| 163 resourceName = toWebCoreString(origin.ResourceName()); | 163 resourceName = toWebCoreString(origin.ResourceName()); |
| 164 lineNumber = function->GetScriptLineNumber() + 1; | 164 lineNumber = function->GetScriptLineNumber() + 1; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v
8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8:
:Handle<v8::Value> args[], v8::Isolate* isolate) | 168 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v
8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8:
:Handle<v8::Value> info[], v8::Isolate* isolate) |
| 169 { | 169 { |
| 170 InspectorInstrumentationCookie cookie; | 170 InspectorInstrumentationCookie cookie; |
| 171 if (InspectorInstrumentation::timelineAgentEnabled(context)) { | 171 if (InspectorInstrumentation::timelineAgentEnabled(context)) { |
| 172 String resourceName; | 172 String resourceName; |
| 173 int lineNumber; | 173 int lineNumber; |
| 174 resourceInfo(function, resourceName, lineNumber); | 174 resourceInfo(function, resourceName, lineNumber); |
| 175 cookie = InspectorInstrumentation::willCallFunction(context, resourceNam
e, lineNumber); | 175 cookie = InspectorInstrumentation::willCallFunction(context, resourceNam
e, lineNumber); |
| 176 } | 176 } |
| 177 | 177 |
| 178 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context
, receiver, argc, args, isolate); | 178 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context
, receiver, argc, info, isolate); |
| 179 | 179 |
| 180 InspectorInstrumentation::didCallFunction(cookie); | 180 InspectorInstrumentation::didCallFunction(cookie); |
| 181 return result; | 181 return result; |
| 182 } | 182 } |
| 183 | 183 |
| 184 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8
::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat
us) | 184 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8
::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat
us) |
| 185 { | 185 { |
| 186 v8::Context::Scope scope(context); | 186 v8::Context::Scope scope(context); |
| 187 | 187 |
| 188 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua
teScript(m_frame, source.url().isNull() ? String() : source.url().string(), sour
ce.startLine()); | 188 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua
teScript(m_frame, source.url().isNull() ? String() : source.url().string(), sour
ce.startLine()); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 v8Results = evaluateHandleScope.Close(resultArray); | 687 v8Results = evaluateHandleScope.Close(resultArray); |
| 688 } | 688 } |
| 689 | 689 |
| 690 if (results && !v8Results.IsEmpty()) { | 690 if (results && !v8Results.IsEmpty()) { |
| 691 for (size_t i = 0; i < v8Results->Length(); ++i) | 691 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 692 results->append(ScriptValue(v8Results->Get(i), m_isolate)); | 692 results->append(ScriptValue(v8Results->Get(i), m_isolate)); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 | 695 |
| 696 } // namespace WebCore | 696 } // namespace WebCore |
| OLD | NEW |