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

Side by Side Diff: base/metrics/histogram_delta_serialization.cc

Issue 137623002: Let MetricsService know about some Android Activities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/metrics/histogram_delta_serialization.h" 5 #include "base/metrics/histogram_delta_serialization.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram_base.h" 8 #include "base/metrics/histogram_base.h"
9 #include "base/metrics/histogram_snapshot_manager.h" 9 #include "base/metrics/histogram_snapshot_manager.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 HistogramDeltaSerialization::~HistogramDeltaSerialization() { 59 HistogramDeltaSerialization::~HistogramDeltaSerialization() {
60 } 60 }
61 61
62 void HistogramDeltaSerialization::PrepareAndSerializeDeltas( 62 void HistogramDeltaSerialization::PrepareAndSerializeDeltas(
63 std::vector<std::string>* serialized_deltas) { 63 std::vector<std::string>* serialized_deltas) {
64 serialized_deltas_ = serialized_deltas; 64 serialized_deltas_ = serialized_deltas;
65 // Note: Before serializing, we set the kIPCSerializationSourceFlag for all 65 // Note: Before serializing, we set the kIPCSerializationSourceFlag for all
66 // the histograms, so that the receiving process can distinguish them from the 66 // the histograms, so that the receiving process can distinguish them from the
67 // local histograms. 67 // local histograms.
68 histogram_snapshot_manager_.PrepareDeltas( 68 histogram_snapshot_manager_.PrepareDeltas(
69 Histogram::kIPCSerializationSourceFlag, false); 69 Histogram::kIPCSerializationSourceFlag, Histogram::kNoFlags);
70 serialized_deltas_ = NULL; 70 serialized_deltas_ = NULL;
71 } 71 }
72 72
73 // static 73 // static
74 void HistogramDeltaSerialization::DeserializeAndAddSamples( 74 void HistogramDeltaSerialization::DeserializeAndAddSamples(
75 const std::vector<std::string>& serialized_deltas) { 75 const std::vector<std::string>& serialized_deltas) {
76 for (std::vector<std::string>::const_iterator it = serialized_deltas.begin(); 76 for (std::vector<std::string>::const_iterator it = serialized_deltas.begin();
77 it != serialized_deltas.end(); ++it) { 77 it != serialized_deltas.end(); ++it) {
78 Pickle pickle(it->data(), checked_cast<int>(it->size())); 78 Pickle pickle(it->data(), checked_cast<int>(it->size()));
79 PickleIterator iter(pickle); 79 PickleIterator iter(pickle);
(...skipping 22 matching lines...) Expand all
102 HistogramBase::Inconsistency problem) { 102 HistogramBase::Inconsistency problem) {
103 inconsistencies_unique_histogram_->Add(problem); 103 inconsistencies_unique_histogram_->Add(problem);
104 } 104 }
105 105
106 void HistogramDeltaSerialization::InconsistencyDetectedInLoggedCount( 106 void HistogramDeltaSerialization::InconsistencyDetectedInLoggedCount(
107 int amount) { 107 int amount) {
108 inconsistent_snapshot_histogram_->Add(std::abs(amount)); 108 inconsistent_snapshot_histogram_->Add(std::abs(amount));
109 } 109 }
110 110
111 } // namespace base 111 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698