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

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

Issue 27460003: Consolidate serialization code in base::HistogramDeltasSerializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « base/metrics/statistics_recorder.h ('k') | content/child/child_histogram_message_filter.h » ('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 (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/metrics/histogram_delta_serialization.h"
11 #include "base/pickle.h" 12 #include "base/pickle.h"
12 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
13 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
14 #include "content/browser/histogram_controller.h" 15 #include "content/browser/histogram_controller.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/histogram_fetcher.h" 17 #include "content/public/browser/histogram_fetcher.h"
17 #include "content/public/common/content_constants.h" 18 #include "content/public/common/content_constants.h"
18 19
19 using base::Time; 20 using base::Time;
20 using base::TimeDelta; 21 using base::TimeDelta;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 request->AddProcessesPending(pending_processes); 262 request->AddProcessesPending(pending_processes);
262 request->SetReceivedProcessGroupCount(end); 263 request->SetReceivedProcessGroupCount(end);
263 request->DeleteIfAllDone(); 264 request->DeleteIfAllDone();
264 } 265 }
265 266
266 void HistogramSynchronizer::OnHistogramDataCollected( 267 void HistogramSynchronizer::OnHistogramDataCollected(
267 int sequence_number, 268 int sequence_number,
268 const std::vector<std::string>& pickled_histograms) { 269 const std::vector<std::string>& pickled_histograms) {
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
270 271
272 base::HistogramDeltaSerialization::DeserializeAndAddSamples(
273 pickled_histograms);
274
271 RequestContext* request = RequestContext::GetRequestContext(sequence_number); 275 RequestContext* request = RequestContext::GetRequestContext(sequence_number);
272
273 for (std::vector<std::string>::const_iterator it = pickled_histograms.begin();
274 it < pickled_histograms.end();
275 ++it) {
276 Pickle pickle(it->data(), it->size());
277 PickleIterator iter(pickle);
278 base::DeserializeHistogramAndAddSamples(&iter);
279 }
280
281 if (!request) 276 if (!request)
282 return; 277 return;
283 278
284 // Delete request if we have heard back from all child processes. 279 // Delete request if we have heard back from all child processes.
285 request->DecrementProcessesPending(); 280 request->DecrementProcessesPending();
286 request->DeleteIfAllDone(); 281 request->DeleteIfAllDone();
287 } 282 }
288 283
289 void HistogramSynchronizer::SetCallbackTaskAndThread( 284 void HistogramSynchronizer::SetCallbackTaskAndThread(
290 base::MessageLoop* callback_thread, 285 base::MessageLoop* callback_thread,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 kHistogramSynchronizerReservedSequenceNumber + 1; 334 kHistogramSynchronizerReservedSequenceNumber + 1;
340 } 335 }
341 DCHECK_NE(last_used_sequence_number_, 336 DCHECK_NE(last_used_sequence_number_,
342 kHistogramSynchronizerReservedSequenceNumber); 337 kHistogramSynchronizerReservedSequenceNumber);
343 if (requester == ASYNC_HISTOGRAMS) 338 if (requester == ASYNC_HISTOGRAMS)
344 async_sequence_number_ = last_used_sequence_number_; 339 async_sequence_number_ = last_used_sequence_number_;
345 return last_used_sequence_number_; 340 return last_used_sequence_number_;
346 } 341 }
347 342
348 } // namespace content 343 } // namespace content
OLDNEW
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | content/child/child_histogram_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698