Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: cc/resources/memory_history.h

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/memory_history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "cc/debug/ring_buffer.h" 11 #include "cc/debug/ring_buffer.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 // Maintains a history of memory for each frame. 15 // Maintains a history of memory for each frame.
16 class MemoryHistory { 16 class MemoryHistory {
17 public: 17 public:
18 static scoped_ptr<MemoryHistory> Create(); 18 static scoped_ptr<MemoryHistory> Create();
19 19
20 size_t HistorySize() const { return ring_buffer_.BufferSize(); } 20 size_t HistorySize() const { return ring_buffer_.BufferSize(); }
21 21
22 struct Entry { 22 struct Entry {
23 Entry() 23 Entry()
24 : total_budget_in_bytes(0), 24 : total_budget_in_bytes(0),
25 bytes_allocated(0), 25 total_bytes_used(0),
26 bytes_unreleasable(0), 26 had_enough_memory(false) {}
27 bytes_over(0) {}
28 27
29 size_t total_budget_in_bytes; 28 size_t total_budget_in_bytes;
30 size_t bytes_allocated; 29 size_t total_bytes_used;
31 size_t bytes_unreleasable; 30 bool had_enough_memory;
32 size_t bytes_over;
33 size_t bytes_total() const {
34 return bytes_allocated + bytes_unreleasable + bytes_over;
35 }
36 }; 31 };
37 32
38 void SaveEntry(const Entry& entry); 33 void SaveEntry(const Entry& entry);
39 void GetMinAndMax(size_t* min, size_t* max) const; 34 void GetMinAndMax(size_t* min, size_t* max) const;
40 35
41 typedef RingBuffer<Entry, 80> RingBufferType; 36 typedef RingBuffer<Entry, 80> RingBufferType;
42 RingBufferType::Iterator Begin() const { return ring_buffer_.Begin(); } 37 RingBufferType::Iterator Begin() const { return ring_buffer_.Begin(); }
43 RingBufferType::Iterator End() const { return ring_buffer_.End(); } 38 RingBufferType::Iterator End() const { return ring_buffer_.End(); }
44 39
45 private: 40 private:
46 MemoryHistory(); 41 MemoryHistory();
47 42
48 RingBufferType ring_buffer_; 43 RingBufferType ring_buffer_;
49 44
50 DISALLOW_COPY_AND_ASSIGN(MemoryHistory); 45 DISALLOW_COPY_AND_ASSIGN(MemoryHistory);
51 }; 46 };
52 47
53 } // namespace cc 48 } // namespace cc
54 49
55 #endif // CC_RESOURCES_MEMORY_HISTORY_H_ 50 #endif // CC_RESOURCES_MEMORY_HISTORY_H_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/memory_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698