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

Side by Side Diff: base/memory/discardable_shared_memory.h

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « base/mac/scoped_sending_event_unittest.mm ('k') | base/memory/discardable_shared_memory.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 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 BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/threading/thread_collision_warner.h" 11 #include "base/threading/thread_collision_warner.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 #if DCHECK_IS_ON 14 #if DCHECK_IS_ON()
15 #include <set> 15 #include <set>
16 #endif 16 #endif
17 17
18 namespace base { 18 namespace base {
19 19
20 // Platform abstraction for discardable shared memory. 20 // Platform abstraction for discardable shared memory.
21 // 21 //
22 // This class is not thread-safe. Clients are responsible for synchronizing 22 // This class is not thread-safe. Clients are responsible for synchronizing
23 // access to an instance of this class. 23 // access to an instance of this class.
24 class BASE_EXPORT DiscardableSharedMemory { 24 class BASE_EXPORT DiscardableSharedMemory {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return shared_memory_.ShareToProcess(process_handle, new_handle); 112 return shared_memory_.ShareToProcess(process_handle, new_handle);
113 } 113 }
114 114
115 private: 115 private:
116 // Virtual for tests. 116 // Virtual for tests.
117 virtual Time Now() const; 117 virtual Time Now() const;
118 118
119 SharedMemory shared_memory_; 119 SharedMemory shared_memory_;
120 size_t mapped_size_; 120 size_t mapped_size_;
121 size_t locked_page_count_; 121 size_t locked_page_count_;
122 #if DCHECK_IS_ON 122 #if DCHECK_IS_ON()
123 std::set<size_t> locked_pages_; 123 std::set<size_t> locked_pages_;
124 #endif 124 #endif
125 // Implementation is not thread-safe but still usable if clients are 125 // Implementation is not thread-safe but still usable if clients are
126 // synchronized somehow. Use a collision warner to detect incorrect usage. 126 // synchronized somehow. Use a collision warner to detect incorrect usage.
127 DFAKE_MUTEX(thread_collision_warner_); 127 DFAKE_MUTEX(thread_collision_warner_);
128 Time last_known_usage_; 128 Time last_known_usage_;
129 129
130 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); 130 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory);
131 }; 131 };
132 132
133 } // namespace base 133 } // namespace base
134 134
135 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 135 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_sending_event_unittest.mm ('k') | base/memory/discardable_shared_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698