Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 914403003: cc: Add main frame timing info to frame timing tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_)
296 output_surface_->ForceReclaimResources(); 297 output_surface_->ForceReclaimResources();
297 298
298 if (settings_.impl_side_painting && !proxy_->CommitToActiveTree()) 299 if (settings_.impl_side_painting && !proxy_->CommitToActiveTree())
299 CreatePendingTree(); 300 CreatePendingTree();
300 } 301 }
301 302
302 void LayerTreeHostImpl::CommitComplete() { 303 void LayerTreeHostImpl::CommitComplete() {
303 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 304 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
304 305
305 sync_tree()->set_needs_update_draw_properties(); 306 sync_tree()->set_needs_update_draw_properties();
306 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
307 if (settings_.impl_side_painting) { 313 if (settings_.impl_side_painting) {
308 // 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
309 // opportunity to create tilings. Other paths can call UpdateDrawProperties 315 // opportunity to create tilings. Other paths can call UpdateDrawProperties
310 // more lazily when needed prior to drawing. Because invalidations may 316 // more lazily when needed prior to drawing. Because invalidations may
311 // be coming from the main thread, it's safe to do an update for lcd text 317 // be coming from the main thread, it's safe to do an update for lcd text
312 // at this point and see if lcd text needs to be disabled on any layers. 318 // at this point and see if lcd text needs to be disabled on any layers.
313 bool update_lcd_text = true; 319 bool update_lcd_text = true;
314 sync_tree()->UpdateDrawProperties(update_lcd_text); 320 sync_tree()->UpdateDrawProperties(update_lcd_text);
315 // Start working on newly created tiles immediately if needed. 321 // Start working on newly created tiles immediately if needed.
316 if (tile_manager_ && tile_priorities_dirty_) 322 if (tile_manager_ && tile_priorities_dirty_)
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 // Now that we've synced everything from the pending tree to the active 1797 // Now that we've synced everything from the pending tree to the active
1792 // tree, rename the pending tree the recycle tree so we can reuse it on the 1798 // tree, rename the pending tree the recycle tree so we can reuse it on the
1793 // next sync. 1799 // next sync.
1794 DCHECK(!recycle_tree_); 1800 DCHECK(!recycle_tree_);
1795 pending_tree_.swap(recycle_tree_); 1801 pending_tree_.swap(recycle_tree_);
1796 1802
1797 active_tree_->SetRootLayerScrollOffsetDelegate( 1803 active_tree_->SetRootLayerScrollOffsetDelegate(
1798 root_layer_scroll_offset_delegate_); 1804 root_layer_scroll_offset_delegate_);
1799 1805
1800 UpdateViewportContainerSizes(); 1806 UpdateViewportContainerSizes();
1807
1808 // If we had a pending tree, now is when we should record main frame timing
1809 // information.
1810 RecordMainFrameTiming();
1801 } else { 1811 } else {
1802 active_tree_->ProcessUIResourceRequestQueue(); 1812 active_tree_->ProcessUIResourceRequestQueue();
1803 } 1813 }
1804 1814
1805 active_tree_->DidBecomeActive(); 1815 active_tree_->DidBecomeActive();
1806 ActivateAnimations(); 1816 ActivateAnimations();
1807 if (settings_.impl_side_painting) { 1817 if (settings_.impl_side_painting) {
1808 client_->RenewTreePriority(); 1818 client_->RenewTreePriority();
1809 // If we have any picture layers, then by activating we also modified tile 1819 // If we have any picture layers, then by activating we also modified tile
1810 // priorities. 1820 // priorities.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 *resource_pool = ResourcePool::Create( 2075 *resource_pool = ResourcePool::Create(
2066 resource_provider_.get(), GL_TEXTURE_2D); 2076 resource_provider_.get(), GL_TEXTURE_2D);
2067 2077
2068 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( 2078 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
2069 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, 2079 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider,
2070 resource_provider_.get(), 2080 resource_provider_.get(),
2071 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), 2081 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(),
2072 settings_.renderer_settings.refresh_rate)); 2082 settings_.renderer_settings.refresh_rate));
2073 } 2083 }
2074 2084
2085 void LayerTreeHostImpl::SetBeginMainFrameTime(base::TimeTicks frame_time) {
2086 main_frame_time_ = frame_time;
2087 }
2088
2089 void LayerTreeHostImpl::RecordMainFrameTiming() {
2090 std::vector<int64_t> request_ids;
2091 active_tree_->GatherFrameTimingRequestIds(&request_ids);
2092 if (request_ids.empty())
2093 return;
2094
2095 base::TimeTicks end_time = client_->GetNextBeginImplFrameTimeIfRequested();
enne (OOO) 2015/03/06 00:00:57 Maybe I just don't understand the spec, but what i
2096 frame_timing_tracker_->SaveMainFrameTimeStamps(
2097 request_ids, main_frame_time_, end_time,
2098 active_tree_->source_frame_number());
2099 }
2100
2075 void LayerTreeHostImpl::DestroyTileManager() { 2101 void LayerTreeHostImpl::DestroyTileManager() {
2076 tile_manager_ = nullptr; 2102 tile_manager_ = nullptr;
2077 resource_pool_ = nullptr; 2103 resource_pool_ = nullptr;
2078 staging_resource_pool_ = nullptr; 2104 staging_resource_pool_ = nullptr;
2079 tile_task_worker_pool_ = nullptr; 2105 tile_task_worker_pool_ = nullptr;
2080 rasterizer_ = nullptr; 2106 rasterizer_ = nullptr;
2081 single_thread_synchronous_task_graph_runner_ = nullptr; 2107 single_thread_synchronous_task_graph_runner_ = nullptr;
2082 } 2108 }
2083 2109
2084 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { 2110 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const {
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3462 (*it)->OnSetNeedsRedrawOnImpl(); 3488 (*it)->OnSetNeedsRedrawOnImpl();
3463 } 3489 }
3464 3490
3465 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3491 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3466 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3492 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3467 for (; it != swap_promise_monitor_.end(); it++) 3493 for (; it != swap_promise_monitor_.end(); it++)
3468 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3494 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3469 } 3495 }
3470 3496
3471 } // namespace cc 3497 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698