| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Vector<v8::Local<v8::Value>> WebScriptExecutor::Execute(LocalFrame* frame) { | 52 Vector<v8::Local<v8::Value>> WebScriptExecutor::Execute(LocalFrame* frame) { |
| 53 std::unique_ptr<UserGestureIndicator> indicator; | 53 std::unique_ptr<UserGestureIndicator> indicator; |
| 54 if (user_gesture_) { | 54 if (user_gesture_) { |
| 55 indicator = WTF::WrapUnique( | 55 indicator = WTF::WrapUnique( |
| 56 new UserGestureIndicator(DocumentUserGestureToken::Create( | 56 new UserGestureIndicator(DocumentUserGestureToken::Create( |
| 57 frame->GetDocument(), UserGestureToken::kNewGesture))); | 57 frame->GetDocument(), UserGestureToken::kNewGesture))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 Vector<v8::Local<v8::Value>> results; | 60 Vector<v8::Local<v8::Value>> results; |
| 61 if (world_id_) { | 61 if (world_id_) { |
| 62 frame->Script().ExecuteScriptInIsolatedWorld(world_id_, sources_, &results); | 62 frame->GetScriptController().ExecuteScriptInIsolatedWorld( |
| 63 world_id_, sources_, &results); |
| 63 } else { | 64 } else { |
| 64 v8::Local<v8::Value> script_value = | 65 v8::Local<v8::Value> script_value = |
| 65 frame->Script().ExecuteScriptInMainWorldAndReturnValue( | 66 frame->GetScriptController().ExecuteScriptInMainWorldAndReturnValue( |
| 66 sources_.front()); | 67 sources_.front()); |
| 67 results.push_back(script_value); | 68 results.push_back(script_value); |
| 68 } | 69 } |
| 69 | 70 |
| 70 return results; | 71 return results; |
| 71 } | 72 } |
| 72 | 73 |
| 73 class V8FunctionExecutor : public SuspendableScriptExecutor::Executor { | 74 class V8FunctionExecutor : public SuspendableScriptExecutor::Executor { |
| 74 public: | 75 public: |
| 75 V8FunctionExecutor(v8::Isolate*, | 76 V8FunctionExecutor(v8::Isolate*, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 keep_alive_.Clear(); | 240 keep_alive_.Clear(); |
| 240 Stop(); | 241 Stop(); |
| 241 } | 242 } |
| 242 | 243 |
| 243 DEFINE_TRACE(SuspendableScriptExecutor) { | 244 DEFINE_TRACE(SuspendableScriptExecutor) { |
| 244 visitor->Trace(executor_); | 245 visitor->Trace(executor_); |
| 245 SuspendableTimer::Trace(visitor); | 246 SuspendableTimer::Trace(visitor); |
| 246 } | 247 } |
| 247 | 248 |
| 248 } // namespace blink | 249 } // namespace blink |
| OLD | NEW |