Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 DestroyTileManager(); | 275 DestroyTileManager(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 278 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
| 279 // If the begin frame data was handled, then scroll and scale set was applied | 279 // If the begin frame data was handled, then scroll and scale set was applied |
| 280 // by the main thread, so the active tree needs to be updated as if these sent | 280 // by the main thread, so the active tree needs to be updated as if these sent |
| 281 // values were applied and committed. | 281 // values were applied and committed. |
| 282 if (CommitEarlyOutHandledCommit(reason)) { | 282 if (CommitEarlyOutHandledCommit(reason)) { |
| 283 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 283 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
| 284 active_tree_->ResetContentsTexturesPurged(); | 284 active_tree_->ResetContentsTexturesPurged(); |
| 285 RecordMainFrameTiming(); | |
|
mithro-old
2015/03/20 02:17:54
The fact that this method is being called in two p
vmpstr
2015/03/20 18:47:26
Whether this is done in the scheduler or in lthi,
mithro-old
2015/03/23 00:15:08
If we aborted the commit, should we be generating
vmpstr
2015/03/23 20:26:43
This happens after apply scroll deltas, animate la
mithro-old
2015/03/24 07:37:42
Despite having worked in this area for a while, I'
| |
| 285 } | 286 } |
| 286 } | 287 } |
| 287 | 288 |
| 288 void LayerTreeHostImpl::BeginCommit() { | 289 void LayerTreeHostImpl::BeginCommit() { |
| 289 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 290 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
| 290 | 291 |
| 291 // Ensure all textures are returned so partial texture updates can happen | 292 // Ensure all textures are returned so partial texture updates can happen |
| 292 // during the commit. Impl-side-painting doesn't upload during commits, so | 293 // during the commit. Impl-side-painting doesn't upload during commits, so |
| 293 // is unaffected. | 294 // is unaffected. |
| 294 if (!settings_.impl_side_painting && output_surface_) | 295 if (!settings_.impl_side_painting && output_surface_) |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1858 | 1859 |
| 1859 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = | 1860 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = |
| 1860 active_tree_->TakePendingPageScaleAnimation(); | 1861 active_tree_->TakePendingPageScaleAnimation(); |
| 1861 if (pending_page_scale_animation) { | 1862 if (pending_page_scale_animation) { |
| 1862 StartPageScaleAnimation( | 1863 StartPageScaleAnimation( |
| 1863 pending_page_scale_animation->target_offset, | 1864 pending_page_scale_animation->target_offset, |
| 1864 pending_page_scale_animation->use_anchor, | 1865 pending_page_scale_animation->use_anchor, |
| 1865 pending_page_scale_animation->scale, | 1866 pending_page_scale_animation->scale, |
| 1866 pending_page_scale_animation->duration); | 1867 pending_page_scale_animation->duration); |
| 1867 } | 1868 } |
| 1869 RecordMainFrameTiming(); | |
| 1868 } | 1870 } |
| 1869 | 1871 |
| 1870 void LayerTreeHostImpl::SetVisible(bool visible) { | 1872 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1871 DCHECK(proxy_->IsImplThread()); | 1873 DCHECK(proxy_->IsImplThread()); |
| 1872 | 1874 |
| 1873 if (visible_ == visible) | 1875 if (visible_ == visible) |
| 1874 return; | 1876 return; |
| 1875 visible_ = visible; | 1877 visible_ = visible; |
| 1876 DidVisibilityChange(this, visible_); | 1878 DidVisibilityChange(this, visible_); |
| 1877 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); | 1879 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2099 *resource_pool = ResourcePool::Create( | 2101 *resource_pool = ResourcePool::Create( |
| 2100 resource_provider_.get(), GL_TEXTURE_2D); | 2102 resource_provider_.get(), GL_TEXTURE_2D); |
| 2101 | 2103 |
| 2102 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( | 2104 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( |
| 2103 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, | 2105 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, |
| 2104 resource_provider_.get(), | 2106 resource_provider_.get(), |
| 2105 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), | 2107 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), |
| 2106 settings_.renderer_settings.refresh_rate)); | 2108 settings_.renderer_settings.refresh_rate)); |
| 2107 } | 2109 } |
| 2108 | 2110 |
| 2111 void LayerTreeHostImpl::SetCurrentRequestAnimationFrameTime( | |
| 2112 base::TimeTicks frame_time) { | |
| 2113 request_animation_frame_time_ = frame_time; | |
| 2114 } | |
| 2115 | |
| 2116 void LayerTreeHostImpl::RecordMainFrameTiming() { | |
| 2117 std::vector<int64_t> request_ids; | |
| 2118 active_tree_->GatherFrameTimingRequestIds(&request_ids); | |
| 2119 if (request_ids.empty()) | |
| 2120 return; | |
| 2121 | |
| 2122 base::TimeTicks end_time = | |
| 2123 client_->GetNextPredictedRequestAnimationFrameTime(); | |
| 2124 frame_timing_tracker_->SaveMainFrameTimeStamps( | |
| 2125 request_ids, request_animation_frame_time_, end_time, | |
| 2126 active_tree_->source_frame_number()); | |
| 2127 } | |
| 2128 | |
| 2109 void LayerTreeHostImpl::DestroyTileManager() { | 2129 void LayerTreeHostImpl::DestroyTileManager() { |
| 2110 tile_manager_ = nullptr; | 2130 tile_manager_ = nullptr; |
| 2111 resource_pool_ = nullptr; | 2131 resource_pool_ = nullptr; |
| 2112 staging_resource_pool_ = nullptr; | 2132 staging_resource_pool_ = nullptr; |
| 2113 tile_task_worker_pool_ = nullptr; | 2133 tile_task_worker_pool_ = nullptr; |
| 2114 rasterizer_ = nullptr; | 2134 rasterizer_ = nullptr; |
| 2115 single_thread_synchronous_task_graph_runner_ = nullptr; | 2135 single_thread_synchronous_task_graph_runner_ = nullptr; |
| 2116 } | 2136 } |
| 2117 | 2137 |
| 2118 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { | 2138 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3470 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3490 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3471 | 3491 |
| 3472 curve->UpdateTarget( | 3492 curve->UpdateTarget( |
| 3473 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3493 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3474 .InSecondsF(), | 3494 .InSecondsF(), |
| 3475 new_target); | 3495 new_target); |
| 3476 | 3496 |
| 3477 return true; | 3497 return true; |
| 3478 } | 3498 } |
| 3479 } // namespace cc | 3499 } // namespace cc |
| OLD | NEW |