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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 | 298 |
299 if (UsePendingTreeForSync()) | 299 if (UsePendingTreeForSync()) |
300 CreatePendingTree(); | 300 CreatePendingTree(); |
301 } | 301 } |
302 | 302 |
303 void LayerTreeHostImpl::CommitComplete() { | 303 void LayerTreeHostImpl::CommitComplete() { |
304 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 304 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
305 | 305 |
306 sync_tree()->set_needs_update_draw_properties(); | 306 sync_tree()->set_needs_update_draw_properties(); |
307 | 307 |
308 // If we don't have a pending tree, it means we've committed directly to the | |
309 // active tree. In that case, record frame timing information immediately. | |
310 if (!pending_tree_) | |
311 RecordMainFrameTiming(); | |
312 | |
308 if (settings_.impl_side_painting) { | 313 if (settings_.impl_side_painting) { |
309 // Impl-side painting needs an update immediately post-commit to have the | 314 // Impl-side painting needs an update immediately post-commit to have the |
310 // opportunity to create tilings. Other paths can call UpdateDrawProperties | 315 // opportunity to create tilings. Other paths can call UpdateDrawProperties |
311 // more lazily when needed prior to drawing. | 316 // more lazily when needed prior to drawing. |
312 sync_tree()->UpdateDrawProperties(); | 317 sync_tree()->UpdateDrawProperties(); |
313 // Start working on newly created tiles immediately if needed. | 318 // Start working on newly created tiles immediately if needed. |
314 if (tile_manager_ && tile_priorities_dirty_) | 319 if (tile_manager_ && tile_priorities_dirty_) |
315 PrepareTiles(); | 320 PrepareTiles(); |
316 else | 321 else |
317 NotifyReadyToActivate(); | 322 NotifyReadyToActivate(); |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1793 // Now that we've synced everything from the pending tree to the active | 1798 // Now that we've synced everything from the pending tree to the active |
1794 // tree, rename the pending tree the recycle tree so we can reuse it on the | 1799 // tree, rename the pending tree the recycle tree so we can reuse it on the |
1795 // next sync. | 1800 // next sync. |
1796 DCHECK(!recycle_tree_); | 1801 DCHECK(!recycle_tree_); |
1797 pending_tree_.swap(recycle_tree_); | 1802 pending_tree_.swap(recycle_tree_); |
1798 | 1803 |
1799 active_tree_->SetRootLayerScrollOffsetDelegate( | 1804 active_tree_->SetRootLayerScrollOffsetDelegate( |
1800 root_layer_scroll_offset_delegate_); | 1805 root_layer_scroll_offset_delegate_); |
1801 | 1806 |
1802 UpdateViewportContainerSizes(); | 1807 UpdateViewportContainerSizes(); |
1808 | |
1809 // If we had a pending tree, now is when we should record main frame timing | |
1810 // information. | |
1811 RecordMainFrameTiming(); | |
1803 } else { | 1812 } else { |
1804 active_tree_->ProcessUIResourceRequestQueue(); | 1813 active_tree_->ProcessUIResourceRequestQueue(); |
1805 } | 1814 } |
1806 | 1815 |
1807 active_tree_->DidBecomeActive(); | 1816 active_tree_->DidBecomeActive(); |
1808 ActivateAnimations(); | 1817 ActivateAnimations(); |
1809 if (settings_.impl_side_painting) { | 1818 if (settings_.impl_side_painting) { |
1810 client_->RenewTreePriority(); | 1819 client_->RenewTreePriority(); |
1811 // If we have any picture layers, then by activating we also modified tile | 1820 // If we have any picture layers, then by activating we also modified tile |
1812 // priorities. | 1821 // priorities. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2067 *resource_pool = ResourcePool::Create( | 2076 *resource_pool = ResourcePool::Create( |
2068 resource_provider_.get(), GL_TEXTURE_2D); | 2077 resource_provider_.get(), GL_TEXTURE_2D); |
2069 | 2078 |
2070 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( | 2079 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( |
2071 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, | 2080 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, |
2072 resource_provider_.get(), | 2081 resource_provider_.get(), |
2073 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), | 2082 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), |
2074 settings_.renderer_settings.refresh_rate)); | 2083 settings_.renderer_settings.refresh_rate)); |
2075 } | 2084 } |
2076 | 2085 |
2086 void LayerTreeHostImpl::SetBeginMainFrameTime(base::TimeTicks frame_time) { | |
2087 main_frame_time_ = frame_time; | |
2088 } | |
2089 | |
2090 void LayerTreeHostImpl::RecordMainFrameTiming() { | |
2091 std::vector<int64_t> request_ids; | |
2092 active_tree_->GatherFrameTimingRequestIds(&request_ids); | |
2093 if (request_ids.empty()) | |
2094 return; | |
2095 | |
2096 base::TimeDelta frame_duration = | |
2097 client_->GetNextBeginImplFrameTimeIfRequested() - main_frame_time_; | |
enne (OOO)
2015/02/12 23:41:07
So for SingleThreadProxy this will always be negat
vmpstr
2015/03/03 18:56:46
I changed this to use the same value. As far as I
enne (OOO)
2015/03/06 21:27:55
Oh. I figured that requests were coming from Java
| |
2098 frame_timing_tracker_->SaveMainFrameTimeStamps( | |
2099 request_ids, main_frame_time_, frame_duration, | |
2100 active_tree_->source_frame_number()); | |
2101 } | |
2102 | |
2077 void LayerTreeHostImpl::DestroyTileManager() { | 2103 void LayerTreeHostImpl::DestroyTileManager() { |
2078 tile_manager_ = nullptr; | 2104 tile_manager_ = nullptr; |
2079 resource_pool_ = nullptr; | 2105 resource_pool_ = nullptr; |
2080 staging_resource_pool_ = nullptr; | 2106 staging_resource_pool_ = nullptr; |
2081 tile_task_worker_pool_ = nullptr; | 2107 tile_task_worker_pool_ = nullptr; |
2082 rasterizer_ = nullptr; | 2108 rasterizer_ = nullptr; |
2083 single_thread_synchronous_task_graph_runner_ = nullptr; | 2109 single_thread_synchronous_task_graph_runner_ = nullptr; |
2084 } | 2110 } |
2085 | 2111 |
2086 bool LayerTreeHostImpl::UsePendingTreeForSync() const { | 2112 bool LayerTreeHostImpl::UsePendingTreeForSync() const { |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3485 (*it)->OnSetNeedsRedrawOnImpl(); | 3511 (*it)->OnSetNeedsRedrawOnImpl(); |
3486 } | 3512 } |
3487 | 3513 |
3488 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3514 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
3489 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3515 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3490 for (; it != swap_promise_monitor_.end(); it++) | 3516 for (; it != swap_promise_monitor_.end(); it++) |
3491 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3517 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
3492 } | 3518 } |
3493 | 3519 |
3494 } // namespace cc | 3520 } // namespace cc |
OLD | NEW |