Commit d3117248 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Get rid of frame_->GetDocument() == this check in Document::Loader

Change-Id: I511771cfc43fca4d12b2f8e9b1239708d8fc8a76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211939
Commit-Queue: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773289}
parent 4d900c98
......@@ -7602,15 +7602,7 @@ void Document::CancelIdleCallback(int id) {
}
DocumentLoader* Document::Loader() const {
if (!GetFrame())
return nullptr;
// TODO(dcheng): remove this check. GetFrame() is guaranteed to be non-null
// only if GetFrame()->GetDocument() == this.
if (GetFrame()->GetDocument() != this)
return nullptr;
return GetFrame()->Loader().GetDocumentLoader();
return GetFrame() ? GetFrame()->Loader().GetDocumentLoader() : nullptr;
}
Node* EventTargetNodeForDocument(Document* doc) {
......
......@@ -141,21 +141,13 @@ AtomicString SameOriginAttribution(Frame* observer_frame,
} // namespace
static base::TimeTicks ToTimeOrigin(LocalDOMWindow* window) {
Document* document = window->document();
if (!document)
return base::TimeTicks();
DocumentLoader* loader = document->Loader();
if (!loader)
return base::TimeTicks();
DocumentLoader* loader = window->GetFrame()->Loader().GetDocumentLoader();
return loader->GetTiming().ReferenceMonotonicTime();
}
WindowPerformance::WindowPerformance(LocalDOMWindow* window)
: Performance(
ToTimeOrigin(window),
window->document()->GetTaskRunner(TaskType::kPerformanceTimeline)),
: Performance(ToTimeOrigin(window),
window->GetTaskRunner(TaskType::kPerformanceTimeline)),
ExecutionContextClient(window) {
DCHECK(GetFrame());
DCHECK(GetFrame()->GetPerformanceMonitor());
......
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