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/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if (auto* context = output_surface_->context_provider()) | 64 if (auto* context = output_surface_->context_provider()) |
65 context->SetLostContextCallback(base::Closure()); | 65 context->SetLostContextCallback(base::Closure()); |
66 if (begin_frame_source_) | 66 if (begin_frame_source_) |
67 surface_manager_->UnregisterBeginFrameSource(begin_frame_source_); | 67 surface_manager_->UnregisterBeginFrameSource(begin_frame_source_); |
68 surface_manager_->RemoveObserver(this); | 68 surface_manager_->RemoveObserver(this); |
69 } | 69 } |
70 if (aggregator_) { | 70 if (aggregator_) { |
71 for (const auto& id_entry : aggregator_->previous_contained_surfaces()) { | 71 for (const auto& id_entry : aggregator_->previous_contained_surfaces()) { |
72 Surface* surface = surface_manager_->GetSurfaceForId(id_entry.first); | 72 Surface* surface = surface_manager_->GetSurfaceForId(id_entry.first); |
73 if (surface) | 73 if (surface) |
74 surface->RunDrawCallbacks(); | 74 surface->RunDrawCallback(); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void Display::Initialize(DisplayClient* client, | 79 void Display::Initialize(DisplayClient* client, |
80 SurfaceManager* surface_manager) { | 80 SurfaceManager* surface_manager) { |
81 DCHECK(client); | 81 DCHECK(client); |
82 DCHECK(surface_manager); | 82 DCHECK(surface_manager); |
83 client_ = client; | 83 client_ = client; |
84 surface_manager_ = surface_manager; | 84 surface_manager_ = surface_manager; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (frame.render_pass_list.empty()) { | 262 if (frame.render_pass_list.empty()) { |
263 TRACE_EVENT_INSTANT0("cc", "Empty aggregated frame.", | 263 TRACE_EVENT_INSTANT0("cc", "Empty aggregated frame.", |
264 TRACE_EVENT_SCOPE_THREAD); | 264 TRACE_EVENT_SCOPE_THREAD); |
265 return false; | 265 return false; |
266 } | 266 } |
267 | 267 |
268 // Run callbacks early to allow pipelining. | 268 // Run callbacks early to allow pipelining. |
269 for (const auto& id_entry : aggregator_->previous_contained_surfaces()) { | 269 for (const auto& id_entry : aggregator_->previous_contained_surfaces()) { |
270 Surface* surface = surface_manager_->GetSurfaceForId(id_entry.first); | 270 Surface* surface = surface_manager_->GetSurfaceForId(id_entry.first); |
271 if (surface) | 271 if (surface) |
272 surface->RunDrawCallbacks(); | 272 surface->RunDrawCallback(); |
273 } | 273 } |
274 | 274 |
275 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), | 275 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), |
276 stored_latency_info_.begin(), | 276 stored_latency_info_.begin(), |
277 stored_latency_info_.end()); | 277 stored_latency_info_.end()); |
278 stored_latency_info_.clear(); | 278 stored_latency_info_.clear(); |
279 bool have_copy_requests = false; | 279 bool have_copy_requests = false; |
280 for (const auto& pass : frame.render_pass_list) { | 280 for (const auto& pass : frame.render_pass_list) { |
281 have_copy_requests |= !pass->copy_requests.empty(); | 281 have_copy_requests |= !pass->copy_requests.empty(); |
282 } | 282 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 const SurfaceId& Display::CurrentSurfaceId() { | 417 const SurfaceId& Display::CurrentSurfaceId() { |
418 return current_surface_id_; | 418 return current_surface_id_; |
419 } | 419 } |
420 | 420 |
421 void Display::ForceImmediateDrawAndSwapIfPossible() { | 421 void Display::ForceImmediateDrawAndSwapIfPossible() { |
422 if (scheduler_) | 422 if (scheduler_) |
423 scheduler_->ForceImmediateSwapIfPossible(); | 423 scheduler_->ForceImmediateSwapIfPossible(); |
424 } | 424 } |
425 | 425 |
426 } // namespace cc | 426 } // namespace cc |
OLD | NEW |