| 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> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 9 | 11 |
| 10 namespace { | 12 namespace { |
| 11 ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType( | 13 ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType( |
| 12 cc::SwapPromise::DidNotSwapReason reason) { | 14 cc::SwapPromise::DidNotSwapReason reason) { |
| 13 switch (reason) { | 15 switch (reason) { |
| 14 case cc::SwapPromise::ACTIVATION_FAILS: | 16 case cc::SwapPromise::ACTIVATION_FAILS: |
| 15 case cc::SwapPromise::SWAP_FAILS: | 17 case cc::SwapPromise::SWAP_FAILS: |
| 16 return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT; | 18 return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 39 } | 41 } |
| 40 | 42 |
| 41 void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) { | 43 void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) { |
| 42 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, | 44 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, |
| 43 0); | 45 0); |
| 44 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking | 46 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking |
| 45 // is enabled in GPU side. | 47 // is enabled in GPU side. |
| 46 // DCHECK(latency_.terminated); | 48 // DCHECK(latency_.terminated); |
| 47 } | 49 } |
| 48 | 50 |
| 49 int64 LatencyInfoSwapPromise::TraceId() const { | 51 int64_t LatencyInfoSwapPromise::TraceId() const { |
| 50 return latency_.trace_id(); | 52 return latency_.trace_id(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 // Trace the original LatencyInfo of a LatencyInfoSwapPromise | 55 // Trace the original LatencyInfo of a LatencyInfoSwapPromise |
| 54 void LatencyInfoSwapPromise::OnCommit() { | 56 void LatencyInfoSwapPromise::OnCommit() { |
| 55 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 57 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
| 56 "LatencyInfo.Flow", | 58 "LatencyInfo.Flow", |
| 57 TRACE_ID_DONT_MANGLE(TraceId()), | 59 TRACE_ID_DONT_MANGLE(TraceId()), |
| 58 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 60 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 59 "step", "HandleInputEventMainCommit"); | 61 "step", "HandleInputEventMainCommit"); |
| 60 } | 62 } |
| 61 | 63 |
| 62 } // namespace cc | 64 } // namespace cc |
| OLD | NEW |