| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "cc/memory_history.h" | |
| 6 | |
| 7 namespace cc { | |
| 8 | |
| 9 // static | |
| 10 scoped_ptr<MemoryHistory> MemoryHistory::Create() { | |
| 11 return make_scoped_ptr(new MemoryHistory()); | |
| 12 } | |
| 13 | |
| 14 MemoryHistory::MemoryHistory() {} | |
| 15 | |
| 16 void MemoryHistory::SaveEntry(const MemoryHistory::Entry& entry) { | |
| 17 ring_buffer_.SaveToBuffer(entry); | |
| 18 } | |
| 19 | |
| 20 void MemoryHistory::GetMinAndMax(size_t* min, size_t* max) const { | |
| 21 *min = std::numeric_limits<size_t>::max(); | |
| 22 *max = 0; | |
| 23 | |
| 24 for (RingBufferType::Iterator it = ring_buffer_.Begin(); it; ++it) { | |
| 25 size_t bytes_total = it->bytes_total(); | |
| 26 | |
| 27 if (bytes_total < *min) | |
| 28 *min = bytes_total; | |
| 29 if (bytes_total > *max) | |
| 30 *max = bytes_total; | |
| 31 } | |
| 32 | |
| 33 if (*min > *max) | |
| 34 *min = *max; | |
| 35 } | |
| 36 | |
| 37 } // namespace cc | |
| OLD | NEW |