| OLD | NEW |
| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 HistogramSynchronizer::~HistogramSynchronizer() { | 175 HistogramSynchronizer::~HistogramSynchronizer() { |
| 176 RequestContext::OnShutdown(); | 176 RequestContext::OnShutdown(); |
| 177 | 177 |
| 178 // Just in case we have any pending tasks, clear them out. | 178 // Just in case we have any pending tasks, clear them out. |
| 179 SetCallbackTaskAndThread(NULL, base::Closure()); | 179 SetCallbackTaskAndThread(NULL, base::Closure()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 HistogramSynchronizer* HistogramSynchronizer::GetInstance() { | 182 HistogramSynchronizer* HistogramSynchronizer::GetInstance() { |
| 183 return Singleton<HistogramSynchronizer, | 183 return base::Singleton< |
| 184 LeakySingletonTraits<HistogramSynchronizer> >::get(); | 184 HistogramSynchronizer, |
| 185 base::LeakySingletonTraits<HistogramSynchronizer>>::get(); |
| 185 } | 186 } |
| 186 | 187 |
| 187 // static | 188 // static |
| 188 void HistogramSynchronizer::FetchHistograms() { | 189 void HistogramSynchronizer::FetchHistograms() { |
| 189 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 190 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 190 BrowserThread::PostTask( | 191 BrowserThread::PostTask( |
| 191 BrowserThread::UI, FROM_HERE, | 192 BrowserThread::UI, FROM_HERE, |
| 192 base::Bind(&HistogramSynchronizer::FetchHistograms)); | 193 base::Bind(&HistogramSynchronizer::FetchHistograms)); |
| 193 return; | 194 return; |
| 194 } | 195 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 kHistogramSynchronizerReservedSequenceNumber + 1; | 337 kHistogramSynchronizerReservedSequenceNumber + 1; |
| 337 } | 338 } |
| 338 DCHECK_NE(last_used_sequence_number_, | 339 DCHECK_NE(last_used_sequence_number_, |
| 339 kHistogramSynchronizerReservedSequenceNumber); | 340 kHistogramSynchronizerReservedSequenceNumber); |
| 340 if (requester == ASYNC_HISTOGRAMS) | 341 if (requester == ASYNC_HISTOGRAMS) |
| 341 async_sequence_number_ = last_used_sequence_number_; | 342 async_sequence_number_ = last_used_sequence_number_; |
| 342 return last_used_sequence_number_; | 343 return last_used_sequence_number_; |
| 343 } | 344 } |
| 344 | 345 |
| 345 } // namespace content | 346 } // namespace content |
| OLD | NEW |