Chromium Code Reviews| Index: components/metrics/persistent_system_profile.h |
| diff --git a/components/metrics/persistent_system_profile.h b/components/metrics/persistent_system_profile.h |
| index 2f687811bd74abc2f0cccc0fc9bc1f9449a2d92e..ccf35b2650374f5c28e359ef2f5b1eb30d14b816 100644 |
| --- a/components/metrics/persistent_system_profile.h |
| +++ b/components/metrics/persistent_system_profile.h |
| @@ -7,6 +7,7 @@ |
| #include <vector> |
| +#include "base/strings/string_piece.h" |
| #include "base/threading/thread_checker.h" |
| #include "components/metrics/proto/system_profile.pb.h" |
| @@ -38,6 +39,9 @@ class PersistentSystemProfile { |
| void SetSystemProfile(const std::string& serialized_profile, bool complete); |
| void SetSystemProfile(const SystemProfileProto& profile, bool complete); |
| + // Records the existence of a field trial. |
| + void SetFieldTrial(base::StringPiece trial, base::StringPiece group); |
|
Alexei Svitkine (slow)
2017/06/28 14:59:01
Maybe AddFieldTrial? Otherwise the name sounds lik
bcwhite
2017/06/28 16:43:31
Done.
|
| + |
| // Tests if a persistent memory allocator contains an system profile. |
| static bool HasSystemProfile( |
| const base::PersistentMemoryAllocator& memory_allocator); |
| @@ -55,6 +59,7 @@ class PersistentSystemProfile { |
| enum RecordType : uint8_t { |
| kUnusedSpace = 0, // The default value for empty memory. |
| kSystemProfileProto, |
| + kFieldTrialInfo, |
| }; |
| // A class for managing record allocations inside a persistent memory segment. |
| @@ -70,7 +75,7 @@ class PersistentSystemProfile { |
| // These methods manage writing records to the allocator. Do not mix these |
| // with "read" calls; it's one or the other. |
| void Reset(); |
| - bool Write(RecordType type, const std::string& record); |
| + bool Write(RecordType type, base::StringPiece record); |
| // Read a record from the allocator. Do not mix this with "write" calls; |
| // it's one or the other. |
| @@ -114,6 +119,14 @@ class PersistentSystemProfile { |
| // Copy and assign are allowed for easy use with STL containers. |
| }; |
| + // Write a record to all registered allocators. |
| + void WriteToAll(RecordType type, base::StringPiece record); |
| + |
| + // Merges all extension records into a system profile. |
|
Alexei Svitkine (slow)
2017/06/28 14:59:01
Update comment too.
bcwhite
2017/06/28 16:43:31
Done.
|
| + static void MergeUpdateRecords( |
| + const base::PersistentMemoryAllocator& memory_allocator, |
| + SystemProfileProto* system_profile); |
| + |
| // The list of registered persistent allocators, described by RecordAllocator |
| // instances. |
| std::vector<RecordAllocator> allocators_; |