| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/android/record_histogram.h" | 5 #include "base/android/record_histogram.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 const JavaParamRef<jclass>& clazz, | 307 const JavaParamRef<jclass>& clazz, |
| 308 const JavaParamRef<jstring>& histogram_name, | 308 const JavaParamRef<jstring>& histogram_name, |
| 309 jint sample) { | 309 jint sample) { |
| 310 HistogramBase* histogram = StatisticsRecorder::FindHistogram( | 310 HistogramBase* histogram = StatisticsRecorder::FindHistogram( |
| 311 android::ConvertJavaStringToUTF8(env, histogram_name)); | 311 android::ConvertJavaStringToUTF8(env, histogram_name)); |
| 312 if (histogram == nullptr) { | 312 if (histogram == nullptr) { |
| 313 // No samples have been recorded for this histogram (yet?). | 313 // No samples have been recorded for this histogram (yet?). |
| 314 return 0; | 314 return 0; |
| 315 } | 315 } |
| 316 | 316 |
| 317 scoped_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); | 317 std::unique_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); |
| 318 return samples->GetCount(static_cast<int>(sample)); | 318 return samples->GetCount(static_cast<int>(sample)); |
| 319 } | 319 } |
| 320 | 320 |
| 321 bool RegisterRecordHistogram(JNIEnv* env) { | 321 bool RegisterRecordHistogram(JNIEnv* env) { |
| 322 return RegisterNativesImpl(env); | 322 return RegisterNativesImpl(env); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace android | 325 } // namespace android |
| 326 } // namespace base | 326 } // namespace base |
| OLD | NEW |