OLD | NEW |
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/output/latency_info_swap_promise.h" | 5 #include "cc/output/latency_info_swap_promise.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency) | 31 LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency) |
32 : latency_(latency) { | 32 : latency_(latency) { |
33 } | 33 } |
34 | 34 |
35 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() { | 35 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() { |
36 } | 36 } |
37 | 37 |
38 void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) { | 38 void LatencyInfoSwapPromise::WillSwap(CompositorFrameMetadata* metadata) { |
39 DCHECK(!latency_.terminated()); | 39 DCHECK(!latency_.terminated()); |
40 metadata->latency_info.push_back(latency_); | 40 metadata->latency_info.push_back(latency_); |
41 } | 41 } |
42 | 42 |
| 43 void LatencyInfoSwapPromise::DidSwap() {} |
| 44 |
43 SwapPromise::DidNotSwapAction LatencyInfoSwapPromise::DidNotSwap( | 45 SwapPromise::DidNotSwapAction LatencyInfoSwapPromise::DidNotSwap( |
44 DidNotSwapReason reason) { | 46 DidNotSwapReason reason) { |
45 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, | 47 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, |
46 0); | 48 0); |
47 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking | 49 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking |
48 // is enabled in GPU side. | 50 // is enabled in GPU side. |
49 // DCHECK(latency_.terminated); | 51 // DCHECK(latency_.terminated); |
50 return DidNotSwapAction::BREAK_PROMISE; | 52 return DidNotSwapAction::BREAK_PROMISE; |
51 } | 53 } |
52 | 54 |
53 int64_t LatencyInfoSwapPromise::TraceId() const { | 55 int64_t LatencyInfoSwapPromise::TraceId() const { |
54 return latency_.trace_id(); | 56 return latency_.trace_id(); |
55 } | 57 } |
56 | 58 |
57 // Trace the original LatencyInfo of a LatencyInfoSwapPromise | 59 // Trace the original LatencyInfo of a LatencyInfoSwapPromise |
58 void LatencyInfoSwapPromise::OnCommit() { | 60 void LatencyInfoSwapPromise::OnCommit() { |
59 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 61 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
60 "LatencyInfo.Flow", | 62 "LatencyInfo.Flow", |
61 TRACE_ID_DONT_MANGLE(TraceId()), | 63 TRACE_ID_DONT_MANGLE(TraceId()), |
62 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 64 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
63 "step", "HandleInputEventMainCommit"); | 65 "step", "HandleInputEventMainCommit"); |
64 } | 66 } |
65 | 67 |
66 } // namespace cc | 68 } // namespace cc |
OLD | NEW |