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