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

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

Issue 952273005: content: Update crash key and discardable memory usage counter in child process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 <bitset> 8 #include <bitset>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Split an allocated span into two spans, one of length |blocks| followed 62 // Split an allocated span into two spans, one of length |blocks| followed
63 // by another span of length "span->length - blocks" blocks. Modifies |span| 63 // by another span of length "span->length - blocks" blocks. Modifies |span|
64 // to point to the first span of length |blocks|. Return second span. 64 // to point to the first span of length |blocks|. Return second span.
65 scoped_ptr<Span> Split(Span* span, size_t blocks); 65 scoped_ptr<Span> Split(Span* span, size_t blocks);
66 66
67 // Search free list for span that satisfies the request for |blocks| of 67 // Search free list for span that satisfies the request for |blocks| of
68 // memory. If found, the span is removed from the free list and returned. 68 // memory. If found, the span is removed from the free list and returned.
69 scoped_ptr<Span> SearchFreeList(size_t blocks); 69 scoped_ptr<Span> SearchFreeList(size_t blocks);
70 70
71 // Release shared memory segments that have been purged. 71 // Release shared memory segments that have been purged. Returns bytes of
72 void ReleaseFreeMemory(); 72 // memory that were released.
73 size_t ReleaseFreeMemory();
73 74
74 private: 75 private:
75 scoped_ptr<Span> RemoveFromFreeList(Span* span); 76 scoped_ptr<Span> RemoveFromFreeList(Span* span);
76 scoped_ptr<Span> Carve(Span* span, size_t blocks); 77 scoped_ptr<Span> Carve(Span* span, size_t blocks);
77 void RegisterSpan(Span* span); 78 void RegisterSpan(Span* span);
78 void UnregisterSpan(Span* span); 79 void UnregisterSpan(Span* span);
79 void ReleaseMemory(base::DiscardableSharedMemory* shared_memory); 80 void ReleaseMemory(base::DiscardableSharedMemory* shared_memory);
80 81
81 size_t block_size_; 82 size_t block_size_;
82 83
83 // Discardable shared memory instances. 84 // Discardable shared memory instances.
84 ScopedVector<base::DiscardableSharedMemory> shared_memory_segments_; 85 ScopedVector<base::DiscardableSharedMemory> shared_memory_segments_;
85 86
86 // Mapping from first/last block of span to Span instance. 87 // Mapping from first/last block of span to Span instance.
87 typedef base::hash_map<size_t, Span*> SpanMap; 88 typedef base::hash_map<size_t, Span*> SpanMap;
88 SpanMap spans_; 89 SpanMap spans_;
89 90
90 // Linked-list of free discardable memory regions. 91 // Linked-list of free discardable memory regions.
91 base::LinkedList<Span> free_spans_; 92 base::LinkedList<Span> free_spans_;
92 93
93 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap); 94 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap);
94 }; 95 };
95 96
96 } // namespace content 97 } // namespace content
97 98
98 #endif // CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 99 #endif // CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
OLDNEW
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.cc ('k') | content/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698