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 |