Changeset 139853 in webkit
- Timestamp:
- Jan 16, 2013, 1:50:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139852 r139853 1 2013-01-16 Ken Kania <kkania@chromium.org> 2 3 [Inspector] Add events for tracking page loads and scheduled navigations. 4 https://bugs.webkit.org/show_bug.cgi?id=104168 5 6 Reviewed by Pavel Feldman. 7 8 These events are needed for clients who need to be aware of when a page is 9 navigating or about to navigate. Some clients may wish to prevent interaction 10 with the page during this time. Two of the new events track loading start and 11 stop, as measured by the ProgressTracker. The other two events track when a 12 page has a new scheduled navigation and when it no longer has a scheduled 13 navigation. These latter two events won't allow the client to determine if 14 a load is going to happen in all circumstances, but is sufficient for many cases. 15 16 * inspector-protocol/page/frameScheduledNavigation-expected.txt: Added. 17 * inspector-protocol/page/frameScheduledNavigation.html: Added. 18 * inspector-protocol/page/frameStartedLoading-expected.txt: Added. 19 * inspector-protocol/page/frameStartedLoading.html: Added. 20 1 21 2013-01-16 Zan Dobersek <zdobersek@igalia.com> 2 22 -
trunk/Source/WebCore/ChangeLog
r139849 r139853 1 2013-01-16 Ken Kania <kkania@chromium.org> 2 3 [Inspector] Add events for tracking page loads and scheduled navigations. 4 https://bugs.webkit.org/show_bug.cgi?id=104168 5 6 Reviewed by Pavel Feldman. 7 8 These events are needed for clients who need to be aware of when a page is 9 navigating or about to navigate. Some clients may wish to prevent interaction 10 with the page during this time. Two of the new events track loading start and 11 stop, as measured by the ProgressTracker. The other two events track when a 12 page has a new scheduled navigation and when it no longer has a scheduled 13 navigation. These latter two events won't allow the client to determine if 14 a load is going to happen in all circumstances, but is sufficient for many cases. 15 16 Tests: inspector-protocol/page/frameScheduledNavigation.html 17 inspector-protocol/page/frameStartedLoading.html 18 19 * inspector/Inspector.json: 20 * inspector/InspectorInstrumentation.cpp: 21 (WebCore): 22 (WebCore::InspectorInstrumentation::frameStartedLoadingImpl): 23 (WebCore::InspectorInstrumentation::frameStoppedLoadingImpl): 24 (WebCore::InspectorInstrumentation::frameScheduledNavigationImpl): 25 (WebCore::InspectorInstrumentation::frameClearedScheduledNavigationImpl): 26 * inspector/InspectorInstrumentation.h: 27 (InspectorInstrumentation): 28 (WebCore::InspectorInstrumentation::frameStartedLoading): 29 (WebCore): 30 (WebCore::InspectorInstrumentation::frameStoppedLoading): 31 (WebCore::InspectorInstrumentation::frameScheduledNavigation): 32 (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): 33 * inspector/InspectorPageAgent.cpp: 34 (WebCore::InspectorPageAgent::frameStartedLoading): 35 (WebCore): 36 (WebCore::InspectorPageAgent::frameStoppedLoading): 37 (WebCore::InspectorPageAgent::frameScheduledNavigation): 38 (WebCore::InspectorPageAgent::frameClearedScheduledNavigation): 39 * inspector/InspectorPageAgent.h: 40 * inspector/front-end/ResourceTreeModel.js: 41 (WebInspector.PageDispatcher.prototype.frameDetached): 42 (WebInspector.PageDispatcher.prototype.frameStartedLoading): 43 (WebInspector.PageDispatcher.prototype.frameStoppedLoading): 44 (WebInspector.PageDispatcher.prototype.frameScheduledNavigation): 45 (WebInspector.PageDispatcher.prototype.frameClearedScheduledNavigation): 46 * loader/NavigationScheduler.cpp: 47 (WebCore::NavigationScheduler::clear): 48 (WebCore::NavigationScheduler::timerFired): 49 (WebCore::NavigationScheduler::startTimer): 50 (WebCore::NavigationScheduler::cancel): 51 * loader/ProgressTracker.cpp: 52 (WebCore::ProgressTracker::progressStarted): 53 (WebCore::ProgressTracker::finalProgressComplete): 54 1 55 2013-01-16 Tommy Widenflycht <tommyw@google.com> 2 56 -
trunk/Source/WebCore/inspector/Inspector.json
r139814 r139853 493 493 "parameters": [ 494 494 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has been detached." } 495 ], 496 "hidden": true 497 }, 498 { 499 "name": "frameStartedLoading", 500 "description": "Fired when frame has started loading.", 501 "parameters": [ 502 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has started loading." } 503 ], 504 "hidden": true 505 }, 506 { 507 "name": "frameStoppedLoading", 508 "description": "Fired when frame has stopped loading.", 509 "parameters": [ 510 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has stopped loading." } 511 ], 512 "hidden": true 513 }, 514 { 515 "name": "frameScheduledNavigation", 516 "description": "Fired when frame schedules a potential navigation.", 517 "parameters": [ 518 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has scheduled a navigation." }, 519 { "name": "delay", "type": "number", "description": "Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start." } 520 ], 521 "hidden": true 522 }, 523 { 524 "name": "frameClearedScheduledNavigation", 525 "description": "Fired when frame no longer has a scheduled navigation.", 526 "parameters": [ 527 { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has cleared its scheduled navigation." } 495 528 ], 496 529 "hidden": true -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r138497 r139853 928 928 } 929 929 930 void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame) 931 { 932 if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent()) 933 inspectorPageAgent->frameStartedLoading(frame); 934 } 935 936 void InspectorInstrumentation::frameStoppedLoadingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame) 937 { 938 if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent()) 939 inspectorPageAgent->frameStoppedLoading(frame); 940 } 941 942 void InspectorInstrumentation::frameScheduledNavigationImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, double delay) 943 { 944 if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent()) 945 inspectorPageAgent->frameScheduledNavigation(frame, delay); 946 } 947 948 void InspectorInstrumentation::frameClearedScheduledNavigationImpl(InstrumentingAgents* instrumentingAgents, Frame* frame) 949 { 950 if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent()) 951 inspectorPageAgent->frameClearedScheduledNavigation(frame); 952 } 953 930 954 void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource* cachedResource) 931 955 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r139132 r139853 192 192 static void didCommitLoad(Frame*, DocumentLoader*); 193 193 static void loaderDetachedFromFrame(Frame*, DocumentLoader*); 194 static void frameStartedLoading(Frame*); 195 static void frameStoppedLoading(Frame*); 196 static void frameScheduledNavigation(Frame*, double delay); 197 static void frameClearedScheduledNavigation(Frame*); 194 198 static void willDestroyCachedResource(CachedResource*); 195 199 … … 391 395 static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*); 392 396 static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*); 397 static void frameStartedLoadingImpl(InstrumentingAgents*, Frame*); 398 static void frameStoppedLoadingImpl(InstrumentingAgents*, Frame*); 399 static void frameScheduledNavigationImpl(InstrumentingAgents*, Frame*, double delay); 400 static void frameClearedScheduledNavigationImpl(InstrumentingAgents*, Frame*); 393 401 static void willDestroyCachedResourceImpl(CachedResource*); 394 402 … … 1652 1660 } 1653 1661 1662 inline void InspectorInstrumentation::frameStartedLoading(Frame* frame) 1663 { 1664 #if ENABLE(INSPECTOR) 1665 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) 1666 frameStartedLoadingImpl(instrumentingAgents, frame); 1667 #endif 1668 } 1669 1670 inline void InspectorInstrumentation::frameStoppedLoading(Frame* frame) 1671 { 1672 #if ENABLE(INSPECTOR) 1673 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) 1674 frameStoppedLoadingImpl(instrumentingAgents, frame); 1675 #endif 1676 } 1677 1678 inline void InspectorInstrumentation::frameScheduledNavigation(Frame* frame, double delay) 1679 { 1680 #if ENABLE(INSPECTOR) 1681 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) 1682 frameScheduledNavigationImpl(instrumentingAgents, frame, delay); 1683 #endif 1684 } 1685 1686 inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame* frame) 1687 { 1688 #if ENABLE(INSPECTOR) 1689 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) 1690 frameClearedScheduledNavigationImpl(instrumentingAgents, frame); 1691 #endif 1692 } 1693 1654 1694 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource) 1655 1695 { -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r139418 r139853 901 901 } 902 902 903 void InspectorPageAgent::frameStartedLoading(Frame* frame) 904 { 905 m_frontend->frameStartedLoading(frameId(frame)); 906 } 907 908 void InspectorPageAgent::frameStoppedLoading(Frame* frame) 909 { 910 m_frontend->frameStoppedLoading(frameId(frame)); 911 } 912 913 void InspectorPageAgent::frameScheduledNavigation(Frame* frame, double delay) 914 { 915 m_frontend->frameScheduledNavigation(frameId(frame), delay); 916 } 917 918 void InspectorPageAgent::frameClearedScheduledNavigation(Frame* frame) 919 { 920 m_frontend->frameClearedScheduledNavigation(frameId(frame)); 921 } 922 903 923 void InspectorPageAgent::applyScreenWidthOverride(long* width) 904 924 { -
trunk/Source/WebCore/inspector/InspectorPageAgent.h
r139418 r139853 139 139 void frameDetached(Frame*); 140 140 void loaderDetachedFromFrame(DocumentLoader*); 141 void frameStartedLoading(Frame*); 142 void frameStoppedLoading(Frame*); 143 void frameScheduledNavigation(Frame*, double delay); 144 void frameClearedScheduledNavigation(Frame*); 141 145 void applyScreenWidthOverride(long*); 142 146 void applyScreenHeightOverride(long*); -
trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js
r133463 r139853 597 597 { 598 598 this._resourceTreeModel._frameDetached(frameId); 599 }, 600 601 frameStartedLoading: function(frameId) { 602 }, 603 604 frameStoppedLoading: function(frameId) { 605 }, 606 607 frameScheduledNavigation: function(frameId, delay) { 608 }, 609 610 frameClearedScheduledNavigation: function(frameId) { 599 611 } 600 612 } -
trunk/Source/WebCore/loader/NavigationScheduler.cpp
r112184 r139853 46 46 #include "HTMLFrameOwnerElement.h" 47 47 #include "HistoryItem.h" 48 #include "InspectorInstrumentation.h" 48 49 #include "Page.h" 49 50 #include "UserGestureIndicator.h" … … 287 288 void NavigationScheduler::clear() 288 289 { 290 if (m_timer.isActive()) 291 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 289 292 m_timer.stop(); 290 293 m_redirect.clear(); … … 412 415 if (!m_frame->page()) 413 416 return; 414 if (m_frame->page()->defersLoading()) 415 return; 417 if (m_frame->page()->defersLoading()) { 418 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 419 return; 420 } 416 421 417 422 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); 418 423 redirect->fire(m_frame); 424 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 419 425 } 420 426 … … 459 465 m_timer.startOneShot(m_redirect->delay()); 460 466 m_redirect->didStartTimer(m_frame, &m_timer); 467 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->delay()); 461 468 } 462 469 463 470 void NavigationScheduler::cancel(bool newLoadInProgress) 464 471 { 472 if (m_timer.isActive()) 473 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 465 474 m_timer.stop(); 466 475 -
trunk/Source/WebCore/loader/ProgressTracker.cpp
r103781 r139853 32 32 #include "FrameLoaderStateMachine.h" 33 33 #include "FrameLoaderClient.h" 34 #include "InspectorInstrumentation.h" 34 35 #include "Logging.h" 35 36 #include "ResourceResponse.h" … … 121 122 122 123 frame->loader()->client()->didChangeEstimatedProgress(); 124 InspectorInstrumentation::frameStartedLoading(frame); 123 125 } 124 126 … … 156 158 frame->loader()->client()->setMainFrameDocumentReady(true); 157 159 frame->loader()->client()->postProgressFinishedNotification(); 160 InspectorInstrumentation::frameStoppedLoading(frame.get()); 158 161 } 159 162
Note:
See TracChangeset
for help on using the changeset viewer.