| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // This access to the persistent allocator is only for testing; it extracts | 401 // This access to the persistent allocator is only for testing; it extracts |
| 402 // the current allocator completely. This allows easy creation of histograms | 402 // the current allocator completely. This allows easy creation of histograms |
| 403 // within persistent memory segments which can then be extracted and used in | 403 // within persistent memory segments which can then be extracted and used in |
| 404 // other ways. | 404 // other ways. |
| 405 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting(); | 405 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting(); |
| 406 | 406 |
| 407 // Stores a pathname to which the contents of this allocator should be saved | 407 // Stores a pathname to which the contents of this allocator should be saved |
| 408 // in order to persist the data for a later use. | 408 // in order to persist the data for a later use. |
| 409 void SetPersistentLocation(const FilePath& location); | 409 void SetPersistentLocation(const FilePath& location); |
| 410 | 410 |
| 411 // Retrieves a previously set pathname to which the contents of this allocator |
| 412 // are to be saved. |
| 413 const FilePath& GetPersistentLocation() const; |
| 414 |
| 411 // Writes the internal data to a previously set location. This is generally | 415 // Writes the internal data to a previously set location. This is generally |
| 412 // called when a process is exiting from a section of code that may not know | 416 // called when a process is exiting from a section of code that may not know |
| 413 // the filesystem. The data is written in an atomic manner. The return value | 417 // the filesystem. The data is written in an atomic manner. The return value |
| 414 // indicates success. | 418 // indicates success. |
| 415 bool WriteToPersistentLocation(); | 419 bool WriteToPersistentLocation(); |
| 416 | 420 |
| 417 private: | 421 private: |
| 418 friend class StatisticsRecorder; | 422 friend class StatisticsRecorder; |
| 419 | 423 |
| 420 // Creates a new global histogram allocator. | 424 // Creates a new global histogram allocator. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 435 | 439 |
| 436 // The location to which the data should be persisted. | 440 // The location to which the data should be persisted. |
| 437 FilePath persistent_location_; | 441 FilePath persistent_location_; |
| 438 | 442 |
| 439 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); | 443 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); |
| 440 }; | 444 }; |
| 441 | 445 |
| 442 } // namespace base | 446 } // namespace base |
| 443 | 447 |
| 444 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 448 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| OLD | NEW |