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