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

Unified Diff: chrome/common/metrics/metrics_log_base.h

Issue 9232071: Upload UMA data using protocol buffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/metrics/metrics_log_base.h
diff --git a/chrome/common/metrics/metrics_log_base.h b/chrome/common/metrics/metrics_log_base.h
index 62981beda92e8e553e653d9e5b8df4c17b6c966a..9210adde9c063ad7c8af85c6caa8f1684f8a5b9d 100644
--- a/chrome/common/metrics/metrics_log_base.h
+++ b/chrome/common/metrics/metrics_log_base.h
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/metrics/histogram.h"
#include "base/time.h"
+#include "chrome/common/metrics/proto/chrome_user_metrics_extension.pb.h"
#include "content/public/common/page_transition_types.h"
class GURL;
@@ -64,10 +65,12 @@ class MetricsLogBase {
// record. They can only be called after CloseLog() has been called.
// GetEncodedLog returns false if buffer_size is less than
// GetEncodedLogSize();
- int GetEncodedLogSize();
- bool GetEncodedLog(char* buffer, int buffer_size);
- // Returns an empty string on failure.
- std::string GetEncodedLogString();
+ int GetEncodedLogSizeXml();
+ bool GetEncodedLogXml(char* buffer, int buffer_size);
+
+ // Returns the protobuf representation of the record. Can only be called
+ // after CloseLog() has been called.
+ std::string GetEncodedLogProto();
// Returns the amount of time in seconds that this log has been in use.
int GetElapsedSeconds();
@@ -78,12 +81,12 @@ class MetricsLogBase {
hardware_class_ = hardware_class;
}
- // Creates an MD5 hash of the given value, and returns hash as a byte
- // buffer encoded as a std::string.
- static std::string CreateHash(const std::string& value);
-
- // Return a base64-encoded MD5 hash of the given string.
- static std::string CreateBase64Hash(const std::string& string);
+ // Computes the MD5 hash of the given string.
+ // Fills |base64_encoded_hash| with the hash, encoded in base64.
+ // Fills |numeric_hash| with the first 8 bytes of the hash.
+ static void CreateHashes(const std::string& string,
+ std::string* base64_encoded_hash,
+ uint64* numeric_hash);
// Get the GMT buildtime for the current binary, expressed in seconds since
// Januray 1, 1970 GMT.
@@ -156,6 +159,9 @@ class MetricsLogBase {
int num_events_; // the number of events recorded in this log
+ // Stores the protocol buffer representation for this log.
+ metrics::ChromeUserMetricsExtension uma_proto_;
+
private:
DISALLOW_COPY_AND_ASSIGN(MetricsLogBase);
};

Powered by Google App Engine
This is Rietveld 408576698