OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/trees/proxy_main.h" | 5 #include "cc/trees/proxy_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void ProxyMain::SetChannel(std::unique_ptr<ChannelMain> channel_main) { | 69 void ProxyMain::SetChannel(std::unique_ptr<ChannelMain> channel_main) { |
70 DCHECK(!channel_main_); | 70 DCHECK(!channel_main_); |
71 channel_main_ = std::move(channel_main); | 71 channel_main_ = std::move(channel_main); |
72 } | 72 } |
73 | 73 |
74 void ProxyMain::DidCompleteSwapBuffers() { | 74 void ProxyMain::DidCompleteSwapBuffers() { |
75 DCHECK(IsMainThread()); | 75 DCHECK(IsMainThread()); |
76 layer_tree_host_->DidCompleteSwapBuffers(); | 76 layer_tree_host_->DidCompleteSwapBuffers(); |
77 } | 77 } |
78 | 78 |
| 79 void ProxyMain::SetRendererCapabilities( |
| 80 const RendererCapabilities& capabilities) { |
| 81 DCHECK(IsMainThread()); |
| 82 renderer_capabilities_ = capabilities; |
| 83 } |
| 84 |
79 void ProxyMain::BeginMainFrameNotExpectedSoon() { | 85 void ProxyMain::BeginMainFrameNotExpectedSoon() { |
80 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrameNotExpectedSoon"); | 86 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrameNotExpectedSoon"); |
81 DCHECK(IsMainThread()); | 87 DCHECK(IsMainThread()); |
82 layer_tree_host_->BeginMainFrameNotExpectedSoon(); | 88 layer_tree_host_->BeginMainFrameNotExpectedSoon(); |
83 } | 89 } |
84 | 90 |
85 void ProxyMain::DidCommitAndDrawFrame() { | 91 void ProxyMain::DidCommitAndDrawFrame() { |
86 DCHECK(IsMainThread()); | 92 DCHECK(IsMainThread()); |
87 layer_tree_host_->DidCommitAndDrawFrame(); | 93 layer_tree_host_->DidCommitAndDrawFrame(); |
88 } | 94 } |
89 | 95 |
90 void ProxyMain::SetAnimationEvents(std::unique_ptr<AnimationEvents> events) { | 96 void ProxyMain::SetAnimationEvents(std::unique_ptr<AnimationEvents> events) { |
91 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); | 97 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); |
92 DCHECK(IsMainThread()); | 98 DCHECK(IsMainThread()); |
93 layer_tree_host_->SetAnimationEvents(std::move(events)); | 99 layer_tree_host_->SetAnimationEvents(std::move(events)); |
94 } | 100 } |
95 | 101 |
96 void ProxyMain::DidLoseOutputSurface() { | 102 void ProxyMain::DidLoseOutputSurface() { |
97 TRACE_EVENT0("cc", "ProxyMain::DidLoseOutputSurface"); | 103 TRACE_EVENT0("cc", "ProxyMain::DidLoseOutputSurface"); |
98 DCHECK(IsMainThread()); | 104 DCHECK(IsMainThread()); |
99 layer_tree_host_->DidLoseOutputSurface(); | 105 layer_tree_host_->DidLoseOutputSurface(); |
100 } | 106 } |
101 | 107 |
102 void ProxyMain::RequestNewOutputSurface() { | 108 void ProxyMain::RequestNewOutputSurface() { |
103 TRACE_EVENT0("cc", "ProxyMain::RequestNewOutputSurface"); | 109 TRACE_EVENT0("cc", "ProxyMain::RequestNewOutputSurface"); |
104 DCHECK(IsMainThread()); | 110 DCHECK(IsMainThread()); |
105 layer_tree_host_->RequestNewOutputSurface(); | 111 layer_tree_host_->RequestNewOutputSurface(); |
106 } | 112 } |
107 | 113 |
108 void ProxyMain::DidInitializeOutputSurface(bool success) { | 114 void ProxyMain::DidInitializeOutputSurface( |
| 115 bool success, |
| 116 const RendererCapabilities& capabilities) { |
109 TRACE_EVENT0("cc", "ProxyMain::DidInitializeOutputSurface"); | 117 TRACE_EVENT0("cc", "ProxyMain::DidInitializeOutputSurface"); |
110 DCHECK(IsMainThread()); | 118 DCHECK(IsMainThread()); |
111 | 119 |
112 if (!success) | 120 if (!success) { |
113 layer_tree_host_->DidFailToInitializeOutputSurface(); | 121 layer_tree_host_->DidFailToInitializeOutputSurface(); |
114 else | 122 return; |
115 layer_tree_host_->DidInitializeOutputSurface(); | 123 } |
| 124 renderer_capabilities_ = capabilities; |
| 125 layer_tree_host_->DidInitializeOutputSurface(); |
116 } | 126 } |
117 | 127 |
118 void ProxyMain::DidCompletePageScaleAnimation() { | 128 void ProxyMain::DidCompletePageScaleAnimation() { |
119 DCHECK(IsMainThread()); | 129 DCHECK(IsMainThread()); |
120 layer_tree_host_->DidCompletePageScaleAnimation(); | 130 layer_tree_host_->DidCompletePageScaleAnimation(); |
121 } | 131 } |
122 | 132 |
123 void ProxyMain::BeginMainFrame( | 133 void ProxyMain::BeginMainFrame( |
124 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 134 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
125 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( | 135 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 273 |
264 void ProxyMain::SetOutputSurface(OutputSurface* output_surface) { | 274 void ProxyMain::SetOutputSurface(OutputSurface* output_surface) { |
265 channel_main_->InitializeOutputSurfaceOnImpl(output_surface); | 275 channel_main_->InitializeOutputSurfaceOnImpl(output_surface); |
266 } | 276 } |
267 | 277 |
268 void ProxyMain::SetVisible(bool visible) { | 278 void ProxyMain::SetVisible(bool visible) { |
269 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible); | 279 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible); |
270 channel_main_->SetVisibleOnImpl(visible); | 280 channel_main_->SetVisibleOnImpl(visible); |
271 } | 281 } |
272 | 282 |
| 283 const RendererCapabilities& ProxyMain::GetRendererCapabilities() const { |
| 284 DCHECK(IsMainThread()); |
| 285 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 286 return renderer_capabilities_; |
| 287 } |
| 288 |
273 void ProxyMain::SetNeedsAnimate() { | 289 void ProxyMain::SetNeedsAnimate() { |
274 DCHECK(IsMainThread()); | 290 DCHECK(IsMainThread()); |
275 if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) { | 291 if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) { |
276 TRACE_EVENT_INSTANT0("cc", "ProxyMain::SetNeedsAnimate", | 292 TRACE_EVENT_INSTANT0("cc", "ProxyMain::SetNeedsAnimate", |
277 TRACE_EVENT_SCOPE_THREAD); | 293 TRACE_EVENT_SCOPE_THREAD); |
278 } | 294 } |
279 } | 295 } |
280 | 296 |
281 void ProxyMain::SetNeedsUpdateLayers() { | 297 void ProxyMain::SetNeedsUpdateLayers() { |
282 DCHECK(IsMainThread()); | 298 DCHECK(IsMainThread()); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 return false; | 448 return false; |
433 channel_main_->SetNeedsCommitOnImpl(); | 449 channel_main_->SetNeedsCommitOnImpl(); |
434 return true; | 450 return true; |
435 } | 451 } |
436 | 452 |
437 bool ProxyMain::IsMainThread() const { | 453 bool ProxyMain::IsMainThread() const { |
438 return task_runner_provider_->IsMainThread(); | 454 return task_runner_provider_->IsMainThread(); |
439 } | 455 } |
440 | 456 |
441 } // namespace cc | 457 } // namespace cc |
OLD | NEW |