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

Side by Side Diff: components/metrics/metrics_log_base.h

Issue 292113003: Remove num_events_ member from MetricsLogBase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | components/metrics/metrics_log_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file defines a set of user experience metrics data recorded by 5 // This file defines a set of user experience metrics data recorded by
6 // the MetricsService. This is the unit of data that is sent to the server. 6 // the MetricsService. This is the unit of data that is sent to the server.
7 7
8 #ifndef COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_BASE_H_
9 #define COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 9 #define COMPONENTS_METRICS_METRICS_LOG_BASE_H_
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const base::HistogramSamples& snapshot); 63 const base::HistogramSamples& snapshot);
64 64
65 // Stop writing to this record and generate the encoded representation. 65 // Stop writing to this record and generate the encoded representation.
66 // None of the Record* methods can be called after this is called. 66 // None of the Record* methods can be called after this is called.
67 void CloseLog(); 67 void CloseLog();
68 68
69 // Fills |encoded_log| with the serialized protobuf representation of the 69 // Fills |encoded_log| with the serialized protobuf representation of the
70 // record. Must only be called after CloseLog() has been called. 70 // record. Must only be called after CloseLog() has been called.
71 void GetEncodedLog(std::string* encoded_log); 71 void GetEncodedLog(std::string* encoded_log);
72 72
73 int num_events() { return num_events_; } 73 int num_events() const {
74 return uma_proto_.omnibox_event_size() +
75 uma_proto_.user_action_event_size();
76 }
74 77
75 void set_hardware_class(const std::string& hardware_class) { 78 void set_hardware_class(const std::string& hardware_class) {
76 uma_proto_.mutable_system_profile()->mutable_hardware()->set_hardware_class( 79 uma_proto_.mutable_system_profile()->mutable_hardware()->set_hardware_class(
77 hardware_class); 80 hardware_class);
78 } 81 }
79 82
80 LogType log_type() const { return log_type_; } 83 LogType log_type() const { return log_type_; }
81 84
82 protected: 85 protected:
83 bool locked() const { return locked_; } 86 bool locked() const { return locked_; }
84 87
85 metrics::ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; } 88 metrics::ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; }
86 const metrics::ChromeUserMetricsExtension* uma_proto() const { 89 const metrics::ChromeUserMetricsExtension* uma_proto() const {
87 return &uma_proto_; 90 return &uma_proto_;
88 } 91 }
89 92
90 // TODO(isherman): Remove this once the XML pipeline is outta here.
91 int num_events_; // the number of events recorded in this log
92
93 private: 93 private:
94 // locked_ is true when record has been packed up for sending, and should 94 // locked_ is true when record has been packed up for sending, and should
95 // no longer be written to. It is only used for sanity checking and is 95 // no longer be written to. It is only used for sanity checking and is
96 // not a real lock. 96 // not a real lock.
97 bool locked_; 97 bool locked_;
98 98
99 // The type of the log, i.e. initial or ongoing. 99 // The type of the log, i.e. initial or ongoing.
100 const LogType log_type_; 100 const LogType log_type_;
101 101
102 // Stores the protocol buffer representation for this log. 102 // Stores the protocol buffer representation for this log.
103 metrics::ChromeUserMetricsExtension uma_proto_; 103 metrics::ChromeUserMetricsExtension uma_proto_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase); 105 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase);
106 }; 106 };
107 107
108 } // namespace metrics 108 } // namespace metrics
109 109
110 #endif // COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 110 #endif // COMPONENTS_METRICS_METRICS_LOG_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | components/metrics/metrics_log_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698