| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "bindings/core/v8/ReadableStreamOperations.h" | 5 #include "bindings/core/v8/ReadableStreamOperations.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| 11 #include "bindings/core/v8/V8Binding.h" | 11 #include "bindings/core/v8/V8Binding.h" |
| 12 #include "bindings/core/v8/V8BindingForTesting.h" | 12 #include "bindings/core/v8/V8BindingForTesting.h" |
| 13 #include "bindings/core/v8/V8BindingMacros.h" | 13 #include "bindings/core/v8/V8BindingMacros.h" |
| 14 #include "bindings/core/v8/V8IteratorResultValue.h" | 14 #include "bindings/core/v8/V8IteratorResultValue.h" |
| 15 #include "bindings/core/v8/V8RecursionScope.h" |
| 15 #include "bindings/core/v8/V8ThrowException.h" | 16 #include "bindings/core/v8/V8ThrowException.h" |
| 16 #include "core/dom/Document.h" | 17 #include "core/dom/Document.h" |
| 17 #include "core/streams/ReadableStreamController.h" | 18 #include "core/streams/ReadableStreamController.h" |
| 18 #include "core/streams/UnderlyingSourceBase.h" | 19 #include "core/streams/UnderlyingSourceBase.h" |
| 19 #include "platform/heap/Handle.h" | 20 #include "platform/heap/Handle.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include <v8.h> | 22 #include <v8.h> |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| 24 | 25 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 EXPECT_FALSE(m_block.HasCaught()); | 143 EXPECT_FALSE(m_block.HasCaught()); |
| 143 } | 144 } |
| 144 | 145 |
| 145 ScriptState* getScriptState() const { return m_scope.getScriptState(); } | 146 ScriptState* getScriptState() const { return m_scope.getScriptState(); } |
| 146 v8::Isolate* isolate() const { return getScriptState()->isolate(); } | 147 v8::Isolate* isolate() const { return getScriptState()->isolate(); } |
| 147 | 148 |
| 148 ScriptValue eval(const char* s) | 149 ScriptValue eval(const char* s) |
| 149 { | 150 { |
| 150 v8::Local<v8::String> source; | 151 v8::Local<v8::String> source; |
| 151 v8::Local<v8::Script> script; | 152 v8::Local<v8::Script> script; |
| 152 v8::MicrotasksScope microtasks(isolate(), v8::MicrotasksScope::kDoNotRun
Microtasks); | 153 V8RecursionScope::MicrotaskSuppression microtasks(isolate()); |
| 153 if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNo
rmal), source)) { | 154 if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNo
rmal), source)) { |
| 154 ADD_FAILURE(); | 155 ADD_FAILURE(); |
| 155 return ScriptValue(); | 156 return ScriptValue(); |
| 156 } | 157 } |
| 157 if (!v8Call(v8::Script::Compile(getScriptState()->context(), source), sc
ript)) { | 158 if (!v8Call(v8::Script::Compile(getScriptState()->context(), source), sc
ript)) { |
| 158 ADD_FAILURE() << "Compilation fails"; | 159 ADD_FAILURE() << "Compilation fails"; |
| 159 return ScriptValue(); | 160 return ScriptValue(); |
| 160 } | 161 } |
| 161 return ScriptValue(getScriptState(), script->Run(getScriptState()->conte
xt())); | 162 return ScriptValue(getScriptState(), script->Run(getScriptState()->conte
xt())); |
| 162 } | 163 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 332 |
| 332 EXPECT_TRUE(it3->isSet()); | 333 EXPECT_TRUE(it3->isSet()); |
| 333 EXPECT_TRUE(it3->isValid()); | 334 EXPECT_TRUE(it3->isValid()); |
| 334 EXPECT_TRUE(it3->isDone()); | 335 EXPECT_TRUE(it3->isDone()); |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace | 338 } // namespace |
| 338 | 339 |
| 339 } // namespace blink | 340 } // namespace blink |
| 340 | 341 |
| OLD | NEW |