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

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

Issue 2472583003: Navigation Timing Level 2 (Closed)
Patch Set: First working version 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "core/inspector/InspectorInstrumentation.h" 67 #include "core/inspector/InspectorInstrumentation.h"
68 #include "core/loader/DocumentLoader.h" 68 #include "core/loader/DocumentLoader.h"
69 #include "core/loader/FrameLoaderClient.h" 69 #include "core/loader/FrameLoaderClient.h"
70 #include "core/loader/SinkDocument.h" 70 #include "core/loader/SinkDocument.h"
71 #include "core/loader/appcache/ApplicationCache.h" 71 #include "core/loader/appcache/ApplicationCache.h"
72 #include "core/page/ChromeClient.h" 72 #include "core/page/ChromeClient.h"
73 #include "core/page/CreateWindow.h" 73 #include "core/page/CreateWindow.h"
74 #include "core/page/Page.h" 74 #include "core/page/Page.h"
75 #include "core/page/WindowFeatures.h" 75 #include "core/page/WindowFeatures.h"
76 #include "core/page/scrolling/ScrollingCoordinator.h" 76 #include "core/page/scrolling/ScrollingCoordinator.h"
77 #include "core/timing/DOMWindowPerformance.h"
78 #include "core/timing/PerformanceBase.h"
77 #include "platform/EventDispatchForbiddenScope.h" 79 #include "platform/EventDispatchForbiddenScope.h"
78 #include "platform/weborigin/SecurityOrigin.h" 80 #include "platform/weborigin/SecurityOrigin.h"
79 #include "platform/weborigin/Suborigin.h" 81 #include "platform/weborigin/Suborigin.h"
80 #include "public/platform/Platform.h" 82 #include "public/platform/Platform.h"
81 #include "public/platform/WebFrameScheduler.h" 83 #include "public/platform/WebFrameScheduler.h"
82 #include "public/platform/WebScreenInfo.h" 84 #include "public/platform/WebScreenInfo.h"
83 #include <memory> 85 #include <memory>
84 86
85 namespace blink { 87 namespace blink {
86 88
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 DCHECK(documentLoader->fetcher()); 1393 DCHECK(documentLoader->fetcher());
1392 // If fetcher->countPreloads() is not empty here, it's full of link 1394 // If fetcher->countPreloads() is not empty here, it's full of link
1393 // preloads, as speculatove preloads were cleared at DCL. 1395 // preloads, as speculatove preloads were cleared at DCL.
1394 if (frame() && documentLoader == frame()->loader().documentLoader() && 1396 if (frame() && documentLoader == frame()->loader().documentLoader() &&
1395 documentLoader->fetcher()->countPreloads()) 1397 documentLoader->fetcher()->countPreloads())
1396 m_unusedPreloadsTimer.startOneShot(unusedPreloadTimeoutInSeconds, 1398 m_unusedPreloadsTimer.startOneShot(unusedPreloadTimeoutInSeconds,
1397 BLINK_FROM_HERE); 1399 BLINK_FROM_HERE);
1398 } else { 1400 } else {
1399 dispatchEvent(loadEvent, document()); 1401 dispatchEvent(loadEvent, document());
1400 } 1402 }
1403 // This is unfortunately that we have to cast in here
panicker 2016/11/02 20:12:37 You shouldn't need a cast here.
sunjian 2016/11/04 01:12:38 Done.
1404 // (TODO:sunjian) Find a better way of doing it
1405 // Also check nullptr
panicker 2016/11/02 20:12:37 Add DCHECK here: Performance* performance = DOMWin
sunjian 2016/11/04 01:12:38 Done.
1406 ((PerformanceBase*)(DOMWindowPerformance::performance(*this)))
1407 ->addNavigationTiming(frame());
1401 1408
1402 // For load events, send a separate load event to the enclosing frame only. 1409 // For load events, send a separate load event to the enclosing frame only.
1403 // This is a DOM extension and is independent of bubbling/capturing rules of 1410 // This is a DOM extension and is independent of bubbling/capturing rules of
1404 // the DOM. 1411 // the DOM.
1405 FrameOwner* owner = frame() ? frame()->owner() : nullptr; 1412 FrameOwner* owner = frame() ? frame()->owner() : nullptr;
1406 if (owner) 1413 if (owner)
1407 owner->dispatchLoad(); 1414 owner->dispatchLoad();
1408 1415
1409 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad", 1416 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad",
1410 TRACE_EVENT_SCOPE_THREAD, "data", 1417 TRACE_EVENT_SCOPE_THREAD, "data",
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1556
1550 LocalFrame* LocalDOMWindow::frame() const { 1557 LocalFrame* LocalDOMWindow::frame() const {
1551 // If the LocalDOMWindow still has a frame reference, that frame must point 1558 // If the LocalDOMWindow still has a frame reference, that frame must point
1552 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1559 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1553 // where script execution leaks between different LocalDOMWindows. 1560 // where script execution leaks between different LocalDOMWindows.
1554 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); 1561 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this);
1555 return m_frame; 1562 return m_frame;
1556 } 1563 }
1557 1564
1558 } // namespace blink 1565 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698