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

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

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (wip) Created 3 years, 9 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 (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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 #if defined(OS_POSIX) && (!defined(OS_MACOSX) || defined(OS_IOS)) && \ 258 #if defined(OS_POSIX) && (!defined(OS_MACOSX) || defined(OS_IOS)) && \
259 !defined(OS_NACL) 259 !defined(OS_NACL)
260 using UniqueId = std::pair<dev_t, ino_t>; 260 using UniqueId = std::pair<dev_t, ino_t>;
261 261
262 struct UniqueIdHash { 262 struct UniqueIdHash {
263 size_t operator()(const UniqueId& id) const { 263 size_t operator()(const UniqueId& id) const {
264 return HashInts(id.first, id.second); 264 return HashInts(id.first, id.second);
265 } 265 }
266 }; 266 };
267 267
268 // Returns a unique ID for this shared memory's handle. Note this function may 268 // Returns a unique ID for the shared memory |handle|. Note this function may
269 // access file system and be slow. 269 // access file system and be slow.
270 bool GetUniqueId(UniqueId* id) const; 270 static bool GetUniqueId(const SharedMemoryHandle& handle, UniqueId* id);
271 #endif 271 #endif
272 272
273 private: 273 private:
274 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ 274 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \
275 (!defined(OS_MACOSX) || defined(OS_IOS)) 275 (!defined(OS_MACOSX) || defined(OS_IOS))
276 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); 276 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path);
277 #endif 277 #endif
278 278
279 enum ShareMode { 279 enum ShareMode {
280 SHARE_READONLY, 280 SHARE_READONLY,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 void* memory_; 313 void* memory_;
314 bool read_only_; 314 bool read_only_;
315 size_t requested_size_; 315 size_t requested_size_;
316 316
317 DISALLOW_COPY_AND_ASSIGN(SharedMemory); 317 DISALLOW_COPY_AND_ASSIGN(SharedMemory);
318 }; 318 };
319 319
320 } // namespace base 320 } // namespace base
321 321
322 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 322 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698