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

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

Issue 2706643002: DevTools: Move network request instrumentation points for timeline down the stack. (Closed)
Patch Set: . Created 3 years, 10 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 b2db6fe39c8431571c9c5412f21d3494fe957d10..fc0ce672bd33649bc64896e1cf1e99b594925235 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -497,10 +497,8 @@ std::unique_ptr<TracedValue> InspectorScrollInvalidationTrackingEvent::data(
std::unique_ptr<TracedValue> InspectorChangeResourcePriorityEvent::data(
unsigned long identifier,
const ResourceLoadPriority& loadPriority) {
- String requestId = IdentifiersFactory::requestId(identifier);
-
std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
+ value->setString("requestId", String::number(identifier));
value->setString("priority", resourcePriorityString(loadPriority));
return value;
}
@@ -509,10 +507,8 @@ std::unique_ptr<TracedValue> InspectorSendRequestEvent::data(
unsigned long identifier,
LocalFrame* frame,
const ResourceRequest& request) {
- String requestId = IdentifiersFactory::requestId(identifier);
-
std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
+ value->setString("requestId", String::number(identifier));
value->setString("frame", toHexString(frame));
value->setString("url", request.url().getString());
value->setString("requestMethod", request.httpMethod());
@@ -523,91 +519,6 @@ std::unique_ptr<TracedValue> InspectorSendRequestEvent::data(
return value;
}
-namespace {
-void recordTiming(const ResourceLoadTiming& timing, TracedValue* value) {
- value->setDouble("requestTime", timing.requestTime());
- value->setDouble("proxyStart",
- timing.calculateMillisecondDelta(timing.proxyStart()));
- value->setDouble("proxyEnd",
- timing.calculateMillisecondDelta(timing.proxyEnd()));
- value->setDouble("dnsStart",
- timing.calculateMillisecondDelta(timing.dnsStart()));
- value->setDouble("dnsEnd", timing.calculateMillisecondDelta(timing.dnsEnd()));
- value->setDouble("connectStart",
- timing.calculateMillisecondDelta(timing.connectStart()));
- value->setDouble("connectEnd",
- timing.calculateMillisecondDelta(timing.connectEnd()));
- value->setDouble("sslStart",
- timing.calculateMillisecondDelta(timing.sslStart()));
- value->setDouble("sslEnd", timing.calculateMillisecondDelta(timing.sslEnd()));
- value->setDouble("workerStart",
- timing.calculateMillisecondDelta(timing.workerStart()));
- value->setDouble("workerReady",
- timing.calculateMillisecondDelta(timing.workerReady()));
- value->setDouble("sendStart",
- timing.calculateMillisecondDelta(timing.sendStart()));
- value->setDouble("sendEnd",
- timing.calculateMillisecondDelta(timing.sendEnd()));
- value->setDouble("receiveHeadersEnd", timing.calculateMillisecondDelta(
- timing.receiveHeadersEnd()));
- value->setDouble("pushStart", timing.pushStart());
- value->setDouble("pushEnd", timing.pushEnd());
-}
-} // namespace
-
-std::unique_ptr<TracedValue> InspectorReceiveResponseEvent::data(
- unsigned long identifier,
- LocalFrame* frame,
- const ResourceResponse& response) {
- String requestId = IdentifiersFactory::requestId(identifier);
-
- std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
- value->setString("frame", toHexString(frame));
- value->setInteger("statusCode", response.httpStatusCode());
- value->setString("mimeType", response.mimeType().getString().isolatedCopy());
- value->setDouble("encodedDataLength", response.encodedDataLength());
- value->setBoolean("fromCache", response.wasCached());
- value->setBoolean("fromServiceWorker", response.wasFetchedViaServiceWorker());
- if (response.resourceLoadTiming()) {
- value->beginDictionary("timing");
- recordTiming(*response.resourceLoadTiming(), value.get());
- value->endDictionary();
- }
- if (response.wasFetchedViaServiceWorker())
- value->setBoolean("fromServiceWorker", true);
- return value;
-}
-
-std::unique_ptr<TracedValue> InspectorReceiveDataEvent::data(
- unsigned long identifier,
- LocalFrame* frame,
- int encodedDataLength) {
- String requestId = IdentifiersFactory::requestId(identifier);
-
- std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
- value->setString("frame", toHexString(frame));
- value->setInteger("encodedDataLength", encodedDataLength);
- return value;
-}
-
-std::unique_ptr<TracedValue> InspectorResourceFinishEvent::data(
- unsigned long identifier,
- double finishTime,
- bool didFail,
- int64_t encodedDataLength) {
- String requestId = IdentifiersFactory::requestId(identifier);
-
- std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
- value->setBoolean("didFail", didFail);
- value->setDouble("encodedDataLength", encodedDataLength);
- if (finishTime)
- value->setDouble("finishTime", finishTime);
- return value;
-}
-
static LocalFrame* frameForExecutionContext(ExecutionContext* context) {
LocalFrame* frame = nullptr;
if (context->isDocument())
@@ -876,9 +787,8 @@ std::unique_ptr<TracedValue> InspectorEvaluateScriptEvent::data(
std::unique_ptr<TracedValue> InspectorParseScriptEvent::data(
unsigned long identifier,
const String& url) {
- String requestId = IdentifiersFactory::requestId(identifier);
std::unique_ptr<TracedValue> value = TracedValue::create();
- value->setString("requestId", requestId);
+ value->setString("requestId", String::number(identifier));
value->setString("url", url);
return value;
}

Powered by Google App Engine
This is Rietveld 408576698