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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2472583003: Navigation Timing Level 2 (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "core/inspector/InspectorTraceEvents.h" 69 #include "core/inspector/InspectorTraceEvents.h"
70 #include "core/loader/DocumentLoader.h" 70 #include "core/loader/DocumentLoader.h"
71 #include "core/loader/FrameLoaderClient.h" 71 #include "core/loader/FrameLoaderClient.h"
72 #include "core/loader/SinkDocument.h" 72 #include "core/loader/SinkDocument.h"
73 #include "core/loader/appcache/ApplicationCache.h" 73 #include "core/loader/appcache/ApplicationCache.h"
74 #include "core/page/ChromeClient.h" 74 #include "core/page/ChromeClient.h"
75 #include "core/page/CreateWindow.h" 75 #include "core/page/CreateWindow.h"
76 #include "core/page/Page.h" 76 #include "core/page/Page.h"
77 #include "core/page/WindowFeatures.h" 77 #include "core/page/WindowFeatures.h"
78 #include "core/page/scrolling/ScrollingCoordinator.h" 78 #include "core/page/scrolling/ScrollingCoordinator.h"
79 #include "core/timing/DOMWindowPerformance.h"
80 #include "core/timing/Performance.h"
79 #include "platform/EventDispatchForbiddenScope.h" 81 #include "platform/EventDispatchForbiddenScope.h"
80 #include "platform/weborigin/SecurityOrigin.h" 82 #include "platform/weborigin/SecurityOrigin.h"
81 #include "platform/weborigin/Suborigin.h" 83 #include "platform/weborigin/Suborigin.h"
82 #include "public/platform/Platform.h" 84 #include "public/platform/Platform.h"
83 #include "public/platform/WebFrameScheduler.h" 85 #include "public/platform/WebFrameScheduler.h"
84 #include "public/platform/WebScreenInfo.h" 86 #include "public/platform/WebScreenInfo.h"
85 #include <memory> 87 #include <memory>
86 88
87 namespace blink { 89 namespace blink {
88 90
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // If fetcher->countPreloads() is not empty here, it's full of link 1397 // If fetcher->countPreloads() is not empty here, it's full of link
1396 // preloads, as speculatove preloads were cleared at DCL. 1398 // preloads, as speculatove preloads were cleared at DCL.
1397 if (frame() && documentLoader == frame()->loader().documentLoader() && 1399 if (frame() && documentLoader == frame()->loader().documentLoader() &&
1398 documentLoader->fetcher()->countPreloads()) 1400 documentLoader->fetcher()->countPreloads())
1399 m_unusedPreloadsTimer.startOneShot(unusedPreloadTimeoutInSeconds, 1401 m_unusedPreloadsTimer.startOneShot(unusedPreloadTimeoutInSeconds,
1400 BLINK_FROM_HERE); 1402 BLINK_FROM_HERE);
1401 } else { 1403 } else {
1402 dispatchEvent(loadEvent, document()); 1404 dispatchEvent(loadEvent, document());
1403 } 1405 }
1404 1406
1407 Performance* performance = DOMWindowPerformance::performance(*this);
panicker 2016/11/14 17:38:52 these 2 lines can go inside the if () below..
sunjian 2016/11/14 22:12:28 Done.
1408 DCHECK(performance);
1409 if (frame())
1410 performance->addNavigationTiming(frame());
1411
1405 // For load events, send a separate load event to the enclosing frame only. 1412 // For load events, send a separate load event to the enclosing frame only.
1406 // This is a DOM extension and is independent of bubbling/capturing rules of 1413 // This is a DOM extension and is independent of bubbling/capturing rules of
1407 // the DOM. 1414 // the DOM.
1408 FrameOwner* owner = frame() ? frame()->owner() : nullptr; 1415 FrameOwner* owner = frame() ? frame()->owner() : nullptr;
1409 if (owner) 1416 if (owner)
1410 owner->dispatchLoad(); 1417 owner->dispatchLoad();
1411 1418
1412 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad", 1419 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad",
1413 TRACE_EVENT_SCOPE_THREAD, "data", 1420 TRACE_EVENT_SCOPE_THREAD, "data",
1414 InspectorMarkLoadEvent::data(frame())); 1421 InspectorMarkLoadEvent::data(frame()));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 1559
1553 LocalFrame* LocalDOMWindow::frame() const { 1560 LocalFrame* LocalDOMWindow::frame() const {
1554 // If the LocalDOMWindow still has a frame reference, that frame must point 1561 // If the LocalDOMWindow still has a frame reference, that frame must point
1555 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1562 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1556 // where script execution leaks between different LocalDOMWindows. 1563 // where script execution leaks between different LocalDOMWindows.
1557 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); 1564 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this);
1558 return m_frame; 1565 return m_frame;
1559 } 1566 }
1560 1567
1561 } // namespace blink 1568 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698