Disable flaky SelectFileDialogExtensionBrowserTest tests
[chromium-blink-merge.git] / cc / output / latency_info_swap_promise.cc
blob3c0716294adf3a99e1cf3fab4ba0350d42aea931
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.
5 #include "cc/output/latency_info_swap_promise.h"
7 #include "base/logging.h"
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::COMMIT_NO_UPDATE:
19 return ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT;
21 NOTREACHED() << "Unhandled DidNotSwapReason.";
22 return ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT;
24 } // namespace
26 namespace cc {
28 LatencyInfoSwapPromise::LatencyInfoSwapPromise(const ui::LatencyInfo& latency)
29 : latency_(latency) {
32 LatencyInfoSwapPromise::~LatencyInfoSwapPromise() {
35 void LatencyInfoSwapPromise::DidSwap(CompositorFrameMetadata* metadata) {
36 DCHECK(!latency_.terminated);
37 metadata->latency_info.push_back(latency_);
40 void LatencyInfoSwapPromise::DidNotSwap(DidNotSwapReason reason) {
41 latency_.AddLatencyNumber(DidNotSwapReasonToLatencyComponentType(reason), 0,
42 0);
43 // TODO(miletus): Turn this back on once per-event LatencyInfo tracking
44 // is enabled in GPU side.
45 // DCHECK(latency_.terminated);
48 int64 LatencyInfoSwapPromise::TraceId() const {
49 return latency_.trace_id;
52 } // namespace cc