| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 bool should_draw = have_copy_requests || (have_damage && size_matches); | 281 bool should_draw = have_copy_requests || (have_damage && size_matches); |
| 282 | 282 |
| 283 // If the surface is suspended then the resources to be used by the draw are | 283 // If the surface is suspended then the resources to be used by the draw are |
| 284 // likely destroyed. | 284 // likely destroyed. |
| 285 if (output_surface_->SurfaceIsSuspendForRecycle()) { | 285 if (output_surface_->SurfaceIsSuspendForRecycle()) { |
| 286 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.", | 286 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.", |
| 287 TRACE_EVENT_SCOPE_THREAD); | 287 TRACE_EVENT_SCOPE_THREAD); |
| 288 should_draw = false; | 288 should_draw = false; |
| 289 } | 289 } |
| 290 | 290 |
| 291 client_->DisplayWillDrawAndSwap(should_draw, frame_data->render_pass_list); | |
| 292 | |
| 293 if (should_draw) { | 291 if (should_draw) { |
| 294 gfx::Rect device_viewport_rect = external_viewport_.IsEmpty() | 292 gfx::Rect device_viewport_rect = external_viewport_.IsEmpty() |
| 295 ? gfx::Rect(current_surface_size_) | 293 ? gfx::Rect(current_surface_size_) |
| 296 : external_viewport_; | 294 : external_viewport_; |
| 297 gfx::Rect device_clip_rect = | 295 gfx::Rect device_clip_rect = |
| 298 external_clip_.IsEmpty() ? device_viewport_rect : external_clip_; | 296 external_clip_.IsEmpty() ? device_viewport_rect : external_clip_; |
| 299 | 297 |
| 300 bool disable_image_filtering = | 298 bool disable_image_filtering = |
| 301 frame.metadata.is_resourceless_software_draw_with_scroll_or_animation; | 299 frame.metadata.is_resourceless_software_draw_with_scroll_or_animation; |
| 302 if (software_renderer_) { | 300 if (software_renderer_) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 aggregator_->SetFullDamageForSurface(current_surface_id_); | 332 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 335 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); | 333 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); |
| 336 stored_latency_info_.insert(stored_latency_info_.end(), | 334 stored_latency_info_.insert(stored_latency_info_.end(), |
| 337 frame.metadata.latency_info.begin(), | 335 frame.metadata.latency_info.begin(), |
| 338 frame.metadata.latency_info.end()); | 336 frame.metadata.latency_info.end()); |
| 339 if (scheduler_) | 337 if (scheduler_) |
| 340 scheduler_->DidSwapBuffers(); | 338 scheduler_->DidSwapBuffers(); |
| 341 DidSwapBuffersComplete(); | 339 DidSwapBuffersComplete(); |
| 342 } | 340 } |
| 343 | 341 |
| 344 client_->DisplayDidDrawAndSwap(); | |
| 345 return true; | 342 return true; |
| 346 } | 343 } |
| 347 | 344 |
| 348 void Display::DidSwapBuffersComplete() { | 345 void Display::DidSwapBuffersComplete() { |
| 349 if (scheduler_) | 346 if (scheduler_) |
| 350 scheduler_->DidSwapBuffersComplete(); | 347 scheduler_->DidSwapBuffersComplete(); |
| 351 if (renderer_) | 348 if (renderer_) |
| 352 renderer_->SwapBuffersComplete(); | 349 renderer_->SwapBuffersComplete(); |
| 353 } | 350 } |
| 354 | 351 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 424 |
| 428 if (surface_id == current_surface_id_) | 425 if (surface_id == current_surface_id_) |
| 429 UpdateRootSurfaceResourcesLocked(); | 426 UpdateRootSurfaceResourcesLocked(); |
| 430 } | 427 } |
| 431 | 428 |
| 432 const SurfaceId& Display::CurrentSurfaceId() { | 429 const SurfaceId& Display::CurrentSurfaceId() { |
| 433 return current_surface_id_; | 430 return current_surface_id_; |
| 434 } | 431 } |
| 435 | 432 |
| 436 } // namespace cc | 433 } // namespace cc |
| OLD | NEW |