| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 | 717 |
| 718 void RenderWidget::AnimateIfNeeded() { | 718 void RenderWidget::AnimateIfNeeded() { |
| 719 if (!animation_update_pending_) | 719 if (!animation_update_pending_) |
| 720 return; | 720 return; |
| 721 | 721 |
| 722 // Target 60FPS if vsync is on. Go as fast as we can if vsync is off. | 722 // Target 60FPS if vsync is on. Go as fast as we can if vsync is off. |
| 723 base::TimeDelta animationInterval = IsRenderingVSynced() ? | 723 base::TimeDelta animationInterval = IsRenderingVSynced() ? |
| 724 base::TimeDelta::FromMilliseconds(16) : base::TimeDelta(); | 724 base::TimeDelta::FromMilliseconds(16) : base::TimeDelta(); |
| 725 | 725 |
| 726 base::Time now = base::Time::Now(); | 726 base::Time now = base::Time::Now(); |
| 727 if (now >= animation_floor_time_ || is_accelerated_compositing_active_) { | 727 |
| 728 // animation_floor_time_ is the earliest time that we should animate when |
| 729 // using the dead reckoning software scheduler. If we're using swapbuffers |
| 730 // complete callbacks to rate limit, we can ignore this floor. |
| 731 if (now >= animation_floor_time_ || num_swapbuffers_complete_pending_ > 0) { |
| 728 TRACE_EVENT0("renderer", "RenderWidget::AnimateIfNeeded") | 732 TRACE_EVENT0("renderer", "RenderWidget::AnimateIfNeeded") |
| 729 animation_floor_time_ = now + animationInterval; | 733 animation_floor_time_ = now + animationInterval; |
| 730 // Set a timer to call us back after animationInterval before | 734 // Set a timer to call us back after animationInterval before |
| 731 // running animation callbacks so that if a callback requests another | 735 // running animation callbacks so that if a callback requests another |
| 732 // we'll be sure to run it at the proper time. | 736 // we'll be sure to run it at the proper time. |
| 733 MessageLoop::current()->PostDelayedTask( | 737 MessageLoop::current()->PostDelayedTask( |
| 734 FROM_HERE, base::Bind(&RenderWidget::AnimationCallback, this), | 738 FROM_HERE, base::Bind(&RenderWidget::AnimationCallback, this), |
| 735 animationInterval); | 739 animationInterval); |
| 736 animation_task_posted_ = true; | 740 animation_task_posted_ = true; |
| 737 animation_update_pending_ = false; | 741 animation_update_pending_ = false; |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 } | 1648 } |
| 1645 } | 1649 } |
| 1646 | 1650 |
| 1647 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1651 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1648 return false; | 1652 return false; |
| 1649 } | 1653 } |
| 1650 | 1654 |
| 1651 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1655 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1652 return false; | 1656 return false; |
| 1653 } | 1657 } |
| OLD | NEW |