Chromium Code Reviews| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 // The spare path is a file that can be pre-created and moved to be active | 428 // The spare path is a file that can be pre-created and moved to be active |
| 429 // without any startup penalty that comes from constructing the file. |name| | 429 // without any startup penalty that comes from constructing the file. |name| |
| 430 // will be used as the basename of the file inside |dir|. |out_base_path|, | 430 // will be used as the basename of the file inside |dir|. |out_base_path|, |
| 431 // |out_active_path|, or |out_spare_path| may be null if not needed. | 431 // |out_active_path|, or |out_spare_path| may be null if not needed. |
| 432 static void ConstructFilePaths(const FilePath& dir, | 432 static void ConstructFilePaths(const FilePath& dir, |
| 433 StringPiece name, | 433 StringPiece name, |
| 434 FilePath* out_base_path, | 434 FilePath* out_base_path, |
| 435 FilePath* out_active_path, | 435 FilePath* out_active_path, |
| 436 FilePath* out_spare_path); | 436 FilePath* out_spare_path); |
| 437 | 437 |
| 438 // As above but puts the base files in a different "upload" directory. This | |
| 439 // is useful when moving all completed files into a single directory for easy | |
| 440 // upload management. | |
| 441 static void ConstructFilePathsForUploadDir(const FilePath& active_dir, | |
| 442 const FilePath& upload_dir, | |
| 443 const std::string& name, | |
|
Alexei Svitkine (slow)
2017/06/28 17:30:35
StringPiece especially since you pass in kBrowserM
bcwhite
2017/06/28 18:52:08
std::string takes a char* no problem. Inside, tho
Alexei Svitkine (slow)
2017/06/28 19:19:09
Ah right, because you're converting via .as_string
| |
| 444 FilePath* out_upload_path, | |
| 445 FilePath* out_active_path, | |
| 446 FilePath* out_spare_path); | |
| 447 | |
| 438 // Create a "spare" file that can later be made the "active" file. This | 448 // Create a "spare" file that can later be made the "active" file. This |
| 439 // should be done on a background thread if possible. | 449 // should be done on a background thread if possible. |
| 440 static bool CreateSpareFile(const FilePath& spare_path, size_t size); | 450 static bool CreateSpareFile(const FilePath& spare_path, size_t size); |
| 441 | 451 |
| 442 // Same as above but uses standard names. |name| is the name of the allocator | 452 // Same as above but uses standard names. |name| is the name of the allocator |
| 443 // and is also used to create the correct filename. | 453 // and is also used to create the correct filename. |
| 444 static bool CreateSpareFileInDir(const FilePath& dir_path, | 454 static bool CreateSpareFileInDir(const FilePath& dir_path, |
| 445 size_t size, | 455 size_t size, |
| 446 StringPiece name); | 456 StringPiece name); |
| 447 #endif | 457 #endif |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 | 520 |
| 511 // The location to which the data should be persisted. | 521 // The location to which the data should be persisted. |
| 512 FilePath persistent_location_; | 522 FilePath persistent_location_; |
| 513 | 523 |
| 514 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); | 524 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); |
| 515 }; | 525 }; |
| 516 | 526 |
| 517 } // namespace base | 527 } // namespace base |
| 518 | 528 |
| 519 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ | 529 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ |
| OLD | NEW |