| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/metrics/histogram_synchronizer.h" | 5 #include "chrome/browser/metrics/histogram_synchronizer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| 11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 12 #include "content/browser/renderer_host/render_process_host.h" | 12 #include "content/browser/renderer_host/render_process_host.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 | 14 |
| 15 using base::Time; | 15 using base::Time; |
| 16 using base::TimeDelta; | 16 using base::TimeDelta; |
| 17 using base::TimeTicks; | 17 using base::TimeTicks; |
| 18 using content::BrowserThread; |
| 18 | 19 |
| 19 // Negative numbers are never used as sequence numbers. We explicitly pick a | 20 // Negative numbers are never used as sequence numbers. We explicitly pick a |
| 20 // negative number that is "so negative" that even when we add one (as is done | 21 // negative number that is "so negative" that even when we add one (as is done |
| 21 // when we generated the next sequence number) that it will still be negative. | 22 // when we generated the next sequence number) that it will still be negative. |
| 22 // We have code that handles wrapping around on an overflow into negative | 23 // We have code that handles wrapping around on an overflow into negative |
| 23 // territory. | 24 // territory. |
| 24 static const int kNeverUsableSequenceNumber = -2; | 25 static const int kNeverUsableSequenceNumber = -2; |
| 25 | 26 |
| 26 HistogramSynchronizer::HistogramSynchronizer() | 27 HistogramSynchronizer::HistogramSynchronizer() |
| 27 : lock_(), | 28 : lock_(), |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 async_renderers_pending_ = renderer_count; | 250 async_renderers_pending_ = renderer_count; |
| 250 } else if (requester == SYNCHRONOUS_HISTOGRAMS) { | 251 } else if (requester == SYNCHRONOUS_HISTOGRAMS) { |
| 251 synchronous_sequence_number_ = last_used_sequence_number_; | 252 synchronous_sequence_number_ = last_used_sequence_number_; |
| 252 synchronous_renderers_pending_ = renderer_count; | 253 synchronous_renderers_pending_ = renderer_count; |
| 253 } | 254 } |
| 254 return last_used_sequence_number_; | 255 return last_used_sequence_number_; |
| 255 } | 256 } |
| 256 | 257 |
| 257 // static | 258 // static |
| 258 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL; | 259 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL; |
| OLD | NEW |