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

Side by Side Diff: content/common/discardable_shared_memory_heap.h

Issue 1407483003: Reland of [tracing] Display the locked size of discardable memory segment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 5 #ifndef CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
6 #define CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 6 #define CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/containers/linked_list.h" 10 #include "base/containers/linked_list.h"
(...skipping 12 matching lines...) Expand all
23 // is used to keep track of free blocks. 23 // is used to keep track of free blocks.
24 class CONTENT_EXPORT DiscardableSharedMemoryHeap { 24 class CONTENT_EXPORT DiscardableSharedMemoryHeap {
25 public: 25 public:
26 class CONTENT_EXPORT Span : public base::LinkNode<Span> { 26 class CONTENT_EXPORT Span : public base::LinkNode<Span> {
27 public: 27 public:
28 ~Span(); 28 ~Span();
29 29
30 base::DiscardableSharedMemory* shared_memory() { return shared_memory_; } 30 base::DiscardableSharedMemory* shared_memory() { return shared_memory_; }
31 size_t start() const { return start_; } 31 size_t start() const { return start_; }
32 size_t length() const { return length_; } 32 size_t length() const { return length_; }
33 void set_is_locked(bool is_locked) { is_locked_ = is_locked; }
33 34
34 private: 35 private:
35 friend class DiscardableSharedMemoryHeap; 36 friend class DiscardableSharedMemoryHeap;
36 37
37 Span(base::DiscardableSharedMemory* shared_memory, 38 Span(base::DiscardableSharedMemory* shared_memory,
38 size_t start, 39 size_t start,
39 size_t length); 40 size_t length);
40 41
41 base::DiscardableSharedMemory* shared_memory_; 42 base::DiscardableSharedMemory* shared_memory_;
42 size_t start_; 43 size_t start_;
43 size_t length_; 44 size_t length_;
45 bool is_locked_;
44 46
45 DISALLOW_COPY_AND_ASSIGN(Span); 47 DISALLOW_COPY_AND_ASSIGN(Span);
46 }; 48 };
47 49
48 explicit DiscardableSharedMemoryHeap(size_t block_size); 50 explicit DiscardableSharedMemoryHeap(size_t block_size);
49 ~DiscardableSharedMemoryHeap(); 51 ~DiscardableSharedMemoryHeap();
50 52
51 // Grow heap using |shared_memory| and return a span for this new memory. 53 // Grow heap using |shared_memory| and return a span for this new memory.
52 // |shared_memory| must be aligned to the block size and |size| must be a 54 // |shared_memory| must be aligned to the block size and |size| must be a
53 // multiple of the block size. |deleted_callback| is called when 55 // multiple of the block size. |deleted_callback| is called when
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // is a free list of runs that consist of k blocks. The 256th entry is a 170 // is a free list of runs that consist of k blocks. The 256th entry is a
169 // free list of runs that have length >= 256 blocks. 171 // free list of runs that have length >= 256 blocks.
170 base::LinkedList<Span> free_spans_[256]; 172 base::LinkedList<Span> free_spans_[256];
171 173
172 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap); 174 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap);
173 }; 175 };
174 176
175 } // namespace content 177 } // namespace content
176 178
177 #endif // CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 179 #endif // CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698