RESOLVED FIXED Bug 78557
[WebSocket] Add extension attribute support
https://bugs.webkit.org/show_bug.cgi?id=78557
Summary [WebSocket] Add extension attribute support
Kenichi Ishibashi
Reported 2012-02-13 17:43:25 PST
Add extension attribute support.
Attachments
Patch (17.91 KB, patch)
2012-02-13 18:07 PST, Kenichi Ishibashi
no flags
Patch (17.93 KB, patch)
2012-02-14 01:47 PST, Kenichi Ishibashi
no flags
Patch (21.51 KB, patch)
2012-02-14 02:49 PST, Kenichi Ishibashi
no flags
Patch (21.59 KB, patch)
2012-02-14 04:10 PST, Kenichi Ishibashi
no flags
Patch (21.59 KB, patch)
2012-02-14 16:53 PST, Kenichi Ishibashi
no flags
Kenichi Ishibashi
Comment 1 2012-02-13 18:07:24 PST
Yuta Kitamura
Comment 2 2012-02-13 23:49:18 PST
Comment on attachment 126880 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126880&action=review Generally looks fine except for one comment. [Note: I don't have r+ privilege] > Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:228 > + if (!acceptedExtensions.contains(extensionToken)) This code requires O(N^2)-time for N extension items, right? O(N^2) algorithm is not acceptable.
Kenichi Ishibashi
Comment 3 2012-02-14 01:47:22 PST
Kenichi Ishibashi
Comment 4 2012-02-14 01:47:56 PST
Comment on attachment 126880 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126880&action=review >> Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:228 >> + if (!acceptedExtensions.contains(extensionToken)) > > This code requires O(N^2)-time for N extension items, right? O(N^2) algorithm is not acceptable. Used Vector<bool> as flags to determine whether the extensionToken should be appended.
Kenichi Ishibashi
Comment 5 2012-02-14 01:49:18 PST
Kent-san, Alexey, Could you review the patch?
Kenichi Ishibashi
Comment 6 2012-02-14 02:08:23 PST
Comment on attachment 126937 [details] Patch Talked with Yuta-san in person. I'll change the behavior.
Kenichi Ishibashi
Comment 7 2012-02-14 02:49:33 PST
WebKit Review Bot
Comment 8 2012-02-14 02:52:45 PST
Attachment 126946 [details] did not pass style-queue: Failed to run "['Tools/Scripts/update-webkit']" exit_code: 9 Updating OpenSource First, rewinding head to replay your work on top of it... Applying: [Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets Using index info to reconstruct a base tree... <stdin>:1578: trailing whitespace. <stdin>:1647: trailing whitespace. <stdin>:1657: trailing whitespace. <stdin>:1672: trailing whitespace. return 0; <stdin>:1674: trailing whitespace. warning: squelched 7 whitespace errors warning: 12 lines add whitespace errors. Falling back to patching base and 3-way merge... warning: too many files (created: 168766 deleted: 3), skipping inexact rename detection Auto-merging LayoutTests/ChangeLog CONFLICT (content): Merge conflict in LayoutTests/ChangeLog Auto-merging Source/WebCore/ChangeLog CONFLICT (content): Merge conflict in Source/WebCore/ChangeLog Auto-merging Tools/ChangeLog CONFLICT (content): Merge conflict in Tools/ChangeLog Failed to merge in the changes. Patch failed at 0001 [Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". rebase refs/remotes/origin/master: command returned error: 1 Died at Tools/Scripts/update-webkit line 164. If any of these errors are false positives, please file a bug against check-webkit-style.
Yuta Kitamura
Comment 9 2012-02-14 03:56:07 PST
Comment on attachment 126946 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126946&action=review Looks OK. [Note: I don't have r+ privilege yet.] > Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:181 > + for (HashMap<String, String>::const_iterator iterator = extensionParameters.begin(); iterator != extensionParameters.end(); ++iterator) { Please add a FIXME comment which indicates there's a possibility of changing the order of parameters due to HashMap. (As we told off-line, I assume you are going to fix this as a separate issue.)
Kenichi Ishibashi
Comment 10 2012-02-14 04:10:28 PST
Kenichi Ishibashi
Comment 11 2012-02-14 04:10:57 PST
Comment on attachment 126946 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126946&action=review >> Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:181 >> + for (HashMap<String, String>::const_iterator iterator = extensionParameters.begin(); iterator != extensionParameters.end(); ++iterator) { > > Please add a FIXME comment which indicates there's a possibility of changing the order of parameters due to HashMap. (As we told off-line, I assume you are going to fix this as a separate issue.) Done.
WebKit Review Bot
Comment 12 2012-02-14 04:13:28 PST
Attachment 126954 [details] did not pass style-queue: Failed to run "['Tools/Scripts/update-webkit']" exit_code: 9 Updating OpenSource First, rewinding head to replay your work on top of it... Applying: [Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets Using index info to reconstruct a base tree... <stdin>:1578: trailing whitespace. <stdin>:1647: trailing whitespace. <stdin>:1657: trailing whitespace. <stdin>:1672: trailing whitespace. return 0; <stdin>:1674: trailing whitespace. warning: squelched 7 whitespace errors warning: 12 lines add whitespace errors. Falling back to patching base and 3-way merge... warning: too many files (created: 168768 deleted: 3), skipping inexact rename detection Auto-merging LayoutTests/ChangeLog CONFLICT (content): Merge conflict in LayoutTests/ChangeLog Auto-merging Source/WebCore/ChangeLog Auto-merging Tools/ChangeLog CONFLICT (content): Merge conflict in Tools/ChangeLog Failed to merge in the changes. Patch failed at 0001 [Mac][Win][WK2] Switch to RFC 6455 protocol for WebSockets When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". rebase refs/remotes/origin/master: command returned error: 1 Died at Tools/Scripts/update-webkit line 164. If any of these errors are false positives, please file a bug against check-webkit-style.
Kent Tamura
Comment 13 2012-02-14 16:05:35 PST
Comment on attachment 126954 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126954&action=review > Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:268 > + return m_acceptedExtensionsBuilder.toAtomicString().string(); Why toAtomicString().string() instead of toString()?
Kenichi Ishibashi
Comment 14 2012-02-14 16:16:43 PST
(In reply to comment #13) > (From update of attachment 126954 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=126954&action=review > > > Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:268 > > + return m_acceptedExtensionsBuilder.toAtomicString().string(); > > Why toAtomicString().string() instead of toString()? StringBuilder::toString() isn't a const member function so I can't call it in acceptedExtensions(), which is a const member function. Looks like win EWS is red and I can't call toAtomicString() here so I'll make m_acceptedExtensionsBuilder mutable.
Kent Tamura
Comment 15 2012-02-14 16:24:33 PST
Comment on attachment 126954 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126954&action=review >>> Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:268 >>> + return m_acceptedExtensionsBuilder.toAtomicString().string(); >> >> Why toAtomicString().string() instead of toString()? > > StringBuilder::toString() isn't a const member function so I can't call it in acceptedExtensions(), which is a const member function. Looks like win EWS is red and I can't call toAtomicString() here so I'll make m_acceptedExtensionsBuilder mutable. Ah, I see. StringBuilder::toString() is not const. How about StringBuilder::toStringPreserveCapacity()?
Kenichi Ishibashi
Comment 16 2012-02-14 16:53:39 PST
Kenichi Ishibashi
Comment 17 2012-02-14 16:54:20 PST
Comment on attachment 126954 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=126954&action=review >>>> Source/WebCore/websockets/WebSocketExtensionDispatcher.cpp:268 >>>> + return m_acceptedExtensionsBuilder.toAtomicString().string(); >>> >>> Why toAtomicString().string() instead of toString()? >> >> StringBuilder::toString() isn't a const member function so I can't call it in acceptedExtensions(), which is a const member function. Looks like win EWS is red and I can't call toAtomicString() here so I'll make m_acceptedExtensionsBuilder mutable. > > Ah, I see. StringBuilder::toString() is not const. > How about StringBuilder::toStringPreserveCapacity()? It works. Thank you!
Kent Tamura
Comment 18 2012-02-14 17:26:56 PST
Comment on attachment 127081 [details] Patch ok
Kenichi Ishibashi
Comment 19 2012-02-14 17:32:48 PST
Comment on attachment 127081 [details] Patch Thanks!
WebKit Review Bot
Comment 20 2012-02-14 18:12:03 PST
Comment on attachment 127081 [details] Patch Clearing flags on attachment: 127081 Committed r107769: <http://trac.webkit.org/changeset/107769>
WebKit Review Bot
Comment 21 2012-02-14 18:12:09 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.