| 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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 if (should_swap) { | 315 if (should_swap) { |
| 316 swapped_since_resize_ = true; | 316 swapped_since_resize_ = true; |
| 317 for (auto& latency : frame.metadata.latency_info) { | 317 for (auto& latency : frame.metadata.latency_info) { |
| 318 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 318 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
| 319 TRACE_ID_DONT_MANGLE(latency.trace_id()), | 319 TRACE_ID_DONT_MANGLE(latency.trace_id()), |
| 320 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 320 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 321 "step", "Display::DrawAndSwap"); | 321 "step", "Display::DrawAndSwap"); |
| 322 } | 322 } |
| 323 benchmark_instrumentation::IssueDisplayRenderingStatsEvent(); | 323 benchmark_instrumentation::IssueDisplayRenderingStatsEvent(); |
| 324 renderer_->SwapBuffers(std::move(frame.metadata)); | 324 renderer_->SwapBuffers(std::move(frame.metadata)); |
| 325 if (scheduler_) |
| 326 scheduler_->DidSwapBuffers(); |
| 325 } else { | 327 } else { |
| 326 if (have_damage && !size_matches) | 328 if (have_damage && !size_matches) |
| 327 aggregator_->SetFullDamageForSurface(current_surface_id_); | 329 aggregator_->SetFullDamageForSurface(current_surface_id_); |
| 328 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); | 330 TRACE_EVENT_INSTANT0("cc", "Swap skipped.", TRACE_EVENT_SCOPE_THREAD); |
| 329 stored_latency_info_.insert(stored_latency_info_.end(), | 331 stored_latency_info_.insert(stored_latency_info_.end(), |
| 330 frame.metadata.latency_info.begin(), | 332 frame.metadata.latency_info.begin(), |
| 331 frame.metadata.latency_info.end()); | 333 frame.metadata.latency_info.end()); |
| 332 DidSwapBuffers(); | 334 if (scheduler_) |
| 335 scheduler_->DidSwapBuffers(); |
| 333 DidSwapBuffersComplete(); | 336 DidSwapBuffersComplete(); |
| 334 } | 337 } |
| 335 | 338 |
| 336 return true; | 339 return true; |
| 337 } | 340 } |
| 338 | 341 |
| 339 void Display::DidSwapBuffers() { | |
| 340 if (scheduler_) | |
| 341 scheduler_->DidSwapBuffers(); | |
| 342 } | |
| 343 | |
| 344 void Display::DidSwapBuffersComplete() { | 342 void Display::DidSwapBuffersComplete() { |
| 345 if (scheduler_) | 343 if (scheduler_) |
| 346 scheduler_->DidSwapBuffersComplete(); | 344 scheduler_->DidSwapBuffersComplete(); |
| 347 if (renderer_) | 345 if (renderer_) |
| 348 renderer_->SwapBuffersComplete(); | 346 renderer_->SwapBuffersComplete(); |
| 349 } | 347 } |
| 350 | 348 |
| 351 void Display::CommitVSyncParameters(base::TimeTicks timebase, | 349 void Display::CommitVSyncParameters(base::TimeTicks timebase, |
| 352 base::TimeDelta interval) { | 350 base::TimeDelta interval) { |
| 353 // Display uses a BeginFrameSource instead. | 351 // Display uses a BeginFrameSource instead. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 422 |
| 425 if (surface_id == current_surface_id_) | 423 if (surface_id == current_surface_id_) |
| 426 UpdateRootSurfaceResourcesLocked(); | 424 UpdateRootSurfaceResourcesLocked(); |
| 427 } | 425 } |
| 428 | 426 |
| 429 SurfaceId Display::CurrentSurfaceId() { | 427 SurfaceId Display::CurrentSurfaceId() { |
| 430 return current_surface_id_; | 428 return current_surface_id_; |
| 431 } | 429 } |
| 432 | 430 |
| 433 } // namespace cc | 431 } // namespace cc |
| OLD | NEW |