OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 int32_t UMAPrivate::HistogramCustomTimes(const std::string& name, |
| 33 int64_t sample, |
| 34 int64_t min, |
| 35 int64_t max, |
| 36 uint32_t bucket_count) const { |
| 37 if (!has_interface<PPB_UMA_Private_0_2>()) |
| 38 return PP_ERROR_NOINTERFACE; |
| 39 get_interface<PPB_UMA_Private_0_2>()-> |
| 40 HistogramCustomTimes(instance_, pp::Var(name).pp_var(), |
| 41 sample, min, max, bucket_count); |
| 42 return PP_OK; |
| 43 } |
| 44 |
| 45 int32_t UMAPrivate::HistogramCustomCounts(const std::string& name, |
| 46 int32_t sample, |
| 47 int32_t min, |
| 48 int32_t max, |
| 49 uint32_t bucket_count) const { |
| 50 if (!has_interface<PPB_UMA_Private_0_2>()) |
| 51 return PP_ERROR_NOINTERFACE; |
| 52 get_interface<PPB_UMA_Private_0_2>()-> |
| 53 HistogramCustomCounts(instance_, pp::Var(name).pp_var(), |
| 54 sample, min, max, bucket_count); |
| 55 return PP_OK; |
| 56 } |
| 57 |
| 58 int32_t UMAPrivate::HistogramEnumeration(const std::string& name, |
| 59 int32_t sample, |
| 60 int32_t boundary_value) const { |
| 61 if (!has_interface<PPB_UMA_Private_0_2>()) |
| 62 return PP_ERROR_NOINTERFACE; |
| 63 get_interface<PPB_UMA_Private_0_2>()-> |
| 64 HistogramEnumeration(instance_, pp::Var(name).pp_var(), |
| 65 sample, boundary_value); |
| 66 return PP_OK; |
| 67 } |
| 68 |
| 69 } // namespace pp |
OLD | NEW |