Re: [whatwg/streams] Factor out condition to check pending operation (#672)

ricea commented on this pull request.



>  
     // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer
     // has been detached.
-    this._pendingCloseRequest = undefined;
+    this._closeRequest = undefined;
+
+    // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it
+    // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.
+    this._inFlightCloseRequest = undefined;

> I guess I should try this after landing the patch.

+1 for getting this landed before changing anything else.

I think in practice all browser implementations are going to pack the internal slots somewhat. Chrome does, and if I understand correctly Firefox goes further and defines the object layout using native code. I think that the key things for the standard are finding the representation of the state that is easiest to understand and reason about, and explicitly mentioning things like "only one of [[closeRequest]] and [[inFlightWriteRequest]] is used at a time" to help other implementations optimise.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/672#discussion_r104858805

Received on Wednesday, 8 March 2017 07:31:30 UTC