OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/common/metrics_helpers.h" | 5 #include "chrome/common/metrics_helpers.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 xmlDocPtr doc() const { return doc_; } | 82 xmlDocPtr doc() const { return doc_; } |
83 xmlTextWriterPtr writer() const { return writer_; } | 83 xmlTextWriterPtr writer() const { return writer_; } |
84 xmlBufferPtr buffer() const { return buffer_; } | 84 xmlBufferPtr buffer() const { return buffer_; } |
85 | 85 |
86 private: | 86 private: |
87 xmlDocPtr doc_; | 87 xmlDocPtr doc_; |
88 xmlBufferPtr buffer_; | 88 xmlBufferPtr buffer_; |
89 xmlTextWriterPtr writer_; | 89 xmlTextWriterPtr writer_; |
90 }; | 90 }; |
91 | 91 |
92 // static | |
93 std::string MetricsLogBase::version_extension_; | |
94 | |
95 MetricsLogBase::MetricsLogBase(const std::string& client_id, int session_id, | 92 MetricsLogBase::MetricsLogBase(const std::string& client_id, int session_id, |
96 const std::string& version_string) | 93 const std::string& version_string) |
97 : start_time_(Time::Now()), | 94 : start_time_(Time::Now()), |
98 client_id_(client_id), | 95 client_id_(client_id), |
99 session_id_(base::IntToString(session_id)), | 96 session_id_(base::IntToString(session_id)), |
100 locked_(false), | 97 locked_(false), |
101 xml_wrapper_(new XmlWrapper), | 98 xml_wrapper_(new XmlWrapper), |
102 num_events_(0) { | 99 num_events_(0) { |
103 | 100 |
104 StartElement("log"); | 101 StartElement("log"); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 snapshot.Subtract(*already_logged); | 525 snapshot.Subtract(*already_logged); |
529 } | 526 } |
530 | 527 |
531 // Snapshot now contains only a delta to what we've already_logged. | 528 // Snapshot now contains only a delta to what we've already_logged. |
532 if (snapshot.redundant_count() > 0) { | 529 if (snapshot.redundant_count() > 0) { |
533 TransmitHistogramDelta(histogram, snapshot); | 530 TransmitHistogramDelta(histogram, snapshot); |
534 // Add new data into our running total. | 531 // Add new data into our running total. |
535 already_logged->Add(snapshot); | 532 already_logged->Add(snapshot); |
536 } | 533 } |
537 } | 534 } |
OLD | NEW |