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

Unified Diff: Source/devtools/front_end/sdk/InspectorBackend.js

Issue 660523002: DevTools: add support for chunked protocol messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | « Source/devtools/front_end/host/InspectorFrontendHost.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/InspectorBackend.js
diff --git a/Source/devtools/front_end/sdk/InspectorBackend.js b/Source/devtools/front_end/sdk/InspectorBackend.js
index 863bf40be30db6db9ee6d88fcbbbe5aa956f5ae4..9264539ac121a81a093302b26d302cb2cb406b6a 100644
--- a/Source/devtools/front_end/sdk/InspectorBackend.js
+++ b/Source/devtools/front_end/sdk/InspectorBackend.js
@@ -611,6 +611,7 @@ InspectorBackendClass.MainConnection = function()
{
InspectorBackendClass.Connection.call(this);
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DispatchMessage, this._dispatchMessage, this);
+ InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DispatchMessageChunk, this._dispatchMessageChunk, this);
}
InspectorBackendClass.MainConnection.prototype = {
@@ -629,7 +630,26 @@ InspectorBackendClass.MainConnection.prototype = {
*/
_dispatchMessage: function(event)
{
- this.dispatch(/** @type {!Object|string} */ (event.data));
+ this.dispatch(/** @type {string} */ (event.data));
dgozman 2014/10/15 13:51:38 event.data could actually be an object (at least i
pfeldman 2014/10/15 14:06:59 Which layout tests?
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _dispatchMessageChunk: function(event)
+ {
+ var messageChunk = /** @type {string} */ (event.data["messageChunk"]);
+ var messageSize = /** @type {number} */ (event.data["messageSize"]);
alph 2014/10/15 13:44:58 Why do you need size? lastChunk boolean should be
pfeldman 2014/10/15 14:06:59 I'm doing it for consistency with the backend. Als
+ if (messageSize) {
+ this._messageBuffer = "";
+ this._messageSize = messageSize;
+ }
+ this._messageBuffer += messageChunk;
+ if (this._messageBuffer.length === this._messageSize) {
+ this.dispatch(this._messageBuffer);
dgozman 2014/10/15 13:51:38 It's safer to clear |this._messageBuffer| and |thi
pfeldman 2014/10/15 14:06:59 This is an async IPC call, we should not re-enter.
+ this._messageBuffer = "";
+ this._messageSize = 0;
+ }
},
__proto__: InspectorBackendClass.Connection.prototype
« no previous file with comments | « Source/devtools/front_end/host/InspectorFrontendHost.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698