| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/SuspendableScriptExecutor.h" | 5 #include "web/SuspendableScriptExecutor.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ScriptController.h" | 8 #include "bindings/core/v8/ScriptController.h" |
| 9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 .ToLocal(&singleResult)) | 125 .ToLocal(&singleResult)) |
| 126 results.push_back(singleResult); | 126 results.push_back(singleResult); |
| 127 } | 127 } |
| 128 return results; | 128 return results; |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 SuspendableScriptExecutor* SuspendableScriptExecutor::create( | 133 SuspendableScriptExecutor* SuspendableScriptExecutor::create( |
| 134 LocalFrame* frame, | 134 LocalFrame* frame, |
| 135 int worldID, | 135 RefPtr<DOMWrapperWorld> world, |
| 136 const HeapVector<ScriptSourceCode>& sources, | 136 const HeapVector<ScriptSourceCode>& sources, |
| 137 bool userGesture, | 137 bool userGesture, |
| 138 WebScriptExecutionCallback* callback) { | 138 WebScriptExecutionCallback* callback) { |
| 139 // TODO(devlin): Passing in a v8::Isolate* directly would be better than | 139 ScriptState* scriptState = ScriptState::forWorld(frame, *world); |
| 140 // toIsolate() here. | |
| 141 ScriptState* scriptState = ScriptState::forWorld( | |
| 142 frame, *DOMWrapperWorld::fromWorldId(toIsolate(frame), worldID)); | |
| 143 return new SuspendableScriptExecutor( | 140 return new SuspendableScriptExecutor( |
| 144 frame, scriptState, callback, | 141 frame, scriptState, callback, |
| 145 new WebScriptExecutor(sources, worldID, userGesture)); | 142 new WebScriptExecutor(sources, world->worldId(), userGesture)); |
| 146 } | 143 } |
| 147 | 144 |
| 148 void SuspendableScriptExecutor::createAndRun( | 145 void SuspendableScriptExecutor::createAndRun( |
| 149 LocalFrame* frame, | 146 LocalFrame* frame, |
| 150 v8::Isolate* isolate, | 147 v8::Isolate* isolate, |
| 151 v8::Local<v8::Context> context, | 148 v8::Local<v8::Context> context, |
| 152 v8::Local<v8::Function> function, | 149 v8::Local<v8::Function> function, |
| 153 v8::Local<v8::Value> receiver, | 150 v8::Local<v8::Value> receiver, |
| 154 int argc, | 151 int argc, |
| 155 v8::Local<v8::Value> argv[], | 152 v8::Local<v8::Value> argv[], |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 m_keepAlive.clear(); | 242 m_keepAlive.clear(); |
| 246 stop(); | 243 stop(); |
| 247 } | 244 } |
| 248 | 245 |
| 249 DEFINE_TRACE(SuspendableScriptExecutor) { | 246 DEFINE_TRACE(SuspendableScriptExecutor) { |
| 250 visitor->trace(m_executor); | 247 visitor->trace(m_executor); |
| 251 SuspendableTimer::trace(visitor); | 248 SuspendableTimer::trace(visitor); |
| 252 } | 249 } |
| 253 | 250 |
| 254 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |