Commit 4956b649 authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Expose Controller() in UnderlyingSinkBase

In the JavaScript API for underlying sinks, they usually capture the
controller if they need it in the start() method. However, the C++
UnderlyingSinkBase needs to store the controller internally for its own
use. It's wasteful for subclasses to take their own copy. Instead expose
it to subclasses directly via a protected getter.

This getter will be used by the implementation of WebSocketStream. See
the design doc at
https://docs.google.com/document/d/1XuxEshh5VYBYm1qRVKordTamCOsR-uGQBCYFcHXP4L0/edit.

Also fix a bug in the generic version of
WritableStreamDefaultControllerInterface::Error().

BUG=983030

Change-Id: I5339f9117f52b78947592b417cb595b2fa496c3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1734738Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684284}
parent 12b3a16b
...@@ -50,6 +50,11 @@ class CORE_EXPORT UnderlyingSinkBase : public ScriptWrappable { ...@@ -50,6 +50,11 @@ class CORE_EXPORT UnderlyingSinkBase : public ScriptWrappable {
ScriptWrappable::Trace(visitor); ScriptWrappable::Trace(visitor);
} }
protected:
WritableStreamDefaultControllerInterface* Controller() const {
return controller_;
}
private: private:
Member<WritableStreamDefaultControllerInterface> controller_; Member<WritableStreamDefaultControllerInterface> controller_;
}; };
......
...@@ -33,7 +33,7 @@ class CORE_EXPORT WritableStreamDefaultControllerInterface ...@@ -33,7 +33,7 @@ class CORE_EXPORT WritableStreamDefaultControllerInterface
// Helper method // Helper method
template <typename ErrorType> template <typename ErrorType>
void Error(ScriptState* script_state, ErrorType error) { void Error(ScriptState* script_state, ErrorType error) {
Error(script_state, ToV8(error, script_state).ToV8Value()); Error(script_state, ToV8(error, script_state));
} }
virtual void Trace(Visitor*) {} virtual void Trace(Visitor*) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment