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

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: Some changes about deserializing 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
Ilya Sherman 2013/01/09 05:48:37 nit: No need for this newline
kaiwang 2013/01/10 23:02:24 Done.
279 base::DeserializeHistogramAndAddSamples(&iter);
276 } 280 }
277 281
278 if (!request) 282 if (!request)
279 return; 283 return;
280 284
281 // Delete request if we have heard back from all child processes. 285 // Delete request if we have heard back from all child processes.
282 request->DecrementProcessesPending(); 286 request->DecrementProcessesPending();
283 request->DeleteIfAllDone(); 287 request->DeleteIfAllDone();
284 } 288 }
285 289
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 kHistogramSynchronizerReservedSequenceNumber + 1; 340 kHistogramSynchronizerReservedSequenceNumber + 1;
337 } 341 }
338 DCHECK_NE(last_used_sequence_number_, 342 DCHECK_NE(last_used_sequence_number_,
339 kHistogramSynchronizerReservedSequenceNumber); 343 kHistogramSynchronizerReservedSequenceNumber);
340 if (requester == ASYNC_HISTOGRAMS) 344 if (requester == ASYNC_HISTOGRAMS)
341 async_sequence_number_ = last_used_sequence_number_; 345 async_sequence_number_ = last_used_sequence_number_;
342 return last_used_sequence_number_; 346 return last_used_sequence_number_;
343 } 347 }
344 348
345 } // namespace content 349 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698