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/memory_history.h"
10 scoped_ptr
<MemoryHistory
> MemoryHistory::create() {
11 return make_scoped_ptr(new MemoryHistory());
14 MemoryHistory::MemoryHistory() {
17 void MemoryHistory::SaveEntry(const MemoryHistory::Entry
& entry
) {
18 ring_buffer_
.SaveToBuffer(entry
);
21 void MemoryHistory::GetMinAndMax(size_t* min
, size_t* max
) const {
22 *min
= std::numeric_limits
<size_t>::max();
25 for (RingBufferType::Iterator it
= ring_buffer_
.Begin(); it
; ++it
) {
26 size_t bytes_total
= it
->bytes_total();
28 if (bytes_total
< *min
)
30 if (bytes_total
> *max
)