Bug 160242 - [Streams API] Replace ReadableStreamController by ReadableStreamDefaultController
Summary: [Streams API] Replace ReadableStreamController by ReadableStreamDefaultContro...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Romain Bellessort
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-27 06:43 PDT by Romain Bellessort
Modified: 2016-07-28 08:44 PDT (History)
3 users (show)

See Also:


Attachments
Patch (77.57 KB, patch)
2016-07-27 07:12 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff
Patch (77.42 KB, patch)
2016-07-28 07:03 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Bellessort 2016-07-27 06:43:41 PDT
As was done for ReadableStreamReader/ReadableStreamDefaultReader, ReadableStreamController should be replaced by ReadableStreamDefaultController to align with Streams API spec.
Comment 1 Romain Bellessort 2016-07-27 07:12:44 PDT
Created attachment 284693 [details]
Patch
Comment 2 WebKit Commit Bot 2016-07-27 07:14:22 PDT
Attachment 284693 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/js/ReadableStreamDefaultController.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 24 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 youenn fablet 2016-07-28 06:21:52 PDT
Comment on attachment 284693 [details]
Patch

r=me.
It might be good to improve the controller code.
See below for all possible improvements.
This can be done now or in a later patch.
Wdyt romain?

View in context: https://bugs.webkit.org/attachment.cgi?id=284693&action=review

> Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp:36
> +#include "JSReadableStreamSource.h"

These two includes may no longer be needed

> Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp:77
> +    auto isLocked = globalObject()->builtinInternalFunctions().readableStreamInternals().m_isReadableStreamLockedFunction.get();

Can we add an ASSERT(isLocked.isFunction())?

> Source/WebCore/bindings/js/ReadableStreamDefaultController.h:55
> +    void close() { invoke(*globalObject()->globalExec(), *m_jsController, "close", JSC::jsUndefined()); }

Can we add a jsConstroller() method helper that would do 
ASSERT(m_jsController);
Return m_jsController;

> Source/WebCore/bindings/js/ReadableStreamDefaultController.h:63
> +    JSDOMGlobalObject* globalObject() const;

Might be better to return a reference than a pointer.

> Source/WebCore/bindings/js/ReadableStreamDefaultController.h:72
> +    return static_cast<JSDOMGlobalObject*>(m_jsController->globalObject());

Might be better to add an ASSERT and return a JSDOMGlobalObject&

> Source/WebCore/bindings/js/ReadableStreamDefaultController.h:77
> +    JSC::ExecState& state = *globalObject()->globalExec();

Might be good to add an ASSERT(globalObject()->globalExec())

> Source/WebCore/bindings/js/ReadableStreamDefaultController.h:96
> +    JSC::JSLockHolder locker(state);

Ditto.

> Source/WebCore/bindings/js/WebCoreBuiltinNames.h:100
> +    macro(ReadableStreamDefaultController) \

Switch reader and controller lines?
Comment 4 Romain Bellessort 2016-07-28 07:03:20 PDT
Created attachment 284781 [details]
Patch
Comment 5 WebKit Commit Bot 2016-07-28 07:04:16 PDT
Attachment 284781 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/js/ReadableStreamDefaultController.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 24 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Romain Bellessort 2016-07-28 07:08:02 PDT
(In reply to comment #3)
> Comment on attachment 284693 [details]
> Patch
> 
> r=me.
> It might be good to improve the controller code.
> See below for all possible improvements.
> This can be done now or in a later patch.
> Wdyt romain?

For this patch I was focusing on the JS part. I just uploaded a new patch that fixes alphabetical order in WebCoreBuiltinNames.h, but I let other remarks aiming at improving ReadableStreamDefaultController.h/cpp for another patch. I'm going to create a bug about that.
Comment 7 WebKit Commit Bot 2016-07-28 08:44:56 PDT
Comment on attachment 284781 [details]
Patch

Clearing flags on attachment: 284781

Committed r203818: <http://trac.webkit.org/changeset/203818>
Comment 8 WebKit Commit Bot 2016-07-28 08:44:59 PDT
All reviewed patches have been landed.  Closing bug.