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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 else | 432 else |
431 TRACE_EVENT_ASYNC_END0( | 433 TRACE_EVENT_ASYNC_END0( |
432 "gpu", "RenderWidgetCompositor::SetSuppressScheduleComposite", this); | 434 "gpu", "RenderWidgetCompositor::SetSuppressScheduleComposite", this); |
433 suppress_schedule_composite_ = suppress; | 435 suppress_schedule_composite_ = suppress; |
434 } | 436 } |
435 | 437 |
436 bool RenderWidgetCompositor::BeginMainFrameRequested() const { | 438 bool RenderWidgetCompositor::BeginMainFrameRequested() const { |
437 return layer_tree_host_->BeginMainFrameRequested(); | 439 return layer_tree_host_->BeginMainFrameRequested(); |
438 } | 440 } |
439 | 441 |
440 void RenderWidgetCompositor::UpdateAnimations(base::TimeTicks time) { | |
441 layer_tree_host_->UpdateClientAnimations(time); | |
442 } | |
443 | |
444 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { | 442 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { |
445 layer_tree_host_->SetNeedsDisplayOnAllLayers(); | 443 layer_tree_host_->SetNeedsDisplayOnAllLayers(); |
446 } | 444 } |
447 | 445 |
448 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { | 446 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { |
449 cc::LayerTreeDebugState current = layer_tree_host_->debug_state(); | 447 cc::LayerTreeDebugState current = layer_tree_host_->debug_state(); |
450 current.rasterize_only_visible_content = true; | 448 current.rasterize_only_visible_content = true; |
451 layer_tree_host_->SetDebugState(current); | 449 layer_tree_host_->SetDebugState(current); |
452 } | 450 } |
453 | 451 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 | 749 |
752 void RenderWidgetCompositor::WillBeginMainFrame(int frame_id) { | 750 void RenderWidgetCompositor::WillBeginMainFrame(int frame_id) { |
753 widget_->InstrumentWillBeginFrame(frame_id); | 751 widget_->InstrumentWillBeginFrame(frame_id); |
754 widget_->willBeginCompositorFrame(); | 752 widget_->willBeginCompositorFrame(); |
755 } | 753 } |
756 | 754 |
757 void RenderWidgetCompositor::DidBeginMainFrame() { | 755 void RenderWidgetCompositor::DidBeginMainFrame() { |
758 widget_->InstrumentDidBeginFrame(); | 756 widget_->InstrumentDidBeginFrame(); |
759 } | 757 } |
760 | 758 |
761 void RenderWidgetCompositor::Animate(base::TimeTicks frame_begin_time) { | 759 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
762 widget_->webwidget()->animate( | 760 double frame_time = (args.frame_time - base::TimeTicks()).InSecondsF(); |
763 (frame_begin_time - base::TimeTicks()).InSecondsF()); | 761 WebBeginFrameArgs web_begin_frame_args = WebBeginFrameArgs(frame_time); |
| 762 widget_->webwidget()->beginFrame(web_begin_frame_args); |
764 } | 763 } |
765 | 764 |
766 void RenderWidgetCompositor::Layout() { | 765 void RenderWidgetCompositor::Layout() { |
767 widget_->webwidget()->layout(); | 766 widget_->webwidget()->layout(); |
768 } | 767 } |
769 | 768 |
770 void RenderWidgetCompositor::ApplyScrollAndScale( | 769 void RenderWidgetCompositor::ApplyScrollAndScale( |
771 const gfx::Vector2d& scroll_delta, | 770 const gfx::Vector2d& scroll_delta, |
772 float page_scale) { | 771 float page_scale) { |
773 widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale); | 772 widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 widget_->OnSwapBuffersAborted(); | 816 widget_->OnSwapBuffersAborted(); |
818 } | 817 } |
819 | 818 |
820 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 819 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
821 cc::ContextProvider* provider = | 820 cc::ContextProvider* provider = |
822 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 821 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
823 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 822 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
824 } | 823 } |
825 | 824 |
826 } // namespace content | 825 } // namespace content |
OLD | NEW |