| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 DestroyTileManager(); | 276 DestroyTileManager(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 279 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
| 280 // If the begin frame data was handled, then scroll and scale set was applied | 280 // If the begin frame data was handled, then scroll and scale set was applied |
| 281 // by the main thread, so the active tree needs to be updated as if these sent | 281 // by the main thread, so the active tree needs to be updated as if these sent |
| 282 // values were applied and committed. | 282 // values were applied and committed. |
| 283 if (CommitEarlyOutHandledCommit(reason)) { | 283 if (CommitEarlyOutHandledCommit(reason)) { |
| 284 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 284 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
| 285 active_tree_->ResetContentsTexturesPurged(); | 285 active_tree_->ResetContentsTexturesPurged(); |
| 286 RecordMainFrameTiming(); |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 | 289 |
| 289 void LayerTreeHostImpl::BeginCommit() { | 290 void LayerTreeHostImpl::BeginCommit() { |
| 290 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 291 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
| 291 | 292 |
| 292 // Ensure all textures are returned so partial texture updates can happen | 293 // Ensure all textures are returned so partial texture updates can happen |
| 293 // during the commit. Impl-side-painting doesn't upload during commits, so | 294 // during the commit. Impl-side-painting doesn't upload during commits, so |
| 294 // is unaffected. | 295 // is unaffected. |
| 295 if (!settings_.impl_side_painting && output_surface_) | 296 if (!settings_.impl_side_painting && output_surface_) |
| (...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 | 1830 |
| 1830 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = | 1831 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation = |
| 1831 active_tree_->TakePendingPageScaleAnimation(); | 1832 active_tree_->TakePendingPageScaleAnimation(); |
| 1832 if (pending_page_scale_animation) { | 1833 if (pending_page_scale_animation) { |
| 1833 StartPageScaleAnimation( | 1834 StartPageScaleAnimation( |
| 1834 pending_page_scale_animation->target_offset, | 1835 pending_page_scale_animation->target_offset, |
| 1835 pending_page_scale_animation->use_anchor, | 1836 pending_page_scale_animation->use_anchor, |
| 1836 pending_page_scale_animation->scale, | 1837 pending_page_scale_animation->scale, |
| 1837 pending_page_scale_animation->duration); | 1838 pending_page_scale_animation->duration); |
| 1838 } | 1839 } |
| 1840 RecordMainFrameTiming(); |
| 1839 } | 1841 } |
| 1840 | 1842 |
| 1841 void LayerTreeHostImpl::SetVisible(bool visible) { | 1843 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1842 DCHECK(proxy_->IsImplThread()); | 1844 DCHECK(proxy_->IsImplThread()); |
| 1843 | 1845 |
| 1844 if (visible_ == visible) | 1846 if (visible_ == visible) |
| 1845 return; | 1847 return; |
| 1846 visible_ = visible; | 1848 visible_ = visible; |
| 1847 DidVisibilityChange(this, visible_); | 1849 DidVisibilityChange(this, visible_); |
| 1848 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); | 1850 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 *resource_pool = ResourcePool::Create( | 2072 *resource_pool = ResourcePool::Create( |
| 2071 resource_provider_.get(), GL_TEXTURE_2D); | 2073 resource_provider_.get(), GL_TEXTURE_2D); |
| 2072 | 2074 |
| 2073 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( | 2075 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( |
| 2074 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, | 2076 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, |
| 2075 resource_provider_.get(), | 2077 resource_provider_.get(), |
| 2076 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), | 2078 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), |
| 2077 settings_.renderer_settings.refresh_rate)); | 2079 settings_.renderer_settings.refresh_rate)); |
| 2078 } | 2080 } |
| 2079 | 2081 |
| 2082 void LayerTreeHostImpl::SetBeginMainFrameTime(base::TimeTicks frame_time) { |
| 2083 main_frame_time_ = frame_time; |
| 2084 } |
| 2085 |
| 2086 void LayerTreeHostImpl::RecordMainFrameTiming() { |
| 2087 std::vector<int64_t> request_ids; |
| 2088 active_tree_->GatherFrameTimingRequestIds(&request_ids); |
| 2089 if (request_ids.empty()) |
| 2090 return; |
| 2091 |
| 2092 base::TimeTicks end_time = client_->GetNextBeginImplFrameTimeIfRequested(); |
| 2093 frame_timing_tracker_->SaveMainFrameTimeStamps( |
| 2094 request_ids, main_frame_time_, end_time, |
| 2095 active_tree_->source_frame_number()); |
| 2096 } |
| 2097 |
| 2080 void LayerTreeHostImpl::DestroyTileManager() { | 2098 void LayerTreeHostImpl::DestroyTileManager() { |
| 2081 tile_manager_ = nullptr; | 2099 tile_manager_ = nullptr; |
| 2082 resource_pool_ = nullptr; | 2100 resource_pool_ = nullptr; |
| 2083 staging_resource_pool_ = nullptr; | 2101 staging_resource_pool_ = nullptr; |
| 2084 tile_task_worker_pool_ = nullptr; | 2102 tile_task_worker_pool_ = nullptr; |
| 2085 rasterizer_ = nullptr; | 2103 rasterizer_ = nullptr; |
| 2086 single_thread_synchronous_task_graph_runner_ = nullptr; | 2104 single_thread_synchronous_task_graph_runner_ = nullptr; |
| 2087 } | 2105 } |
| 2088 | 2106 |
| 2089 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { | 2107 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { |
| (...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3450 (*it)->OnSetNeedsRedrawOnImpl(); | 3468 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3451 } | 3469 } |
| 3452 | 3470 |
| 3453 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3471 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
| 3454 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3472 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3455 for (; it != swap_promise_monitor_.end(); it++) | 3473 for (; it != swap_promise_monitor_.end(); it++) |
| 3456 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3474 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
| 3457 } | 3475 } |
| 3458 | 3476 |
| 3459 } // namespace cc | 3477 } // namespace cc |
| OLD | NEW |