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

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

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. Created 3 years, 7 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 | « no previous file | base/memory/discardable_shared_memory_unittest.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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Returns true if memory is still resident. 116 // Returns true if memory is still resident.
117 bool IsMemoryResident() const; 117 bool IsMemoryResident() const;
118 118
119 // Returns true if memory is locked. 119 // Returns true if memory is locked.
120 bool IsMemoryLocked() const; 120 bool IsMemoryLocked() const;
121 121
122 // Closes the open discardable memory segment. 122 // Closes the open discardable memory segment.
123 // It is safe to call Close repeatedly. 123 // It is safe to call Close repeatedly.
124 void Close(); 124 void Close();
125 125
126 // Shares the discardable memory segment to another process. Attempts to
127 // create a platform-specific |new_handle| which can be used in a remote
128 // process to access the discardable memory segment. |new_handle| is an
129 // output parameter to receive the handle for use in the remote process.
130 // Returns true on success, false otherwise.
131 bool ShareToProcess(ProcessHandle process_handle,
132 SharedMemoryHandle* new_handle) {
133 return shared_memory_.ShareToProcess(process_handle, new_handle);
134 }
135
136 private: 126 private:
137 // Virtual for tests. 127 // Virtual for tests.
138 virtual Time Now() const; 128 virtual Time Now() const;
139 129
140 SharedMemory shared_memory_; 130 SharedMemory shared_memory_;
141 size_t mapped_size_; 131 size_t mapped_size_;
142 size_t locked_page_count_; 132 size_t locked_page_count_;
143 #if DCHECK_IS_ON() 133 #if DCHECK_IS_ON()
144 std::set<size_t> locked_pages_; 134 std::set<size_t> locked_pages_;
145 #endif 135 #endif
146 // Implementation is not thread-safe but still usable if clients are 136 // Implementation is not thread-safe but still usable if clients are
147 // synchronized somehow. Use a collision warner to detect incorrect usage. 137 // synchronized somehow. Use a collision warner to detect incorrect usage.
148 DFAKE_MUTEX(thread_collision_warner_); 138 DFAKE_MUTEX(thread_collision_warner_);
149 Time last_known_usage_; 139 Time last_known_usage_;
150 140
151 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); 141 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory);
152 }; 142 };
153 143
154 } // namespace base 144 } // namespace base
155 145
156 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 146 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/discardable_shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698