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

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

Issue 1164473003: Add methods to base::SharedMemory to replace common SharedMemoryHandle operations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add relevant methods to shared_memory_win. Created 5 years, 6 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/shared_memory_posix.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SHARED_MEMORY_H_ 5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_
6 #define BASE_MEMORY_SHARED_MEMORY_H_ 6 #define BASE_MEMORY_SHARED_MEMORY_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <string> 10 #include <string>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Returns invalid handle (see comment above for exact definition). 110 // Returns invalid handle (see comment above for exact definition).
111 static SharedMemoryHandle NULLHandle(); 111 static SharedMemoryHandle NULLHandle();
112 112
113 // Closes a shared memory handle. 113 // Closes a shared memory handle.
114 static void CloseHandle(const SharedMemoryHandle& handle); 114 static void CloseHandle(const SharedMemoryHandle& handle);
115 115
116 // Returns the maximum number of handles that can be open at once per process. 116 // Returns the maximum number of handles that can be open at once per process.
117 static size_t GetHandleLimit(); 117 static size_t GetHandleLimit();
118 118
119 // The copy shares the same underlying OS primitives. The new
120 // SharedMemoryHandle will not clean up the OS primitives when destroyed. The
121 // original must outlive the copy.
122 static SharedMemoryHandle ShallowCopyHandle(const SharedMemoryHandle& handle);
123
124 #if defined(OS_POSIX)
125 // The underlying OS primitives are duplicated.
126 // |clean_up_resources_on_destruction| indicates whether the underlying OS
127 // primitives are cleaned up on destruction.
128 static SharedMemoryHandle DeepCopyHandle(
129 const SharedMemoryHandle& handle,
130 bool clean_up_resources_on_destruction);
131 #endif
132
119 // Creates a shared memory object as described by the options struct. 133 // Creates a shared memory object as described by the options struct.
120 // Returns true on success and false on failure. 134 // Returns true on success and false on failure.
121 bool Create(const SharedMemoryCreateOptions& options); 135 bool Create(const SharedMemoryCreateOptions& options);
122 136
123 // Creates and maps an anonymous shared memory segment of size size. 137 // Creates and maps an anonymous shared memory segment of size size.
124 // Returns true on success and false on failure. 138 // Returns true on success and false on failure.
125 bool CreateAndMapAnonymous(size_t size); 139 bool CreateAndMapAnonymous(size_t size);
126 140
127 // Creates an anonymous shared memory segment of size size. 141 // Creates an anonymous shared memory segment of size size.
128 // Returns true on success and false on failure. 142 // Returns true on success and false on failure.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 331 }
318 332
319 private: 333 private:
320 SharedMemory* shared_memory_; 334 SharedMemory* shared_memory_;
321 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated); 335 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated);
322 }; 336 };
323 337
324 } // namespace base 338 } // namespace base
325 339
326 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 340 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698