Changeset 208982 in webkit
- Timestamp:
- Nov 26, 2016, 6:27:55 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
-
Source/JavaScriptCore/runtime/AtomicsObject.cpp (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/AutomaticThread.cpp (modified) (1 diff)
-
Source/WTF/wtf/Seconds.h (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (3 diffs)
-
Source/WebCore/dom/Document.h (modified) (2 diffs)
-
Source/WebCore/page/ChromeClient.h (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (6 diffs)
-
Source/WebCore/page/Settings.cpp (modified) (2 diffs)
-
Source/WebCore/page/Settings.h (modified) (2 diffs)
-
Source/WebCore/style/StyleScope.cpp (modified) (1 diff)
-
Source/WebCore/workers/WorkerRunLoop.cpp (modified) (1 diff)
-
Source/WebKit/mac/WebView/WebPreferencesPrivate.h (modified) (1 diff)
-
Source/WebKit/mac/WebView/WebView.mm (modified) (1 diff)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/ChildProcessProxy.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (modified) (1 diff)
-
Source/WebKit2/UIProcess/WebProcessProxy.cpp (modified) (1 diff)
-
Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WTF/Condition.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp
r208415 r208982 316 316 // so NaN is the only special case. 317 317 if (timeout == timeout) 318 timeout = std::max( Seconds(0), timeout);318 timeout = std::max(0_s, timeout); 319 319 else 320 320 timeout = Seconds::infinity(); -
trunk/Source/WTF/ChangeLog
r208979 r208982 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime 4 https://bugs.webkit.org/show_bug.cgi?id=164992 5 6 Reviewed by Darin Adler. 7 8 Add Seconds::zero() as a nicer way to express Seconds(0). 9 10 * wtf/Seconds.h: 11 (WTF::Seconds::zero): 12 1 13 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WTF/wtf/AutomaticThread.cpp
r208415 r208982 182 182 // Shut the thread down after one second. 183 183 bool awokenByNotify = 184 m_condition->m_condition.waitFor(*m_lock, Seconds(1));184 m_condition->m_condition.waitFor(*m_lock, 1_s); 185 185 if (!awokenByNotify) { 186 186 if (verbose) -
trunk/Source/WTF/wtf/Seconds.h
r208979 r208982 202 202 }; 203 203 204 inline namespace seconds_literals { 205 204 206 constexpr Seconds operator"" _min(long double minutes) 205 207 { … … 252 254 } 253 255 256 } // inline seconds_literals 257 254 258 WTF_EXPORT_PRIVATE void sleep(Seconds); 255 259 256 } // namespae WTF 257 260 } // namespace WTF 261 262 using namespace WTF::seconds_literals; 258 263 using WTF::Seconds; 259 264 -
trunk/Source/WebCore/ChangeLog
r208981 r208982 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime 4 https://bugs.webkit.org/show_bug.cgi?id=164992 5 6 Reviewed by Darin Adler. 7 8 std::chrono::milliseconds -> Seconds. 9 10 Rename Document::elapsedTime() to timeSinceDocumentCreation() which is more explicit. 11 12 Replace INSTRUMENT_LAYOUT_SCHEDULING with LOG(Layout...). 13 14 * dom/Document.cpp: 15 (WebCore::Document::Document): 16 (WebCore::Document::implicitClose): 17 (WebCore::Document::isLayoutTimerActive): 18 (WebCore::Document::minimumLayoutDelay): 19 (WebCore::Document::timeSinceDocumentCreation): 20 (WebCore::Document::elapsedTime): Deleted. 21 * dom/Document.h: 22 * page/ChromeClient.h: 23 * page/FrameView.cpp: 24 (WebCore::FrameView::layout): 25 (WebCore::FrameView::scrollPositionChanged): 26 (WebCore::FrameView::layoutTimerFired): 27 (WebCore::FrameView::scheduleRelayout): 28 (WebCore::FrameView::scheduleRelayoutOfSubtree): 29 (WebCore::FrameView::unscheduleRelayout): 30 * page/Settings.cpp: 31 (WebCore::Settings::setLayoutInterval): 32 * page/Settings.h: 33 (WebCore::Settings::layoutInterval): 34 * style/StyleScope.cpp: 35 (WebCore::Style::Scope::removePendingSheet): 36 * workers/WorkerRunLoop.cpp: 37 (WebCore::WorkerRunLoop::runInMode): 38 1 39 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 40 -
trunk/Source/WebCore/dom/Document.cpp
r208903 r208982 469 469 , m_processingLoadEvent(false) 470 470 , m_loadEventFinished(false) 471 , m_ startTime(std::chrono::steady_clock::now())471 , m_documentCreationTime(MonotonicTime::now()) 472 472 , m_overMinimumLayoutThreshold(false) 473 473 , m_scriptRunner(std::make_unique<ScriptRunner>(*this)) … … 2697 2697 // If they wanna cheat, we can too. -dwh 2698 2698 2699 if (frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {2699 if (frame()->navigationScheduler().locationChangePending() && timeSinceDocumentCreation() < settings()->layoutInterval()) { 2700 2700 // Just bail out. Before or during the onload we were shifted to another page. 2701 2701 // The old i-Bench suite does this. When this happens don't bother painting or laying out. … … 2771 2771 bool Document::isLayoutTimerActive() 2772 2772 { 2773 return view() && view()->layoutPending() && !minimumLayoutDelay() .count();2774 } 2775 2776 std::chrono::milliseconds Document::minimumLayoutDelay()2773 return view() && view()->layoutPending() && !minimumLayoutDelay(); 2774 } 2775 2776 Seconds Document::minimumLayoutDelay() 2777 2777 { 2778 2778 if (m_overMinimumLayoutThreshold) 2779 return 0 ms;2779 return 0_s; 2780 2780 2781 auto elapsed = elapsedTime();2781 auto elapsed = timeSinceDocumentCreation(); 2782 2782 m_overMinimumLayoutThreshold = elapsed > settings()->layoutInterval(); 2783 2783 2784 2784 // We'll want to schedule the timer to fire at the minimum layout threshold. 2785 return std::max(0ms, settings()->layoutInterval() - elapsed); 2786 } 2787 2788 std::chrono::milliseconds Document::elapsedTime() const 2789 { 2790 auto elapsedTime = std::chrono::steady_clock::now() - m_startTime; 2791 2792 return std::chrono::duration_cast<std::chrono::milliseconds>(elapsedTime); 2785 return std::max(0_s, settings()->layoutInterval() - elapsed); 2786 } 2787 2788 Seconds Document::timeSinceDocumentCreation() const 2789 { 2790 return MonotonicTime::now() - m_documentCreationTime; 2793 2791 } 2794 2792 -
trunk/Source/WebCore/dom/Document.h
r208828 r208982 672 672 void setParsing(bool); 673 673 bool parsing() const { return m_bParsing; } 674 std::chrono::milliseconds minimumLayoutDelay();674 Seconds minimumLayoutDelay(); 675 675 676 676 bool shouldScheduleLayout(); 677 677 bool isLayoutTimerActive(); 678 std::chrono::milliseconds elapsedTime() const;678 Seconds timeSinceDocumentCreation() const; 679 679 680 680 void setTextColor(const Color& color) { m_textColor = color; } … … 1528 1528 1529 1529 RefPtr<SerializedScriptValue> m_pendingStateObject; 1530 std::chrono::steady_clock::time_point m_startTime;1530 MonotonicTime m_documentCreationTime; 1531 1531 bool m_overMinimumLayoutThreshold; 1532 1532 -
trunk/Source/WebCore/page/ChromeClient.h
r208916 r208982 234 234 #endif 235 235 236 virtual Seconds eventThrottlingDelay() { return Seconds(0); };236 virtual Seconds eventThrottlingDelay() { return 0_s; }; 237 237 238 238 #if PLATFORM(IOS) -
trunk/Source/WebCore/page/FrameView.cpp
r208927 r208982 1399 1399 } 1400 1400 1401 #if def INSTRUMENT_LAYOUT_SCHEDULING1401 #if !LOG_DISABLED 1402 1402 if (m_firstLayout && !frame().ownerElement()) 1403 printf("Elapsed time before first layout: %lld\n", document.elapsedTime().count());1403 LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs\n", this, document.timeSinceDocumentCreation().value()); 1404 1404 #endif 1405 1405 } … … 2438 2438 { 2439 2439 Page* page = frame().page(); 2440 Seconds throttlingDelay = page ? page->chrome().client().eventThrottlingDelay() : Seconds(0);2441 2442 if (throttlingDelay == Seconds(0)) {2440 Seconds throttlingDelay = page ? page->chrome().client().eventThrottlingDelay() : 0_s; 2441 2442 if (throttlingDelay == 0_s) { 2443 2443 m_delayedScrollEventTimer.stop(); 2444 2444 sendScrollEvent(); … … 2875 2875 void FrameView::layoutTimerFired() 2876 2876 { 2877 #if def INSTRUMENT_LAYOUT_SCHEDULING2877 #if !LOG_DISABLED 2878 2878 if (!frame().document()->ownerElement()) 2879 printf("Layout timer fired at %lld\n", frame().document()->elapsedTime().count());2879 LOG(Layout, "FrameView %p layout timer fired at %.3fs", this, frame().document()->timeSinceDocumentCreation().value()); 2880 2880 #endif 2881 2881 layout(); … … 2902 2902 frame().ownerRenderer()->setNeedsLayout(MarkContainingBlockChain); 2903 2903 2904 std::chrono::milliseconds delay = frame().document()->minimumLayoutDelay();2905 if (m_layoutTimer.isActive() && m_delayedLayout && !delay .count())2904 Seconds delay = frame().document()->minimumLayoutDelay(); 2905 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) 2906 2906 unscheduleRelayout(); 2907 2907 2908 if (m_layoutTimer.isActive()) 2908 2909 return; 2909 2910 2910 m_delayedLayout = delay. count();2911 2912 #if def INSTRUMENT_LAYOUT_SCHEDULING2911 m_delayedLayout = delay.value(); 2912 2913 #if !LOG_DISABLED 2913 2914 if (!frame().document()->ownerElement()) 2914 printf("Scheduling layout for %d\n", delay);2915 LOG(Layout, "FrameView %p scheduling layout for %.3fs", this, delay.value()); 2915 2916 #endif 2916 2917 … … 2945 2946 2946 2947 if (!layoutPending() && m_layoutSchedulingEnabled) { 2947 std::chrono::milliseconds delay = renderView.document().minimumLayoutDelay();2948 Seconds delay = renderView.document().minimumLayoutDelay(); 2948 2949 ASSERT(!newRelayoutRoot.container() || is<RenderView>(newRelayoutRoot.container()) || !newRelayoutRoot.container()->needsLayout()); 2949 2950 m_layoutRoot = &newRelayoutRoot; 2950 2951 InspectorInstrumentation::didInvalidateLayout(frame()); 2951 m_delayedLayout = delay. count();2952 m_delayedLayout = delay.value(); 2952 2953 m_layoutTimer.startOneShot(delay); 2953 2954 return; … … 3042 3043 return; 3043 3044 3044 #if def INSTRUMENT_LAYOUT_SCHEDULING3045 #if !LOG_DISABLED 3045 3046 if (!frame().document()->ownerElement()) 3046 printf("Layout timer unscheduled at %d\n", frame().document()->elapsedTime());3047 LOG(Layout, "FrameView %p layout timer unscheduled at %.3fs", this, frame().document()->timeSinceDocumentCreation().value()); 3047 3048 #endif 3048 3049 -
trunk/Source/WebCore/page/Settings.cpp
r208249 r208982 185 185 // FIXME: For faster machines this value can really be lowered to 200. 250 is adequate, but a little high 186 186 // for dual G5s. :) 187 static const auto layoutScheduleThreshold = 250ms;187 static const Seconds layoutScheduleThreshold = 250_ms; 188 188 189 189 Settings::Settings(Page* page) … … 462 462 } 463 463 464 void Settings::setLayoutInterval( std::chrono::milliseconds layoutInterval)464 void Settings::setLayoutInterval(Seconds layoutInterval) 465 465 { 466 466 // FIXME: It seems weird that this function may disregard the specified layout interval. -
trunk/Source/WebCore/page/Settings.h
r208899 r208982 173 173 std::chrono::milliseconds minimumDOMTimerInterval() const { return m_minimumDOMTimerInterval; } 174 174 175 WEBCORE_EXPORT void setLayoutInterval( std::chrono::milliseconds);176 std::chrono::milliseconds layoutInterval() const { return m_layoutInterval; }175 WEBCORE_EXPORT void setLayoutInterval(Seconds); 176 Seconds layoutInterval() const { return m_layoutInterval; } 177 177 178 178 bool hiddenPageDOMTimerThrottlingEnabled() const { return m_hiddenPageDOMTimerThrottlingEnabled; } … … 326 326 const std::unique_ptr<FontGenericFamilies> m_fontGenericFamilies; 327 327 SecurityOrigin::StorageBlockingPolicy m_storageBlockingPolicy; 328 std::chrono::milliseconds m_layoutInterval;328 Seconds m_layoutInterval; 329 329 std::chrono::milliseconds m_minimumDOMTimerInterval; 330 330 -
trunk/Source/WebCore/style/StyleScope.cpp
r208967 r208982 150 150 151 151 m_pendingStyleSheetCount--; 152 153 #ifdef INSTRUMENT_LAYOUT_SCHEDULING154 if (!ownerElement())155 printf("Stylesheet loaded at time %d. %d stylesheets still remain.\n", elapsedTime(), m_pendingStylesheets);156 #endif157 158 152 if (m_pendingStyleSheetCount) 159 153 return; -
trunk/Source/WebCore/workers/WorkerRunLoop.cpp
r208725 r208982 164 164 CFAbsoluteTime nextCFRunLoopTimerFireDate = CFRunLoopGetNextTimerFireDate(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 165 165 double timeUntilNextCFRunLoopTimerInSeconds = nextCFRunLoopTimerFireDate - CFAbsoluteTimeGetCurrent(); 166 deadline = WallTime::now() + std::max( 167 Seconds(0), Seconds(timeUntilNextCFRunLoopTimerInSeconds)); 166 deadline = WallTime::now() + std::max(0_s, Seconds(timeUntilNextCFRunLoopTimerInSeconds)); 168 167 #endif 169 168 -
trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
r208903 r208982 340 340 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag; 341 341 - (BOOL)_alwaysUseAcceleratedOverflowScroll; 342 - (void)_setLayoutInterval:(int) l;343 - (int)_layoutInterval; 342 - (void)_setLayoutInterval:(int)milliseconds; 343 - (int)_layoutInterval; // Milliseonds. 344 344 - (void)_setMaxParseDuration:(float)d; 345 345 - (float)_maxParseDuration; -
trunk/Source/WebKit/mac/WebView/WebView.mm
r208949 r208982 2737 2737 settings.setTelephoneNumberParsingEnabled([preferences _telephoneNumberParsingEnabled]); 2738 2738 settings.setAllowMultiElementImplicitSubmission([preferences _allowMultiElementImplicitFormSubmission]); 2739 settings.setLayoutInterval( std::chrono::milliseconds([preferences _layoutInterval]));2739 settings.setLayoutInterval(Seconds::fromMilliseconds([preferences _layoutInterval])); 2740 2740 settings.setMaxParseDuration([preferences _maxParseDuration]); 2741 2741 settings.setAlwaysUseAcceleratedOverflowScroll([preferences _alwaysUseAcceleratedOverflowScroll]); -
trunk/Source/WebKit2/ChangeLog
r208977 r208982 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime 4 https://bugs.webkit.org/show_bug.cgi?id=164992 5 6 Reviewed by Darin Adler. 7 8 No more ugly conversion from seconds to milliseconds. 9 10 * WebProcess/WebPage/WebPage.cpp: 11 (WebKit::WebPage::updatePreferences): 12 * WebProcess/WebPage/ios/WebPageIOS.mm: 13 (WebKit::WebPage::eventThrottlingDelay): 14 1 15 2016-11-25 Michael Catanzaro <mcatanzaro@igalia.com> 2 16 -
trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h
r208415 r208982 45 45 46 46 template<typename T> bool send(T&& message, uint64_t destinationID, OptionSet<IPC::SendOption> sendOptions = { }); 47 template<typename T> bool sendSync(T&& message, typename T::Reply&&, uint64_t destinationID, Seconds timeout = Seconds(1), OptionSet<IPC::SendSyncOption> sendSyncOptions = { });47 template<typename T> bool sendSync(T&& message, typename T::Reply&&, uint64_t destinationID, Seconds timeout = 1_s, OptionSet<IPC::SendSyncOption> sendSyncOptions = { }); 48 48 49 49 IPC::Connection* connection() const -
trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
r208959 r208982 367 367 368 368 bool handled = false; 369 sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, Seconds(1));369 sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, 1_s); 370 370 } 371 371 -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r208941 r208982 901 901 902 902 bool handled = false; 903 sendSync(Messages::WebProcess::ProcessWillSuspendImminently(), Messages::WebProcess::ProcessWillSuspendImminently::Reply(handled), 0, Seconds(1));903 sendSync(Messages::WebProcess::ProcessWillSuspendImminently(), Messages::WebProcess::ProcessWillSuspendImminently::Reply(handled), 0, 1_s); 904 904 } 905 905 -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r208748 r208982 314 314 FloatPoint newScrollPosition; 315 315 uint64_t nextValidLayerTreeTransactionID; 316 if (m_process->sendSync(Messages::WebPage::SynchronizeDynamicViewportUpdate(), Messages::WebPage::SynchronizeDynamicViewportUpdate::Reply(newScale, newScrollPosition, nextValidLayerTreeTransactionID), m_pageID, Seconds(2))) {316 if (m_process->sendSync(Messages::WebPage::SynchronizeDynamicViewportUpdate(), Messages::WebPage::SynchronizeDynamicViewportUpdate::Reply(newScale, newScrollPosition, nextValidLayerTreeTransactionID), m_pageID, 2_s)) { 317 317 m_dynamicViewportSizeUpdateWaitingForTarget = false; 318 318 m_dynamicViewportSizeUpdateLayerTreeTransactionID = nextValidLayerTreeTransactionID; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r208939 r208982 3113 3113 settings.setPasswordEchoDurationInSeconds(store.getDoubleValueForKey(WebPreferencesKey::passwordEchoDurationKey())); 3114 3114 3115 settings.setLayoutInterval( std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(store.getDoubleValueForKey(WebPreferencesKey::layoutIntervalKey()))));3115 settings.setLayoutInterval(Seconds(store.getDoubleValueForKey(WebPreferencesKey::layoutIntervalKey()))); 3116 3116 settings.setMaxParseDuration(store.getDoubleValueForKey(WebPreferencesKey::maxParseDurationKey())); 3117 3117 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r208927 r208982 2129 2129 switch (behaviorOverride.value()) { 2130 2130 case EventThrottlingBehavior::Responsive: 2131 return Seconds(0);2131 return 0_s; 2132 2132 case EventThrottlingBehavior::Unresponsive: 2133 return Seconds(1);2133 return 1_s; 2134 2134 } 2135 2135 } 2136 2136 2137 2137 if (m_isInStableState || m_estimatedLatency <= Seconds(1.0 / 60)) 2138 return Seconds(0);2139 2140 return Seconds(std::min<double>(m_estimatedLatency.value() * 2, 1));2138 return 0_s; 2139 2140 return std::min(m_estimatedLatency.value() * 2, 1_s); 2141 2141 } 2142 2142 -
trunk/Tools/ChangeLog
r208979 r208982 1 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 3 Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime 4 https://bugs.webkit.org/show_bug.cgi?id=164992 5 6 Reviewed by Darin Adler. 7 8 Use Seconds::zero(). 9 10 * TestWebKitAPI/Tests/WTF/Condition.cpp: 11 1 12 2016-11-26 Simon Fraser <simon.fraser@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp
r208415 r208982 82 82 NotifyStyle notifyStyle, 83 83 Seconds timeout = Seconds::infinity(), 84 Seconds delay = Seconds(0))84 Seconds delay = 0_s) 85 85 { 86 86 Deque<unsigned> queue;
Note:
See TracChangeset
for help on using the changeset viewer.