ppb_uma_private_thunk.cc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright (c) 2012 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. // From private/ppb_uma_private.idl modified Wed Jan 27 17:10:16 2016.
  5. #include <stdint.h>
  6. #include "base/logging.h"
  7. #include "ppapi/c/pp_completion_callback.h"
  8. #include "ppapi/c/pp_errors.h"
  9. #include "ppapi/c/private/ppb_uma_private.h"
  10. #include "ppapi/shared_impl/tracked_callback.h"
  11. #include "ppapi/thunk/enter.h"
  12. #include "ppapi/thunk/ppapi_thunk_export.h"
  13. #include "ppapi/thunk/ppb_uma_singleton_api.h"
  14. namespace ppapi {
  15. namespace thunk {
  16. namespace {
  17. void HistogramCustomTimes(PP_Instance instance,
  18. struct PP_Var name,
  19. int64_t sample,
  20. int64_t min,
  21. int64_t max,
  22. uint32_t bucket_count) {
  23. VLOG(4) << "PPB_UMA_Private::HistogramCustomTimes()";
  24. EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  25. if (enter.failed())
  26. return;
  27. enter.functions()->HistogramCustomTimes(instance, name, sample, min, max,
  28. bucket_count);
  29. }
  30. void HistogramCustomCounts(PP_Instance instance,
  31. struct PP_Var name,
  32. int32_t sample,
  33. int32_t min,
  34. int32_t max,
  35. uint32_t bucket_count) {
  36. VLOG(4) << "PPB_UMA_Private::HistogramCustomCounts()";
  37. EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  38. if (enter.failed())
  39. return;
  40. enter.functions()->HistogramCustomCounts(instance, name, sample, min, max,
  41. bucket_count);
  42. }
  43. void HistogramEnumeration(PP_Instance instance,
  44. struct PP_Var name,
  45. int32_t sample,
  46. int32_t boundary_value) {
  47. VLOG(4) << "PPB_UMA_Private::HistogramEnumeration()";
  48. EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  49. if (enter.failed())
  50. return;
  51. enter.functions()->HistogramEnumeration(instance, name, sample,
  52. boundary_value);
  53. }
  54. int32_t IsCrashReportingEnabled(PP_Instance instance,
  55. struct PP_CompletionCallback callback) {
  56. VLOG(4) << "PPB_UMA_Private::IsCrashReportingEnabled()";
  57. EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance, callback);
  58. if (enter.failed())
  59. return enter.retval();
  60. return enter.SetResult(
  61. enter.functions()->IsCrashReportingEnabled(instance, enter.callback()));
  62. }
  63. const PPB_UMA_Private_0_3 g_ppb_uma_private_thunk_0_3 = {
  64. &HistogramCustomTimes, &HistogramCustomCounts, &HistogramEnumeration,
  65. &IsCrashReportingEnabled};
  66. } // namespace
  67. PPAPI_THUNK_EXPORT const PPB_UMA_Private_0_3* GetPPB_UMA_Private_0_3_Thunk() {
  68. return &g_ppb_uma_private_thunk_0_3;
  69. }
  70. } // namespace thunk
  71. } // namespace ppapi