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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp

Issue 2729613008: [instrumentation] Introduce InspectorTraceEvents agent (Closed)
Patch Set: all done Created 3 years, 9 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
Index: third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
index 0bc944802575e667315ed993cb24b782d1ee8517..79d441d42da26f94383f52b9c86716a05ed98663 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -63,6 +63,73 @@ void setCallStack(TracedValue* value) {
v8::Isolate::GetCurrent()->GetCpuProfiler()->CollectSample();
}
+void InspectorTraceEvents::init(InstrumentingAgents* instrumentingAgents,
+ protocol::UberDispatcher*,
+ protocol::DictionaryValue*) {
+ m_instrumentingAgents = instrumentingAgents;
+ m_instrumentingAgents->addInspectorTraceEvents(this);
+}
+
+void InspectorTraceEvents::dispose() {
+ m_instrumentingAgents->removeInspectorTraceEvents(this);
+ m_instrumentingAgents = nullptr;
+}
+
+DEFINE_TRACE(InspectorTraceEvents) {
+ visitor->trace(m_instrumentingAgents);
+ InspectorAgent::trace(visitor);
+}
+
+void InspectorTraceEvents::willSendRequest(
+ LocalFrame* frame,
+ unsigned long identifier,
+ DocumentLoader*,
+ ResourceRequest& request,
+ const ResourceResponse& redirectResponse,
+ const FetchInitiatorInfo&) {
+ TRACE_EVENT_INSTANT1(
+ "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD,
+ "data", InspectorSendRequestEvent::data(identifier, frame, request));
+}
+
+void InspectorTraceEvents::didReceiveResourceResponse(
+ LocalFrame* frame,
+ unsigned long identifier,
+ DocumentLoader*,
+ const ResourceResponse& response,
+ Resource*) {
+ TRACE_EVENT_INSTANT1(
+ "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD,
+ "data", InspectorReceiveResponseEvent::data(identifier, frame, response));
+}
+
+void InspectorTraceEvents::didReceiveData(LocalFrame* frame,
+ unsigned long identifier,
+ const char* data,
+ int encodedDataLength) {
+ TRACE_EVENT_INSTANT1(
+ "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD,
+ "data",
+ InspectorReceiveDataEvent::data(identifier, frame, encodedDataLength));
+}
+
+void InspectorTraceEvents::didFinishLoading(unsigned long identifier,
+ double finishTime,
+ int64_t encodedDataLength,
+ int64_t decodedBodyLength) {
+ TRACE_EVENT_INSTANT1(
+ "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data",
+ InspectorResourceFinishEvent::data(identifier, finishTime, false,
+ encodedDataLength, decodedBodyLength));
+}
+
+void InspectorTraceEvents::didFailLoading(unsigned long identifier,
+ const ResourceError&) {
+ TRACE_EVENT_INSTANT1(
+ "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data",
+ InspectorResourceFinishEvent::data(identifier, 0, true, 0, 0));
+}
+
namespace {
void setNodeInfo(TracedValue* value,

Powered by Google App Engine
This is Rietveld 408576698