Commit 4e21d6a7 authored by caseq@chromium.org's avatar caseq@chromium.org

Add support for returning traces as streams in DevTools protocol

Related chromium-side change: https://codereview.chromium.org/1307073002

BUG=456845

Review URL: https://codereview.chromium.org/1307863003

git-svn-id: svn://svn.chromium.org/blink/trunk@201322 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0fa0f1ee
......@@ -114,7 +114,7 @@ class Capitalizer:
str = possible_abbreviation.lower() + str[pos:]
return str
ABBREVIATION = frozenset(["XHR", "DOM", "CSS"])
ABBREVIATION = frozenset(["XHR", "DOM", "CSS", "IO"])
VALIDATOR_IFDEF_NAME = "ENABLE(ASSERT)"
......
......@@ -47,7 +47,7 @@ void InspectorTracingAgent::restore()
emitMetadataEvents();
}
void InspectorTracingAgent::start(ErrorString*, const String* categoryFilter, const String*, const double*, PassRefPtrWillBeRawPtr<StartCallback> callback)
void InspectorTracingAgent::start(ErrorString*, const String* categoryFilter, const String*, const double*, const String*, PassRefPtrWillBeRawPtr<StartCallback> callback)
{
ASSERT(m_state->getString(TracingAgentState::sessionId).isEmpty());
m_state->setString(TracingAgentState::sessionId, IdentifiersFactory::createIdentifier());
......
......@@ -43,8 +43,8 @@ public:
void disable(ErrorString*) override;
// Protocol method implementations.
void start(ErrorString*, const String* categoryFilter, const String*, const double*, PassRefPtrWillBeRawPtr<StartCallback>) override;
virtual void end(ErrorString*, PassRefPtrWillBeRawPtr<EndCallback>);
void start(ErrorString*, const String* categoryFilter, const String*, const double*, const String*, PassRefPtrWillBeRawPtr<StartCallback>) override;
void end(ErrorString*, PassRefPtrWillBeRawPtr<EndCallback>) override;
// Methods for other agents to use.
void setLayerTreeId(int);
......
......@@ -58,6 +58,11 @@ WebInspector.TracingManager = function(target)
*/
WebInspector.TracingManager.EventPayload;
WebInspector.TracingManager.TransferMode = {
ReportEvents: "ReportEvents",
ReturnAsStream: "ReturnAsStream"
};
WebInspector.TracingManager.prototype = {
/**
* @return {?WebInspector.Target}
......@@ -112,7 +117,7 @@ WebInspector.TracingManager.prototype = {
throw new Error("Tracing is already started");
var bufferUsageReportingIntervalMs = 500;
this._activeClient = client;
this._target.tracingAgent().start(categoryFilter, options, bufferUsageReportingIntervalMs, callback);
this._target.tracingAgent().start(categoryFilter, options, bufferUsageReportingIntervalMs, WebInspector.TracingManager.TransferMode.ReportEvents, callback);
this._activeClient.tracingStarted();
},
......
......@@ -3254,6 +3254,42 @@
}
]
},
{
"domain": "IO",
"description": "Input/Output operations for streams produced by DevTools.",
"hidden": true,
"types": [
{
"id": "StreamHandle",
"type": "string"
}
],
"commands": [
{
"name": "read",
"description": "Read a chunk of the stream",
"async": true,
"parameters": [
{ "name": "handle", "$ref": "StreamHandle", "description": "Handle of the stream to read." },
{ "name": "offset", "type": "integer", "optional": true, "description": "Seek to the specified offset before reading (if not specificed, proceed with offset following the last read)." },
{ "name": "size", "type": "integer", "optional": true, "description": "Maximum number of bytes to read (left upon the agent discretion if not specified)." }
],
"returns": [
{ "name": "data", "type": "string", "description": "Data that were read." },
{ "name": "eof", "type": "boolean", "description": "Set if the end-of-file condition occured while reading." }
],
"handlers": ["browser"]
},
{
"name": "close",
"description": "Close the stream, discard any temporary backing storage.",
"parameters": [
{ "name": "handle", "$ref": "StreamHandle", "description": "Handle of the stream to close." }
],
"handlers": ["browser"]
}
]
},
{
"domain": "Timeline",
"description": "Timeline domain is deprecated. Please use Tracing instead.",
......@@ -4826,7 +4862,8 @@
"parameters": [
{ "name": "categories", "type": "string", "optional": true, "description": "Category/tag filter" },
{ "name": "options", "type": "string", "optional": true, "description": "Tracing options" },
{ "name": "bufferUsageReportingInterval", "type": "number", "optional": true, "description": "If set, the agent will issue bufferUsage events at this interval, specified in milliseconds" }
{ "name": "bufferUsageReportingInterval", "type": "number", "optional": true, "description": "If set, the agent will issue bufferUsage events at this interval, specified in milliseconds" },
{ "name": "transferMode", "type": "string", "enum": ["ReportEvents", "ReturnAsStream"], "optional": true, "description": "Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to <code>ReportEvents</code>)." }
],
"handlers": ["browser", "renderer"]
},
......@@ -4868,6 +4905,9 @@
{
"name": "tracingComplete",
"description": "Signals that tracing is stopped and there is no trace buffers pending flush, all data were delivered via dataCollected events.",
"parameters": [
{ "name": "stream", "$ref": "IO.StreamHandle", "optional": true, "description": "A handle of the stream that holds resulting trace data." }
],
"handlers": ["browser"]
},
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment