Chromium Code Reviews| Index: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp |
| diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp |
| index 0da568020a8a300f9977abc4ffe4fa9681e78975..bacaaf16be25680c52a72d8045b610929316ef27 100644 |
| --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp |
| +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp |
| @@ -6,13 +6,11 @@ |
| #include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/V8HiddenValue.h" |
| -#include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| #include "core/dom/DOMArrayBuffer.h" |
| #include "core/dom/DOMTypedArray.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/streams/ReadableStreamController.h" |
| #include "core/streams/ReadableStreamOperations.h" |
| -#include "core/workers/WorkerGlobalScope.h" |
| #include "modules/fetch/Body.h" |
| #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
| #include "modules/fetch/DataConsumerHandleUtil.h" |
| @@ -24,20 +22,6 @@ |
| namespace blink { |
| -namespace { |
| - |
| -bool isTerminating(ScriptState* scriptState) |
| -{ |
| - ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| - if (!executionContext) |
| - return true; |
| - if (!executionContext->isWorkerGlobalScope()) |
| - return false; |
| - return toWorkerGlobalScope(executionContext)->scriptController()->isExecutionTerminating(); |
| -} |
| - |
| -} // namespace |
| - |
| class BodyStreamBuffer::LoaderClient final : public GarbageCollectedFinalized<LoaderClient>, public ActiveDOMObject, public FetchDataLoader::Client { |
| WTF_MAKE_NONCOPYABLE(LoaderClient); |
| USING_GARBAGE_COLLECTED_MIXIN(LoaderClient); |
| @@ -105,14 +89,8 @@ BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<Fet |
| , m_reader(m_handle->obtainFetchDataReader(this)) |
| , m_madeFromReadableStream(false) |
| { |
| - if (isTerminating(scriptState)) { |
| - m_reader = nullptr; |
| - m_handle = nullptr; |
| - return; |
| - } |
| v8::Local<v8::Value> bodyValue = toV8(this, scriptState); |
| if (bodyValue.IsEmpty()) { |
| - DCHECK(isTerminating(scriptState)); |
| m_reader = nullptr; |
| m_handle = nullptr; |
| return; |
| @@ -122,11 +100,6 @@ BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<Fet |
| ScriptValue readableStream = ReadableStreamOperations::createReadableStream( |
| scriptState, this, ReadableStreamOperations::createCountQueuingStrategy(scriptState, 0)); |
| - if (isTerminating(scriptState)) { |
| - m_reader = nullptr; |
| - m_handle = nullptr; |
| - return; |
| - } |
| V8HiddenValue::setHiddenValue(scriptState, body, V8HiddenValue::internalBodyStream(scriptState->isolate()), readableStream.v8Value()); |
| } |
| @@ -136,13 +109,9 @@ BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, ScriptValue stream) |
| , m_madeFromReadableStream(true) |
| { |
| DCHECK(ReadableStreamOperations::isReadableStream(scriptState, stream)); |
| - if (isTerminating(scriptState)) |
| - return; |
| v8::Local<v8::Value> bodyValue = toV8(this, scriptState); |
| - if (bodyValue.IsEmpty()) { |
| - DCHECK(isTerminating(scriptState)); |
| + if (bodyValue.IsEmpty()) |
|
haraken
2016/08/22 04:35:39
I recently changed toV8 so that it never returns a
yhirano
2016/08/22 06:22:13
+1
nhiroki
2016/08/22 06:57:46
Removed the empty checks in this CL.
|
| return; |
| - } |
| DCHECK(bodyValue->IsObject()); |
| v8::Local<v8::Object> body = bodyValue.As<v8::Object>(); |
| @@ -152,13 +121,9 @@ BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, ScriptValue stream) |
| ScriptValue BodyStreamBuffer::stream() |
| { |
| ScriptState::Scope scope(m_scriptState.get()); |
| - if (isTerminating(m_scriptState.get())) |
| - return ScriptValue(); |
| v8::Local<v8::Value> bodyValue = toV8(this, m_scriptState.get()); |
| - if (bodyValue.IsEmpty()) { |
| - DCHECK(isTerminating(m_scriptState.get())); |
| + if (bodyValue.IsEmpty()) |
| return ScriptValue(); |
| - } |
| DCHECK(bodyValue->IsObject()); |
| v8::Local<v8::Object> body = bodyValue.As<v8::Object>(); |
| return ScriptValue(m_scriptState.get(), V8HiddenValue::getHiddenValue(m_scriptState.get(), body, V8HiddenValue::internalBodyStream(m_scriptState->isolate()))); |