| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "net/disk_cache/stats_histogram.h" | 5 #include "net/disk_cache/stats_histogram.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/disk_cache/stats.h" | 8 #include "net/disk_cache/stats.h" |
| 9 | 9 |
| 10 namespace disk_cache { | 10 namespace disk_cache { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 DCHECK(HISTOGRAM == histogram->histogram_type()); | 37 DCHECK(HISTOGRAM == histogram->histogram_type()); |
| 38 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count)); | 38 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count)); |
| 39 | 39 |
| 40 // We're preparing for an otherwise unsafe upcast by ensuring we have the | 40 // We're preparing for an otherwise unsafe upcast by ensuring we have the |
| 41 // proper class type. | 41 // proper class type. |
| 42 Histogram* temp_histogram = histogram.get(); | 42 Histogram* temp_histogram = histogram.get(); |
| 43 StatsHistogram* temp_stats_histogram = | 43 StatsHistogram* temp_stats_histogram = |
| 44 static_cast<StatsHistogram*>(temp_histogram); | 44 static_cast<StatsHistogram*>(temp_histogram); |
| 45 scoped_refptr<StatsHistogram> return_histogram = temp_stats_histogram; | 45 scoped_refptr<StatsHistogram> return_histogram(temp_stats_histogram); |
| 46 return return_histogram; | 46 return return_histogram; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool StatsHistogram::Init(const Stats* stats) { | 49 bool StatsHistogram::Init(const Stats* stats) { |
| 50 DCHECK(stats); | 50 DCHECK(stats); |
| 51 if (stats_) | 51 if (stats_) |
| 52 return false; | 52 return false; |
| 53 | 53 |
| 54 SetFlags(kUmaTargetedHistogramFlag); | 54 SetFlags(kUmaTargetedHistogramFlag); |
| 55 | 55 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 stats_->Snapshot(&my_sample); | 80 stats_->Snapshot(&my_sample); |
| 81 | 81 |
| 82 *sample = my_sample; | 82 *sample = my_sample; |
| 83 | 83 |
| 84 // Only report UMA data once. | 84 // Only report UMA data once. |
| 85 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); | 85 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); |
| 86 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); | 86 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace disk_cache | 89 } // namespace disk_cache |
| OLD | NEW |