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

Side by Side Diff: cc/base/latency_info_swap_promise_monitor.cc

Issue 400533006: Revert "Implement scroll handler latency tracking" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « cc/base/latency_info_swap_promise_monitor.h ('k') | cc/base/swap_promise.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/latency_info_swap_promise_monitor.h" 5 #include "cc/base/latency_info_swap_promise_monitor.h"
6 6
7 #include "cc/base/latency_info_swap_promise.h" 7 #include "cc/base/latency_info_swap_promise.h"
8 #include "cc/trees/layer_tree_host.h" 8 #include "cc/trees/layer_tree_host.h"
9 #include "cc/trees/layer_tree_host_impl.h" 9 #include "cc/trees/layer_tree_host_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
11 11
12 namespace {
13
14 bool AddRenderingScheduledComponent(ui::LatencyInfo* latency_info) {
15 if (latency_info->FindLatency(
16 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0))
17 return false;
18 latency_info->AddLatencyNumber(
19 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0);
20 return true;
21 }
22
23 } // namespace
24
25 namespace cc { 12 namespace cc {
26 13
27 LatencyInfoSwapPromiseMonitor::LatencyInfoSwapPromiseMonitor( 14 LatencyInfoSwapPromiseMonitor::LatencyInfoSwapPromiseMonitor(
28 ui::LatencyInfo* latency, 15 ui::LatencyInfo* latency,
29 LayerTreeHost* layer_tree_host, 16 LayerTreeHost* layer_tree_host,
30 LayerTreeHostImpl* layer_tree_host_impl) 17 LayerTreeHostImpl* layer_tree_host_impl)
31 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl), 18 : SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
32 latency_(latency) {} 19 latency_(latency) {}
33 20
34 LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {} 21 LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {}
35 22
36 void LatencyInfoSwapPromiseMonitor::OnSetNeedsCommitOnMain() { 23 void LatencyInfoSwapPromiseMonitor::OnSetNeedsCommitOnMain() {
37 if (AddRenderingScheduledComponent(latency_)) { 24 if (!latency_->FindLatency(
25 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0)) {
26 latency_->AddLatencyNumber(
27 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0);
38 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_)); 28 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_));
39 layer_tree_host_->QueueSwapPromise(swap_promise.Pass()); 29 layer_tree_host_->QueueSwapPromise(swap_promise.Pass());
40 } 30 }
41 } 31 }
42 32
43 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { 33 void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() {
44 if (AddRenderingScheduledComponent(latency_)) { 34 if (!latency_->FindLatency(
35 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0)) {
36 latency_->AddLatencyNumber(
37 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, 0);
45 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_)); 38 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_));
46 layer_tree_host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass()); 39 layer_tree_host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass());
47 } 40 }
48 } 41 }
49 42
50 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() {
51 if (AddRenderingScheduledComponent(latency_)) {
52 scoped_ptr<SwapPromise> swap_promise(new LatencyInfoSwapPromise(*latency_));
53 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
54 swap_promise.Pass());
55 }
56 }
57
58 } // namespace cc 43 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/latency_info_swap_promise_monitor.h ('k') | cc/base/swap_promise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698