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 #ifndef CC_RESOURCES_MEMORY_HISTORY_H_
6 #define CC_RESOURCES_MEMORY_HISTORY_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
11 #include "cc/debug/ring_buffer.h"
15 // Maintains a history of memory for each frame.
18 static scoped_ptr
<MemoryHistory
> Create();
20 size_t HistorySize() const { return ring_buffer_
.BufferSize(); }
24 : total_budget_in_bytes(0),
26 had_enough_memory(false) {}
28 size_t total_budget_in_bytes
;
29 int64 total_bytes_used
;
30 bool had_enough_memory
;
33 void SaveEntry(const Entry
& entry
);
35 typedef RingBuffer
<Entry
, 80> RingBufferType
;
36 RingBufferType::Iterator
Begin() const { return ring_buffer_
.Begin(); }
37 RingBufferType::Iterator
End() const { return ring_buffer_
.End(); }
42 RingBufferType ring_buffer_
;
44 DISALLOW_COPY_AND_ASSIGN(MemoryHistory
);
49 #endif // CC_RESOURCES_MEMORY_HISTORY_H_