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

Side by Side Diff: content/browser/histogram_synchronizer.cc

Issue 11682003: Serialize/Deserialize support in HistogramBase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another friend change Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/histogram_synchronizer.h" 5 #include "content/browser/histogram_synchronizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/pickle.h"
11 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
12 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
13 #include "content/browser/histogram_controller.h" 14 #include "content/browser/histogram_controller.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/histogram_fetcher.h" 16 #include "content/public/browser/histogram_fetcher.h"
16 #include "content/public/common/content_constants.h" 17 #include "content/public/common/content_constants.h"
17 18
18 using base::Time; 19 using base::Time;
19 using base::TimeDelta; 20 using base::TimeDelta;
20 using base::TimeTicks; 21 using base::TimeTicks;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void HistogramSynchronizer::OnHistogramDataCollected( 266 void HistogramSynchronizer::OnHistogramDataCollected(
266 int sequence_number, 267 int sequence_number,
267 const std::vector<std::string>& pickled_histograms) { 268 const std::vector<std::string>& pickled_histograms) {
268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
269 270
270 RequestContext* request = RequestContext::GetRequestContext(sequence_number); 271 RequestContext* request = RequestContext::GetRequestContext(sequence_number);
271 272
272 for (std::vector<std::string>::const_iterator it = pickled_histograms.begin(); 273 for (std::vector<std::string>::const_iterator it = pickled_histograms.begin();
273 it < pickled_histograms.end(); 274 it < pickled_histograms.end();
274 ++it) { 275 ++it) {
275 base::Histogram::DeserializeHistogramInfo(*it); 276 Pickle pickle(it->data(), it->size());
277 PickleIterator iter(pickle);
278 base::DeserializeHistogramAndAddSamples(&iter);
276 } 279 }
277 280
278 if (!request) 281 if (!request)
279 return; 282 return;
280 283
281 // Delete request if we have heard back from all child processes. 284 // Delete request if we have heard back from all child processes.
282 request->DecrementProcessesPending(); 285 request->DecrementProcessesPending();
283 request->DeleteIfAllDone(); 286 request->DeleteIfAllDone();
284 } 287 }
285 288
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 kHistogramSynchronizerReservedSequenceNumber + 1; 339 kHistogramSynchronizerReservedSequenceNumber + 1;
337 } 340 }
338 DCHECK_NE(last_used_sequence_number_, 341 DCHECK_NE(last_used_sequence_number_,
339 kHistogramSynchronizerReservedSequenceNumber); 342 kHistogramSynchronizerReservedSequenceNumber);
340 if (requester == ASYNC_HISTOGRAMS) 343 if (requester == ASYNC_HISTOGRAMS)
341 async_sequence_number_ = last_used_sequence_number_; 344 async_sequence_number_ = last_used_sequence_number_;
342 return last_used_sequence_number_; 345 return last_used_sequence_number_;
343 } 346 }
344 347
345 } // namespace content 348 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/metrics/metrics_service_base.cc ('k') | content/common/child_histogram_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698