| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 scheduler_->DidSwapBuffers(); | 323 scheduler_->DidSwapBuffers(); |
| 324 } else { | 324 } else { |
| 325 if (have_damage && !size_matches) | 325 if (have_damage && !size_matches) |
| 326 aggregator_->SetFullDamageForSurface(current_surface_id_); | 326 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 327 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); | 327 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); |
| 328 stored_latency_info_.insert(stored_latency_info_.end(), | 328 stored_latency_info_.insert(stored_latency_info_.end(), |
| 329 frame.metadata.latency_info.begin(), | 329 frame.metadata.latency_info.begin(), |
| 330 frame.metadata.latency_info.end()); | 330 frame.metadata.latency_info.end()); |
| 331 if (scheduler_) { | 331 if (scheduler_) { |
| 332 scheduler_->DidSwapBuffers(); | 332 scheduler_->DidSwapBuffers(); |
| 333 scheduler_->DidSwapBuffersComplete(); | 333 scheduler_->DidReceiveSwapBuffersAck(); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 client_->DisplayDidDrawAndSwap(); | 337 client_->DisplayDidDrawAndSwap(); |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 | 340 |
| 341 void Display::DidSwapBuffersComplete() { | 341 void Display::DidReceiveSwapBuffersAck() { |
| 342 if (scheduler_) | 342 if (scheduler_) |
| 343 scheduler_->DidSwapBuffersComplete(); | 343 scheduler_->DidReceiveSwapBuffersAck(); |
| 344 if (renderer_) | 344 if (renderer_) |
| 345 renderer_->SwapBuffersComplete(); | 345 renderer_->SwapBuffersComplete(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void Display::DidReceiveTextureInUseResponses( | 348 void Display::DidReceiveTextureInUseResponses( |
| 349 const gpu::TextureInUseResponses& responses) { | 349 const gpu::TextureInUseResponses& responses) { |
| 350 if (renderer_) | 350 if (renderer_) |
| 351 renderer_->DidReceiveTextureInUseResponses(responses); | 351 renderer_->DidReceiveTextureInUseResponses(responses); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void Display::SetBeginFrameSource(BeginFrameSource* source) { | |
| 355 // The BeginFrameSource is set from the constructor, it doesn't come | |
| 356 // from the OutputSurface for the Display. | |
| 357 NOTREACHED(); | |
| 358 } | |
| 359 | |
| 360 void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | |
| 361 // This is only for LayerTreeHostImpl. | |
| 362 NOTREACHED(); | |
| 363 } | |
| 364 | |
| 365 void Display::OnDraw(const gfx::Transform& transform, | |
| 366 const gfx::Rect& viewport, | |
| 367 bool resourceless_software_draw) { | |
| 368 NOTREACHED(); | |
| 369 } | |
| 370 | |
| 371 void Display::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 354 void Display::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| 372 aggregator_->SetFullDamageForSurface(current_surface_id_); | 355 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 373 if (scheduler_) | 356 if (scheduler_) |
| 374 scheduler_->SurfaceDamaged(current_surface_id_); | 357 scheduler_->SurfaceDamaged(current_surface_id_); |
| 375 } | 358 } |
| 376 | 359 |
| 377 void Display::ReclaimResources(const ReturnedResourceArray& resources) { | |
| 378 NOTREACHED(); | |
| 379 } | |
| 380 | |
| 381 void Display::SetExternalTilePriorityConstraints( | |
| 382 const gfx::Rect& viewport_rect, | |
| 383 const gfx::Transform& transform) { | |
| 384 NOTREACHED(); | |
| 385 } | |
| 386 | |
| 387 void Display::SetTreeActivationCallback(const base::Closure& callback) { | |
| 388 NOTREACHED(); | |
| 389 } | |
| 390 | |
| 391 void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) { | 360 void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) { |
| 392 if (aggregator_ && | 361 if (aggregator_ && |
| 393 aggregator_->previous_contained_surfaces().count(surface_id)) { | 362 aggregator_->previous_contained_surfaces().count(surface_id)) { |
| 394 Surface* surface = surface_manager_->GetSurfaceForId(surface_id); | 363 Surface* surface = surface_manager_->GetSurfaceForId(surface_id); |
| 395 if (surface) { | 364 if (surface) { |
| 396 const CompositorFrame& current_frame = surface->GetEligibleFrame(); | 365 const CompositorFrame& current_frame = surface->GetEligibleFrame(); |
| 397 if (!current_frame.delegated_frame_data || | 366 if (!current_frame.delegated_frame_data || |
| 398 current_frame.delegated_frame_data->resource_list.empty()) { | 367 current_frame.delegated_frame_data->resource_list.empty()) { |
| 399 aggregator_->ReleaseResources(surface_id); | 368 aggregator_->ReleaseResources(surface_id); |
| 400 } | 369 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 419 const SurfaceId& Display::CurrentSurfaceId() { | 388 const SurfaceId& Display::CurrentSurfaceId() { |
| 420 return current_surface_id_; | 389 return current_surface_id_; |
| 421 } | 390 } |
| 422 | 391 |
| 423 void Display::ForceImmediateDrawAndSwapIfPossible() { | 392 void Display::ForceImmediateDrawAndSwapIfPossible() { |
| 424 if (scheduler_) | 393 if (scheduler_) |
| 425 scheduler_->ForceImmediateSwapIfPossible(); | 394 scheduler_->ForceImmediateSwapIfPossible(); |
| 426 } | 395 } |
| 427 | 396 |
| 428 } // namespace cc | 397 } // namespace cc |
| OLD | NEW |