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

Side by Side Diff: base/shared_memory.h

Issue 21222: Fix a browser crash when the async resource handler keeps an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/renderer_host/async_resource_handler.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_SHARED_MEMORY_H_ 5 #ifndef BASE_SHARED_MEMORY_H_
6 #define BASE_SHARED_MEMORY_H_ 6 #define BASE_SHARED_MEMORY_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Returns true on success, false otherwise. 106 // Returns true on success, false otherwise.
107 bool ShareToProcess(base::ProcessHandle process, 107 bool ShareToProcess(base::ProcessHandle process,
108 SharedMemoryHandle* new_handle) { 108 SharedMemoryHandle* new_handle) {
109 return ShareToProcessCommon(process, new_handle, false); 109 return ShareToProcessCommon(process, new_handle, false);
110 } 110 }
111 111
112 // Logically equivalent to: 112 // Logically equivalent to:
113 // bool ok = ShareToProcess(process, new_handle); 113 // bool ok = ShareToProcess(process, new_handle);
114 // Close(); 114 // Close();
115 // return ok; 115 // return ok;
116 // Note that the memory is unmapped by calling this method, regardless of the
117 // return value.
116 bool GiveToProcess(ProcessHandle process, 118 bool GiveToProcess(ProcessHandle process,
117 SharedMemoryHandle* new_handle) { 119 SharedMemoryHandle* new_handle) {
118 return ShareToProcessCommon(process, new_handle, true); 120 return ShareToProcessCommon(process, new_handle, true);
119 } 121 }
120 122
121 // Lock the shared memory. 123 // Lock the shared memory.
122 // This is a cross-process lock which may be recursively 124 // This is a cross-process lock which may be recursively
123 // locked by the same thread. 125 // locked by the same thread.
124 // TODO(port): 126 // TODO(port):
125 // WARNING: on POSIX the lock only works across processes, not 127 // WARNING: on POSIX the lock only works across processes, not
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 172 }
171 173
172 private: 174 private:
173 SharedMemory* shared_memory_; 175 SharedMemory* shared_memory_;
174 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock); 176 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock);
175 }; 177 };
176 178
177 } // namespace base 179 } // namespace base
178 180
179 #endif // BASE_SHARED_MEMORY_H_ 181 #endif // BASE_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/async_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698