OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "cc/base/latency_info_swap_promise.h" | 17 #include "cc/base/latency_info_swap_promise.h" |
18 #include "cc/base/latency_info_swap_promise_monitor.h" | 18 #include "cc/base/latency_info_swap_promise_monitor.h" |
19 #include "cc/base/swap_promise.h" | 19 #include "cc/base/swap_promise.h" |
20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
21 #include "cc/debug/layer_tree_debug_state.h" | 21 #include "cc/debug/layer_tree_debug_state.h" |
22 #include "cc/debug/micro_benchmark.h" | 22 #include "cc/debug/micro_benchmark.h" |
23 #include "cc/input/layer_selection_bound.h" | 23 #include "cc/input/layer_selection_bound.h" |
24 #include "cc/layers/layer.h" | 24 #include "cc/layers/layer.h" |
| 25 #include "cc/output/begin_frame_args.h" |
25 #include "cc/output/copy_output_request.h" | 26 #include "cc/output/copy_output_request.h" |
26 #include "cc/output/copy_output_result.h" | 27 #include "cc/output/copy_output_result.h" |
27 #include "cc/resources/single_release_callback.h" | 28 #include "cc/resources/single_release_callback.h" |
28 #include "cc/trees/layer_tree_host.h" | 29 #include "cc/trees/layer_tree_host.h" |
29 #include "content/child/child_shared_bitmap_manager.h" | 30 #include "content/child/child_shared_bitmap_manager.h" |
30 #include "content/common/content_switches_internal.h" | 31 #include "content/common/content_switches_internal.h" |
31 #include "content/common/gpu/client/context_provider_command_buffer.h" | 32 #include "content/common/gpu/client/context_provider_command_buffer.h" |
32 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
33 #include "content/renderer/compositor_bindings/web_layer_impl.h" | 34 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
34 #include "content/renderer/input/input_handler_manager.h" | 35 #include "content/renderer/input/input_handler_manager.h" |
(...skipping 13 matching lines...) Expand all Loading... |
48 #endif | 49 #endif |
49 | 50 |
50 namespace base { | 51 namespace base { |
51 class Value; | 52 class Value; |
52 } | 53 } |
53 | 54 |
54 namespace cc { | 55 namespace cc { |
55 class Layer; | 56 class Layer; |
56 } | 57 } |
57 | 58 |
| 59 using blink::WebBeginFrameArgs; |
58 using blink::WebFloatPoint; | 60 using blink::WebFloatPoint; |
| 61 using blink::WebRect; |
59 using blink::WebSelectionBound; | 62 using blink::WebSelectionBound; |
60 using blink::WebSize; | 63 using blink::WebSize; |
61 using blink::WebRect; | |
62 | 64 |
63 namespace content { | 65 namespace content { |
64 namespace { | 66 namespace { |
65 | 67 |
66 bool GetSwitchValueAsInt( | 68 bool GetSwitchValueAsInt( |
67 const CommandLine& command_line, | 69 const CommandLine& command_line, |
68 const std::string& switch_string, | 70 const std::string& switch_string, |
69 int min_value, | 71 int min_value, |
70 int max_value, | 72 int max_value, |
71 int* result) { | 73 int* result) { |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 740 |
739 void RenderWidgetCompositor::WillBeginMainFrame(int frame_id) { | 741 void RenderWidgetCompositor::WillBeginMainFrame(int frame_id) { |
740 widget_->InstrumentWillBeginFrame(frame_id); | 742 widget_->InstrumentWillBeginFrame(frame_id); |
741 widget_->willBeginCompositorFrame(); | 743 widget_->willBeginCompositorFrame(); |
742 } | 744 } |
743 | 745 |
744 void RenderWidgetCompositor::DidBeginMainFrame() { | 746 void RenderWidgetCompositor::DidBeginMainFrame() { |
745 widget_->InstrumentDidBeginFrame(); | 747 widget_->InstrumentDidBeginFrame(); |
746 } | 748 } |
747 | 749 |
748 void RenderWidgetCompositor::Animate(base::TimeTicks frame_begin_time) { | 750 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
749 widget_->webwidget()->animate( | 751 double frame_time = (args.frame_time - base::TimeTicks()).InSecondsF(); |
750 (frame_begin_time - base::TimeTicks()).InSecondsF()); | 752 WebBeginFrameArgs web_begin_frame_args = WebBeginFrameArgs(frame_time); |
| 753 widget_->webwidget()->beginFrame(web_begin_frame_args); |
751 } | 754 } |
752 | 755 |
753 void RenderWidgetCompositor::Layout() { | 756 void RenderWidgetCompositor::Layout() { |
754 widget_->webwidget()->layout(); | 757 widget_->webwidget()->layout(); |
755 } | 758 } |
756 | 759 |
757 void RenderWidgetCompositor::ApplyScrollAndScale( | 760 void RenderWidgetCompositor::ApplyScrollAndScale( |
758 const gfx::Vector2d& scroll_delta, | 761 const gfx::Vector2d& scroll_delta, |
759 float page_scale) { | 762 float page_scale) { |
760 widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale); | 763 widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 widget_->OnSwapBuffersAborted(); | 802 widget_->OnSwapBuffersAborted(); |
800 } | 803 } |
801 | 804 |
802 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 805 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
803 cc::ContextProvider* provider = | 806 cc::ContextProvider* provider = |
804 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 807 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
805 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 808 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
806 } | 809 } |
807 | 810 |
808 } // namespace content | 811 } // namespace content |
OLD | NEW |