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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 516103003: scheduler: Tell the scheduler about frame timing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Still need to keep animate() around. Created 6 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebBeginFrameArgs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #include "platform/PlatformWheelEvent.h" 103 #include "platform/PlatformWheelEvent.h"
104 #include "platform/PopupMenuClient.h" 104 #include "platform/PopupMenuClient.h"
105 #include "platform/RuntimeEnabledFeatures.h" 105 #include "platform/RuntimeEnabledFeatures.h"
106 #include "platform/TraceEvent.h" 106 #include "platform/TraceEvent.h"
107 #include "platform/UserGestureIndicator.h" 107 #include "platform/UserGestureIndicator.h"
108 #include "platform/exported/WebActiveGestureAnimation.h" 108 #include "platform/exported/WebActiveGestureAnimation.h"
109 #include "platform/fonts/FontCache.h" 109 #include "platform/fonts/FontCache.h"
110 #include "platform/graphics/Color.h" 110 #include "platform/graphics/Color.h"
111 #include "platform/graphics/Image.h" 111 #include "platform/graphics/Image.h"
112 #include "platform/graphics/ImageBuffer.h" 112 #include "platform/graphics/ImageBuffer.h"
113 #include "platform/scheduler/Scheduler.h"
113 #include "platform/scroll/ScrollbarTheme.h" 114 #include "platform/scroll/ScrollbarTheme.h"
114 #include "platform/weborigin/SchemeRegistry.h" 115 #include "platform/weborigin/SchemeRegistry.h"
115 #include "public/platform/Platform.h" 116 #include "public/platform/Platform.h"
116 #include "public/platform/WebDragData.h" 117 #include "public/platform/WebDragData.h"
117 #include "public/platform/WebFloatPoint.h" 118 #include "public/platform/WebFloatPoint.h"
118 #include "public/platform/WebGestureCurve.h" 119 #include "public/platform/WebGestureCurve.h"
119 #include "public/platform/WebImage.h" 120 #include "public/platform/WebImage.h"
120 #include "public/platform/WebLayerTreeView.h" 121 #include "public/platform/WebLayerTreeView.h"
121 #include "public/platform/WebURLRequest.h" 122 #include "public/platform/WebURLRequest.h"
122 #include "public/platform/WebVector.h" 123 #include "public/platform/WebVector.h"
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 1727
1727 void WebViewImpl::didExitFullScreen() 1728 void WebViewImpl::didExitFullScreen()
1728 { 1729 {
1729 m_fullscreenController->didExitFullScreen(); 1730 m_fullscreenController->didExitFullScreen();
1730 } 1731 }
1731 1732
1732 void WebViewImpl::beginFrame(const WebBeginFrameArgs& frameTime) 1733 void WebViewImpl::beginFrame(const WebBeginFrameArgs& frameTime)
1733 { 1734 {
1734 TRACE_EVENT0("blink", "WebViewImpl::beginFrame"); 1735 TRACE_EVENT0("blink", "WebViewImpl::beginFrame");
1735 1736
1736 double monotonicFrameBeginTime = frameTime.lastFrameTimeMonotonic; 1737 WebBeginFrameArgs validFrameTime(frameTime);
1737 if (!monotonicFrameBeginTime) 1738 if (!validFrameTime.lastFrameTimeMonotonic)
1738 monotonicFrameBeginTime = monotonicallyIncreasingTime(); 1739 validFrameTime.lastFrameTimeMonotonic = monotonicallyIncreasingTime();
1740
1741 Scheduler::shared()->willBeginFrame(validFrameTime);
1739 1742
1740 // Create synthetic wheel events as necessary for fling. 1743 // Create synthetic wheel events as necessary for fling.
1741 if (m_gestureAnimation) { 1744 if (m_gestureAnimation) {
1742 if (m_gestureAnimation->animate(monotonicFrameBeginTime)) 1745 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic))
1743 scheduleAnimation(); 1746 scheduleAnimation();
1744 else { 1747 else {
1745 endActiveFlingAnimation(); 1748 endActiveFlingAnimation();
1746 1749
1747 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, 1750 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd,
1748 m_positionOnFlingStart, m_globalPositionOnFlingStart, 1751 m_positionOnFlingStart, m_globalPositionOnFlingStart,
1749 IntSize(), 0, false, false, false, false, 1752 IntSize(), 0, false, false, false, false,
1750 0, 0, 0, 0); 1753 0, 0, 0, 0);
1751 1754
1752 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); 1755 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent);
1753 } 1756 }
1754 } 1757 }
1755 1758
1756 WTF_LOG(ScriptedAnimationController, "WebViewImpl::beginFrame: page = %d", ! m_page ? 0 : 1); 1759 WTF_LOG(ScriptedAnimationController, "WebViewImpl::beginFrame: page = %d", ! m_page ? 0 : 1);
1757 if (!m_page) 1760 if (!m_page)
1758 return; 1761 return;
1759 1762
1760 PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); 1763 PageWidgetDelegate::animate(m_page.get(), validFrameTime.lastFrameTimeMonoto nic);
1761 1764
1762 if (m_continuousPaintingEnabled) { 1765 if (m_continuousPaintingEnabled) {
1763 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); 1766 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get());
1764 m_client->scheduleAnimation(); 1767 m_client->scheduleAnimation();
1765 } 1768 }
1766 } 1769 }
1767 1770
1771 void WebViewImpl::didCommitFrameToCompositor()
1772 {
1773 Scheduler::shared()->didCommitFrameToCompositor();
1774 }
1775
1768 void WebViewImpl::layout() 1776 void WebViewImpl::layout()
1769 { 1777 {
1770 TRACE_EVENT0("blink", "WebViewImpl::layout"); 1778 TRACE_EVENT0("blink", "WebViewImpl::layout");
1771 if (!localFrameRootTemporary()) 1779 if (!localFrameRootTemporary())
1772 return; 1780 return;
1773 1781
1774 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame()) ; 1782 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame()) ;
1775 updateLayerTreeBackgroundColor(); 1783 updateLayerTreeBackgroundColor();
1776 1784
1777 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 1785 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4273 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4266 4274
4267 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4275 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4268 return false; 4276 return false;
4269 4277
4270 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4278 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4271 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4279 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4272 } 4280 }
4273 4281
4274 } // namespace blink 4282 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebBeginFrameArgs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698