OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_RESOURCES_MEMORY_HISTORY_H_ | 5 #ifndef CC_RESOURCES_MEMORY_HISTORY_H_ |
6 #define CC_RESOURCES_MEMORY_HISTORY_H_ | 6 #define CC_RESOURCES_MEMORY_HISTORY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "cc/debug/ring_buffer.h" | 15 #include "cc/debug/ring_buffer.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 // Maintains a history of memory for each frame. | 19 // Maintains a history of memory for each frame. |
19 class MemoryHistory { | 20 class MemoryHistory { |
20 public: | 21 public: |
21 static scoped_ptr<MemoryHistory> Create(); | 22 static std::unique_ptr<MemoryHistory> Create(); |
22 | 23 |
23 size_t HistorySize() const { return ring_buffer_.BufferSize(); } | 24 size_t HistorySize() const { return ring_buffer_.BufferSize(); } |
24 | 25 |
25 struct Entry { | 26 struct Entry { |
26 Entry() | 27 Entry() |
27 : total_budget_in_bytes(0), | 28 : total_budget_in_bytes(0), |
28 total_bytes_used(0), | 29 total_bytes_used(0), |
29 had_enough_memory(false) {} | 30 had_enough_memory(false) {} |
30 | 31 |
31 size_t total_budget_in_bytes; | 32 size_t total_budget_in_bytes; |
(...skipping 11 matching lines...) Expand all Loading... |
43 MemoryHistory(); | 44 MemoryHistory(); |
44 | 45 |
45 RingBufferType ring_buffer_; | 46 RingBufferType ring_buffer_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(MemoryHistory); | 48 DISALLOW_COPY_AND_ASSIGN(MemoryHistory); |
48 }; | 49 }; |
49 | 50 |
50 } // namespace cc | 51 } // namespace cc |
51 | 52 |
52 #endif // CC_RESOURCES_MEMORY_HISTORY_H_ | 53 #endif // CC_RESOURCES_MEMORY_HISTORY_H_ |
OLD | NEW |