| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 TRACE_EVENT1("cc", "Display::SetVisible", "visible", visible); | 119 TRACE_EVENT1("cc", "Display::SetVisible", "visible", visible); |
| 120 if (renderer_) | 120 if (renderer_) |
| 121 renderer_->SetVisible(visible); | 121 renderer_->SetVisible(visible); |
| 122 if (scheduler_) | 122 if (scheduler_) |
| 123 scheduler_->SetVisible(visible); | 123 scheduler_->SetVisible(visible); |
| 124 visible_ = visible; | 124 visible_ = visible; |
| 125 | 125 |
| 126 if (!visible) { | 126 if (!visible) { |
| 127 // Damage tracker needs a full reset as renderer resources are dropped when | 127 // Damage tracker needs a full reset as renderer resources are dropped when |
| 128 // not visible. | 128 // not visible. |
| 129 if (aggregator_ && !current_surface_id_.is_null()) | 129 if (aggregator_ && current_surface_id_.is_valid()) |
| 130 aggregator_->SetFullDamageForSurface(current_surface_id_); | 130 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void Display::Resize(const gfx::Size& size) { | 134 void Display::Resize(const gfx::Size& size) { |
| 135 if (size == current_surface_size_) | 135 if (size == current_surface_size_) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 TRACE_EVENT0("cc", "Display::Resize"); | 138 TRACE_EVENT0("cc", "Display::Resize"); |
| 139 | 139 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 void Display::SetOutputIsSecure(bool secure) { | 159 void Display::SetOutputIsSecure(bool secure) { |
| 160 if (secure == output_is_secure_) | 160 if (secure == output_is_secure_) |
| 161 return; | 161 return; |
| 162 output_is_secure_ = secure; | 162 output_is_secure_ = secure; |
| 163 | 163 |
| 164 if (aggregator_) { | 164 if (aggregator_) { |
| 165 aggregator_->set_output_is_secure(secure); | 165 aggregator_->set_output_is_secure(secure); |
| 166 // Force a redraw. | 166 // Force a redraw. |
| 167 if (!current_surface_id_.is_null()) | 167 if (current_surface_id_.is_valid()) |
| 168 aggregator_->SetFullDamageForSurface(current_surface_id_); | 168 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void Display::InitializeRenderer() { | 172 void Display::InitializeRenderer() { |
| 173 // Not relevant for display compositor since it's not delegated. | 173 // Not relevant for display compositor since it's not delegated. |
| 174 bool delegated_sync_points_required = false; | 174 bool delegated_sync_points_required = false; |
| 175 resource_provider_.reset(new ResourceProvider( | 175 resource_provider_.reset(new ResourceProvider( |
| 176 output_surface_->context_provider(), bitmap_manager_, | 176 output_surface_->context_provider(), bitmap_manager_, |
| 177 gpu_memory_buffer_manager_, nullptr, settings_.highp_threshold_min, | 177 gpu_memory_buffer_manager_, nullptr, settings_.highp_threshold_min, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 if (scheduler_) | 223 if (scheduler_) |
| 224 scheduler_->OutputSurfaceLost(); | 224 scheduler_->OutputSurfaceLost(); |
| 225 // WARNING: The client may delete the Display in this method call. Do not | 225 // WARNING: The client may delete the Display in this method call. Do not |
| 226 // make any additional references to members after this call. | 226 // make any additional references to members after this call. |
| 227 client_->DisplayOutputSurfaceLost(); | 227 client_->DisplayOutputSurfaceLost(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool Display::DrawAndSwap() { | 230 bool Display::DrawAndSwap() { |
| 231 TRACE_EVENT0("cc", "Display::DrawAndSwap"); | 231 TRACE_EVENT0("cc", "Display::DrawAndSwap"); |
| 232 | 232 |
| 233 if (current_surface_id_.is_null()) { | 233 if (!current_surface_id_.is_valid()) { |
| 234 TRACE_EVENT_INSTANT0("cc", "No root surface.", TRACE_EVENT_SCOPE_THREAD); | 234 TRACE_EVENT_INSTANT0("cc", "No root surface.", TRACE_EVENT_SCOPE_THREAD); |
| 235 return false; | 235 return false; |
| 236 } | 236 } |
| 237 | 237 |
| 238 if (!output_surface_) { | 238 if (!output_surface_) { |
| 239 TRACE_EVENT_INSTANT0("cc", "No output surface", TRACE_EVENT_SCOPE_THREAD); | 239 TRACE_EVENT_INSTANT0("cc", "No output surface", TRACE_EVENT_SCOPE_THREAD); |
| 240 return false; | 240 return false; |
| 241 } | 241 } |
| 242 | 242 |
| 243 CompositorFrame frame = aggregator_->Aggregate(current_surface_id_); | 243 CompositorFrame frame = aggregator_->Aggregate(current_surface_id_); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 const SurfaceId& Display::CurrentSurfaceId() { | 394 const SurfaceId& Display::CurrentSurfaceId() { |
| 395 return current_surface_id_; | 395 return current_surface_id_; |
| 396 } | 396 } |
| 397 | 397 |
| 398 void Display::ForceImmediateDrawAndSwapIfPossible() { | 398 void Display::ForceImmediateDrawAndSwapIfPossible() { |
| 399 if (scheduler_) | 399 if (scheduler_) |
| 400 scheduler_->ForceImmediateSwapIfPossible(); | 400 scheduler_->ForceImmediateSwapIfPossible(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace cc | 403 } // namespace cc |
| OLD | NEW |