Chromium Code Reviews| 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 #include <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 case SPARSE_HISTOGRAM: | 46 case SPARSE_HISTOGRAM: |
| 47 break; | 47 break; |
| 48 } | 48 } |
| 49 return params_str; | 49 return params_str; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void CheckHistogramArgs(JNIEnv* env, | 52 void CheckHistogramArgs(JNIEnv* env, |
| 53 jstring j_histogram_name, | 53 jstring j_histogram_name, |
| 54 int32_t expected_min, | 54 int32_t expected_min, |
| 55 int32_t expected_max, | 55 int32_t expected_max, |
| 56 int32_t expected_bucket_count, | 56 uint32_t expected_bucket_count, |
| 57 HistogramBase* histogram) { | 57 HistogramBase* histogram) { |
| 58 std::string histogram_name = ConvertJavaStringToUTF8(env, j_histogram_name); | |
| 59 Histogram::InspectConstructionArguments( | |
|
Alexei Svitkine (slow)
2017/02/07 18:00:44
Can you assign the return value to a var and DCHEC
| |
| 60 histogram_name, &expected_min, &expected_max, &expected_bucket_count); | |
| 58 DCHECK(histogram->HasConstructionArguments(expected_min, expected_max, | 61 DCHECK(histogram->HasConstructionArguments(expected_min, expected_max, |
| 59 expected_bucket_count)) | 62 expected_bucket_count)) |
| 60 << ConvertJavaStringToUTF8(env, j_histogram_name) << "/" << expected_min | 63 << histogram_name << "/" << expected_min << "/" << expected_max << "/" |
| 61 << "/" << expected_max << "/" << expected_bucket_count << " vs. " | 64 << expected_bucket_count << " vs. " |
| 62 << HistogramConstructionParamsToString(histogram); | 65 << HistogramConstructionParamsToString(histogram); |
| 63 } | 66 } |
| 64 | 67 |
| 65 HistogramBase* BooleanHistogram(JNIEnv* env, | 68 HistogramBase* BooleanHistogram(JNIEnv* env, |
| 66 jstring j_histogram_name, | 69 jstring j_histogram_name, |
| 67 jlong j_histogram_key) { | 70 jlong j_histogram_key) { |
| 68 DCHECK(j_histogram_name); | 71 DCHECK(j_histogram_name); |
| 69 HistogramBase* histogram = HistogramFromKey(j_histogram_key); | 72 HistogramBase* histogram = HistogramFromKey(j_histogram_key); |
| 70 if (histogram) | 73 if (histogram) |
| 71 return histogram; | 74 return histogram; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 std::unique_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); | 313 std::unique_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); |
| 311 return samples->GetCount(static_cast<int>(sample)); | 314 return samples->GetCount(static_cast<int>(sample)); |
| 312 } | 315 } |
| 313 | 316 |
| 314 bool RegisterRecordHistogram(JNIEnv* env) { | 317 bool RegisterRecordHistogram(JNIEnv* env) { |
| 315 return RegisterNativesImpl(env); | 318 return RegisterNativesImpl(env); |
| 316 } | 319 } |
| 317 | 320 |
| 318 } // namespace android | 321 } // namespace android |
| 319 } // namespace base | 322 } // namespace base |
| OLD | NEW |