| 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 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() { | 35 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) { | 38 void LatencyInfoSwapPromise::DidSwap(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::DidNotSwap(DidNotSwapReason reason) { | 43 SwapPromise::DidNotSwapAction LatencyInfoSwapPromise::DidNotSwap( |
| 44 DidNotSwapReason reason) { |
| 44 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, | 45 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0, |
| 45 0); | 46 0); |
| 46 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking | 47 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking |
| 47 // is enabled in GPU side. | 48 // is enabled in GPU side. |
| 48 // DCHECK(latency_.terminated); | 49 // DCHECK(latency_.terminated); |
| 50 return DidNotSwapAction::BREAK_PROMISE; |
| 49 } | 51 } |
| 50 | 52 |
| 51 int64_t LatencyInfoSwapPromise::TraceId() const { | 53 int64_t LatencyInfoSwapPromise::TraceId() const { |
| 52 return latency_.trace_id(); | 54 return latency_.trace_id(); |
| 53 } | 55 } |
| 54 | 56 |
| 55 // Trace the original LatencyInfo of a LatencyInfoSwapPromise | 57 // Trace the original LatencyInfo of a LatencyInfoSwapPromise |
| 56 void LatencyInfoSwapPromise::OnCommit() { | 58 void LatencyInfoSwapPromise::OnCommit() { |
| 57 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 59 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
| 58 "LatencyInfo.Flow", | 60 "LatencyInfo.Flow", |
| 59 TRACE_ID_DONT_MANGLE(TraceId()), | 61 TRACE_ID_DONT_MANGLE(TraceId()), |
| 60 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 62 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 61 "step", "HandleInputEventMainCommit"); | 63 "step", "HandleInputEventMainCommit"); |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace cc | 66 } // namespace cc |
| OLD | NEW |