Commit e0f8cd94 authored by Emily Hanley's avatar Emily Hanley Committed by Commit Bot

Adding navigation id to trace of navigationStart and firstContentfulPaint

I have confirmed with the test case in https://github.com/catapult-project/catapult/issues/4490
that the navigation id in document loader is the correct id.  Adding an id to the
document itself is not the same between navigation and fcp.

Bug: 850258,catapult:4490
Change-Id: I4028bcb13d90a5a1a765890fe02e346d496fab7a
Reviewed-on: https://chromium-review.googlesource.com/1249533
Commit-Queue: Emily Hanley <eyaich@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595842}
parent 2d7072f9
......@@ -72,6 +72,13 @@ std::unique_ptr<TracedValue> InspectorParseHtmlEndData(unsigned end_line) {
return value;
}
std::unique_ptr<TracedValue> GetNavigationTracingData(Document* document) {
std::unique_ptr<TracedValue> data = TracedValue::Create();
data->SetString("navigationId",
IdentifiersFactory::LoaderId(document->Loader()));
return data;
}
} // namespace
String ToHexString(const void* p) {
......@@ -204,9 +211,10 @@ void InspectorTraceEvents::Did(const probe::CallFunction& probe) {
void InspectorTraceEvents::PaintTiming(Document* document,
const char* name,
double timestamp) {
TRACE_EVENT_MARK_WITH_TIMESTAMP1("loading,rail,devtools.timeline", name,
TRACE_EVENT_MARK_WITH_TIMESTAMP2("loading,rail,devtools.timeline", name,
TraceEvent::ToTraceTimestamp(timestamp),
"frame", ToTraceValue(document->GetFrame()));
"frame", ToTraceValue(document->GetFrame()),
"data", GetNavigationTracingData(document));
}
void InspectorTraceEvents::FrameStartedLoading(LocalFrame* frame) {
......
......@@ -27,6 +27,7 @@
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
......@@ -99,6 +100,8 @@ std::unique_ptr<TracedValue> DocumentLoadTiming::GetNavigationStartTracingData()
document_loader_ ? document_loader_->Url().GetString() : "");
data->SetBoolean("isLoadingMainFrame",
GetFrame() ? GetFrame()->IsMainFrame() : false);
data->SetString("navigationId",
IdentifiersFactory::LoaderId(document_loader_));
return data;
}
......
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