OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/cpp/private/uma_private.h" |
| 6 |
| 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/private/ppb_uma_private.h" |
| 9 #include "ppapi/cpp/module_impl.h" |
| 10 #include "ppapi/cpp/var.h" |
| 11 |
| 12 namespace pp { |
| 13 |
| 14 namespace { |
| 15 |
| 16 template <> const char* interface_name<PPB_UMA_Private_0_2>() { |
| 17 return PPB_UMA_PRIVATE_INTERFACE_0_2; |
| 18 } |
| 19 |
| 20 } // namespace |
| 21 |
| 22 UMAPrivate::UMAPrivate() { |
| 23 } |
| 24 |
| 25 UMAPrivate::UMAPrivate( |
| 26 const InstanceHandle& instance) : instance_(instance.pp_instance()) { |
| 27 } |
| 28 |
| 29 UMAPrivate::~UMAPrivate() { |
| 30 } |
| 31 |
| 32 bool UMAPrivate::IsAvailable() { |
| 33 return has_interface<PPB_UMA_Private_0_2>(); |
| 34 } |
| 35 |
| 36 void UMAPrivate::HistogramCustomTimes(const std::string& name, |
| 37 int64_t sample, |
| 38 int64_t min, |
| 39 int64_t max, |
| 40 uint32_t bucket_count) { |
| 41 if (!IsAvailable()) |
| 42 return; |
| 43 get_interface<PPB_UMA_Private_0_2>()-> |
| 44 HistogramCustomTimes(instance_, pp::Var(name).pp_var(), |
| 45 sample, min, max, bucket_count); |
| 46 } |
| 47 |
| 48 void UMAPrivate::HistogramCustomCounts(const std::string& name, |
| 49 int32_t sample, |
| 50 int32_t min, |
| 51 int32_t max, |
| 52 uint32_t bucket_count) { |
| 53 if (!IsAvailable()) |
| 54 return; |
| 55 get_interface<PPB_UMA_Private_0_2>()-> |
| 56 HistogramCustomCounts(instance_, pp::Var(name).pp_var(), |
| 57 sample, min, max, bucket_count); |
| 58 } |
| 59 |
| 60 void UMAPrivate::HistogramEnumeration(const std::string& name, |
| 61 int32_t sample, |
| 62 int32_t boundary_value) { |
| 63 if (!IsAvailable()) |
| 64 return; |
| 65 get_interface<PPB_UMA_Private_0_2>()-> |
| 66 HistogramEnumeration(instance_, pp::Var(name).pp_var(), |
| 67 sample, boundary_value); |
| 68 } |
| 69 |
| 70 } // namespace pp |
OLD | NEW |