Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: third_party/WebKit/Source/core/streams/ReadableStreamController.h

Issue 2312413003: Remove isTerminating checks from fetch API + streams code (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/streams/ReadableStreamController.h
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamController.h b/third_party/WebKit/Source/core/streams/ReadableStreamController.h
index c25b1d95061337a4d56d83bdcbb297f630b30731..820e20f974426e362b34317052e9ffaf2cb22a9d 100644
--- a/third_party/WebKit/Source/core/streams/ReadableStreamController.h
+++ b/third_party/WebKit/Source/core/streams/ReadableStreamController.h
@@ -9,9 +9,7 @@
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8ScriptRunner.h"
-#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
#include "core/CoreExport.h"
-#include "core/workers/WorkerGlobalScope.h"
#include "platform/heap/Handle.h"
#include "wtf/RefPtr.h"
#include <v8.h>
@@ -45,10 +43,6 @@ public:
void close()
{
- if (isTerminating(m_scriptState.get())) {
- m_jsController.clear();
- return;
- }
ScriptState* scriptState = m_scriptState.get();
ScriptState::Scope scope(scriptState); // will assert context is valid; do not call this method when the context is invalidated
v8::Isolate* isolate = scriptState->isolate();
@@ -60,15 +54,11 @@ public:
v8::Local<v8::Value> args[] = { controller };
v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(scriptState, "ReadableStreamDefaultControllerClose", args);
m_jsController.clear();
- if (isTerminating(m_scriptState.get()))
- return;
result.ToLocalChecked();
}
double desiredSize() const
{
- if (isTerminating(m_scriptState.get()))
- return 0;
ScriptState* scriptState = m_scriptState.get();
ScriptState::Scope scope(scriptState); // will assert context is valid; do not call this method when the context is invalidated
v8::Isolate* isolate = scriptState->isolate();
@@ -79,8 +69,6 @@ public:
v8::Local<v8::Value> args[] = { controller };
v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(scriptState, "ReadableStreamDefaultControllerGetDesiredSize", args);
- if (isTerminating(m_scriptState.get()))
- return 0;
return result.ToLocalChecked().As<v8::Number>()->Value();
}
@@ -88,8 +76,6 @@ public:
template <typename ChunkType>
void enqueue(ChunkType chunk) const
{
- if (isTerminating(m_scriptState.get()))
- return;
ScriptState* scriptState = m_scriptState.get();
ScriptState::Scope scope(scriptState); // will assert context is valid; do not call this method when the context is invalidated
v8::Isolate* isolate = scriptState->isolate();
@@ -101,18 +87,12 @@ public:
v8::Local<v8::Value> jsChunk = toV8(chunk, scriptState);
v8::Local<v8::Value> args[] = { controller, jsChunk };
v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(scriptState, "ReadableStreamDefaultControllerEnqueue", args);
- if (isTerminating(m_scriptState.get()))
- return;
result.ToLocalChecked();
}
template <typename ErrorType>
void error(ErrorType error)
{
- if (isTerminating(m_scriptState.get())) {
- m_jsController.clear();
- return;
- }
ScriptState* scriptState = m_scriptState.get();
ScriptState::Scope scope(scriptState); // will assert context is valid; do not call this method when the context is invalidated
v8::Isolate* isolate = scriptState->isolate();
@@ -125,22 +105,10 @@ public:
v8::Local<v8::Value> args[] = { controller, jsError };
v8::MaybeLocal<v8::Value> result = V8ScriptRunner::callExtra(scriptState, "ReadableStreamDefaultControllerError", args);
m_jsController.clear();
- if (isTerminating(m_scriptState.get()))
- return;
result.ToLocalChecked();
}
private:
- static bool isTerminating(ScriptState* scriptState)
- {
- ExecutionContext* executionContext = scriptState->getExecutionContext();
- if (!executionContext)
- return true;
- if (!executionContext->isWorkerGlobalScope())
- return false;
- return toWorkerGlobalScope(executionContext)->scriptController()->isExecutionTerminating();
- }
-
RefPtr<ScriptState> m_scriptState;
ScopedPersistent<v8::Value> m_jsController;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698