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
3 // found in the LICENSE file.
5 #include "ppapi/cpp/private/uma_private.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_uma_private.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/var.h"
17 template <> const char* interface_name
<PPB_UMA_Private_0_3
>() {
18 return PPB_UMA_PRIVATE_INTERFACE_0_3
;
23 UMAPrivate::UMAPrivate() {
26 UMAPrivate::UMAPrivate(
27 const InstanceHandle
& instance
) : instance_(instance
.pp_instance()) {
30 UMAPrivate::~UMAPrivate() {
33 bool UMAPrivate::IsAvailable() {
34 return has_interface
<PPB_UMA_Private_0_3
>();
37 void UMAPrivate::HistogramCustomTimes(const std::string
& name
,
41 uint32_t bucket_count
) {
44 get_interface
<PPB_UMA_Private_0_3
>()->
45 HistogramCustomTimes(instance_
, pp::Var(name
).pp_var(),
46 sample
, min
, max
, bucket_count
);
49 void UMAPrivate::HistogramCustomCounts(const std::string
& name
,
53 uint32_t bucket_count
) {
56 get_interface
<PPB_UMA_Private_0_3
>()->
57 HistogramCustomCounts(instance_
, pp::Var(name
).pp_var(),
58 sample
, min
, max
, bucket_count
);
61 void UMAPrivate::HistogramEnumeration(const std::string
& name
,
63 int32_t boundary_value
) {
66 get_interface
<PPB_UMA_Private_0_3
>()->
67 HistogramEnumeration(instance_
, pp::Var(name
).pp_var(),
68 sample
, boundary_value
);
71 int32_t UMAPrivate::IsCrashReportingEnabled(const CompletionCallback
& cc
) {
73 return PP_ERROR_NOINTERFACE
;
75 return get_interface
<PPB_UMA_Private_0_3
>()->
76 IsCrashReportingEnabled(instance_
, cc
.pp_completion_callback());