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

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

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Implement buckets Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_HANDLE_H_ 5 #ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ 6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Whether passing this object as a parameter to an IPC message passes 179 // Whether passing this object as a parameter to an IPC message passes
180 // ownership of |memory_object_| to the IPC stack. This is meant to mimic 180 // ownership of |memory_object_| to the IPC stack. This is meant to mimic
181 // the behavior of the |auto_close| parameter of FileDescriptor. 181 // the behavior of the |auto_close| parameter of FileDescriptor.
182 // Defaults to |false|. 182 // Defaults to |false|.
183 bool ownership_passes_to_ipc_; 183 bool ownership_passes_to_ipc_;
184 }; 184 };
185 }; 185 };
186 }; 186 };
187 #endif 187 #endif
188 188
189 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS))
190 struct SharedMemoryHandleID {
191 dev_t device_id;
192 ino_t file_id;
193 };
194 #elif defined(OS_MACOSX)
195 struct SharedMemoryHandleID {
196 // TODO: On macOS, this might be mach_port_t.
197 dev_t device_id;
198 ino_t file_id;
199 };
200 #elif defined(OS_WIN)
201 struct SharedMemoryHandleID {
202 DWORD device_id; // BY_HANDLE_FILE_INFORMATION.dwVolumeSerialNumber
203 intt64_t file_id; // BY_HANDLE_FILE_INFORMATION.nFileIndexHigh and Low
204 };
205 #endif
206
207 bool GetIDFromSharedMemoryHandle(const SharedMemoryHandle& handle,
Primiano Tucci (use gerrit) 2017/01/20 16:34:52 should this just be a member function of SharedMem
hajimehoshi 2017/01/23 11:59:09 I like your suggestion, but on POSIX, SharedMemory
Primiano Tucci (use gerrit) 2017/01/24 01:26:40 Ahh okay I didn't notice. I think it was always so
208 SharedMemoryHandleID* id);
209
210 std::string GetSharedMemoryHandleIDString(const SharedMemoryHandleID& id);
211
189 } // namespace base 212 } // namespace base
190 213
191 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ 214 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698