GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / cc / debug / paint_time_counter.cc
blob41ef1a334a6a19b8e100ec51a016e99e5f63874f
1 // Copyright 2012 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/debug/paint_time_counter.h"
7 namespace cc {
9 // static
10 scoped_ptr<PaintTimeCounter> PaintTimeCounter::Create() {
11 return make_scoped_ptr(new PaintTimeCounter());
14 PaintTimeCounter::PaintTimeCounter() {
17 void PaintTimeCounter::SavePaintTime(const base::TimeDelta& paint_time) {
18 ring_buffer_.SaveToBuffer(paint_time);
21 void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
22 base::TimeDelta* max) const {
23 *min = base::TimeDelta::FromDays(1);
24 *max = base::TimeDelta();
26 for (RingBufferType::Iterator it = ring_buffer_.Begin(); it; ++it) {
27 const base::TimeDelta paint_time = **it;
29 if (paint_time < *min)
30 *min = paint_time;
31 if (paint_time > *max)
32 *max = paint_time;
35 if (*min > *max)
36 *min = *max;
39 void PaintTimeCounter::ClearHistory() {
40 ring_buffer_.Clear();
43 } // namespace cc