| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_METRICS_HISTOGRAM_PERSISTENCE_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| 6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 // Constructs a pair of names in |dir| based on name that can be used for a | 424 // Constructs a pair of names in |dir| based on name that can be used for a |
| 425 // base + active persistent memory mapped location for CreateWithActiveFile(). | 425 // base + active persistent memory mapped location for CreateWithActiveFile(). |
| 426 // |name| will be used as the basename of the file inside |dir|. | 426 // |name| will be used as the basename of the file inside |dir|. |
| 427 // |out_base_path| or |out_active_path| may be null if not needed. | 427 // |out_base_path| or |out_active_path| may be null if not needed. |
| 428 static void ConstructFilePaths(const FilePath& dir, | 428 static void ConstructFilePaths(const FilePath& dir, |
| 429 StringPiece name, | 429 StringPiece name, |
| 430 FilePath* out_base_path, | 430 FilePath* out_base_path, |
| 431 FilePath* out_active_path); | 431 FilePath* out_active_path); |
| 432 #endif | 432 #endif |
| 433 | 433 |
| 434 // Create a global allocator using a block of shared |memory| of the | |
| 435 // specified |size|. The allocator takes ownership of the shared memory | |
| 436 // and releases it upon destruction, though the memory will continue to | |
| 437 // live if other processes have access to it. | |
| 438 static void CreateWithSharedMemory(std::unique_ptr<SharedMemory> memory, | |
| 439 size_t size, | |
| 440 uint64_t id, | |
| 441 StringPiece name); | |
| 442 | |
| 443 // Create a global allocator using a block of shared memory accessed | 434 // Create a global allocator using a block of shared memory accessed |
| 444 // through the given |handle| and |size|. The allocator takes ownership | 435 // through the given |handle| and |size|. The allocator takes ownership |
| 445 // of the handle and closes it upon destruction, though the memory will | 436 // of the handle and closes it upon destruction, though the memory will |
| 446 // continue to live if other processes have access to it. | 437 // continue to live if other processes have access to it. |
| 447 static void CreateWithSharedMemoryHandle(const SharedMemoryHandle& handle, | 438 static void CreateWithSharedMemoryHandle(const SharedMemoryHandle& handle, |
| 448 size_t size); | 439 size_t size); |
| 449 | 440 |
| 450 // Sets a GlobalHistogramAllocator for globally storing histograms in | 441 // Sets a GlobalHistogramAllocator for globally storing histograms in |
| 451 // a space that can be persisted or shared between processes. There is only | 442 // a space that can be persisted or shared between processes. There is only |
| 452 // ever one allocator for all such histograms created by a single process. | 443 // ever one allocator for all such histograms created by a single process. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 495 |
| 505 // The location to which the data should be persisted. | 496 // The location to which the data should be persisted. |
| 506 FilePath persistent_location_; | 497 FilePath persistent_location_; |
| 507 | 498 |
| 508 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); | 499 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); |
| 509 }; | 500 }; |
| 510 | 501 |
| 511 } // namespace base | 502 } // namespace base |
| 512 | 503 |
| 513 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 504 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| OLD | NEW |