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

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

Issue 81533002: Use LatencyInfoSwapPromise to track LatencyInfo through compositor (Closed) Base URL: http://git.chromium.org/chromium/src.git@swap_promise_2
Patch Set: tests added Created 7 years 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.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/base/latency_info_swap_promise.h"
6
7 #include "base/logging.h"
8
9 namespace {
10 ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType(
11 cc::SwapPromise::DidNotSwapReason reason) {
12 switch (reason) {
13 case cc::SwapPromise::DID_NOT_SWAP_UNKNOWN:
14 case cc::SwapPromise::SWAP_FAILS:
15 return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
16 case cc::SwapPromise::COMMIT_FAILS:
17 return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT;
18 case cc::SwapPromise::SWAP_PROMISE_LIST_OVERFLOW:
19 return ui::LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT;
20 default:
21 NOTREACHED() << "Unhandled DidNotSwapReason.";
danakj 2013/11/27 21:21:41 Cool! OK, if this should be a notreached, can you
Yufeng Shen (Slow to review) 2013/11/27 21:28:17 Done.
22 break;
23 }
24 return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
25 }
26 } // namespace
27
28 namespace cc {
29
30 LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
31 : latency_(latency) {
32 }
33
34 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() {
35 }
36
37 void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) {
38 DCHECK(!latency_.terminated);
39 // TODO(mileus): Append the |latency_| into metadata's LatencyInfo list
40 // once we remove LatencyInfo merge in GPU side.
41 metadata->latency_info.MergeWith(latency_);
42 }
43
44 void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) {
45 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason),
46 0, 0);
47 DCHECK(latency_.terminated);
48 }
49
50 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/latency_info_swap_promise.h ('k') | cc/base/swap_promise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698