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

Unified Diff: base/metrics/histogram_base.h

Issue 167343002: Make code generated for histogram macros more compact. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 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: base/metrics/histogram_base.h
===================================================================
--- base/metrics/histogram_base.h (revision 251312)
+++ base/metrics/histogram_base.h (working copy)
@@ -12,6 +12,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_piece.h"
#include "base/time/time.h"
class Pickle;
@@ -48,8 +49,8 @@
class BASE_EXPORT HistogramBase {
public:
- typedef int Sample; // Used for samples.
- typedef subtle::Atomic32 AtomicCount; // Used to count samples.
+ typedef int Sample; // Used for samples.
+ typedef subtle::Atomic32 AtomicCount; // Used to count samples.
typedef int32 Count; // Used to manipulate counts in temporaries.
static const Sample kSampleType_MAX; // INT_MAX
@@ -92,6 +93,11 @@
std::string histogram_name() const { return histogram_name_; }
+ // Comapres |name| to the histogram name and triggers a DCHECK if they do not
+ // match. This is a helper function used by histogram macros, which results in
+ // in more compact machine code being generated by the macros.
+ void CheckName(const StringPiece& name) const;
+
// Operations with Flags enum.
int32 flags() const { return flags_; }
void SetFlags(int32 flags);
@@ -137,7 +143,7 @@
// customize the output.
void WriteJSON(std::string* output) const;
-protected:
+ protected:
// Subclasses should implement this function to make SerializeInfo work.
virtual bool SerializeInfoImpl(Pickle* pickle) const = 0;

Powered by Google App Engine
This is Rietveld 408576698