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

Side by Side Diff: chrome/browser/metrics/metrics_log_serializer.h

Issue 9562007: Add a minimum byte count to metrics log serialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_ 5 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_
6 #define CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_ 6 #define CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 MetricsLogManager::LogType log_type, 45 MetricsLogManager::LogType log_type,
46 std::vector<MetricsLogManager::SerializedLog>* logs) OVERRIDE; 46 std::vector<MetricsLogManager::SerializedLog>* logs) OVERRIDE;
47 47
48 private: 48 private:
49 // Encodes the textual log data from |local_list| and writes it to the given 49 // Encodes the textual log data from |local_list| and writes it to the given
50 // pref list, along with list size and checksum. If |is_xml| is true, writes 50 // pref list, along with list size and checksum. If |is_xml| is true, writes
51 // the XML data from |local_list|; otherwise writes the protobuf data. 51 // the XML data from |local_list|; otherwise writes the protobuf data.
52 static void WriteLogsToPrefList( 52 static void WriteLogsToPrefList(
53 const std::vector<MetricsLogManager::SerializedLog>& local_list, 53 const std::vector<MetricsLogManager::SerializedLog>& local_list,
54 bool is_xml, 54 bool is_xml,
55 size_t max_list_size,
56 base::ListValue* list); 55 base::ListValue* list);
57 56
58 // Decodes and verifies the textual log data from |list|, populating 57 // Decodes and verifies the textual log data from |list|, populating
59 // |local_list| and returning a status code. If |is_xml| is true, populates 58 // |local_list| and returning a status code. If |is_xml| is true, populates
60 // the XML data in |local_list|; otherwise populates the protobuf data. 59 // the XML data in |local_list|; otherwise populates the protobuf data.
61 static LogReadStatus ReadLogsFromPrefList( 60 static LogReadStatus ReadLogsFromPrefList(
62 const base::ListValue& list, 61 const base::ListValue& list,
63 bool is_xml, 62 bool is_xml,
64 std::vector<MetricsLogManager::SerializedLog>* local_list); 63 std::vector<MetricsLogManager::SerializedLog>* local_list);
65 64
66 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, EmptyLogList); 65 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, EmptyLogList);
67 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, SingleElementLogList); 66 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, SingleElementLogList);
68 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, OverLimitLogList); 67 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, OverLimitLogList);
69 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, SmallRecoveredListSize); 68 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, SmallRecoveredListSize);
70 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, RemoveSizeFromLogList); 69 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, RemoveSizeFromLogList);
71 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, CorruptSizeOfLogList); 70 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, CorruptSizeOfLogList);
72 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, CorruptChecksumOfLogList); 71 FRIEND_TEST_ALL_PREFIXES(MetricsLogSerializerTest, CorruptChecksumOfLogList);
73 72
74 DISALLOW_COPY_AND_ASSIGN(MetricsLogSerializer); 73 DISALLOW_COPY_AND_ASSIGN(MetricsLogSerializer);
75 }; 74 };
76 75
77 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_ 76 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_SERIALIZER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_log_serializer.cc » ('j') | chrome/browser/metrics/metrics_log_serializer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698