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/proxy/uma_private_resource.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "ppapi/proxy/ppapi_messages.h" | |
9 #include "ppapi/proxy/resource_message_params.h" | |
10 #include "ppapi/shared_impl/host_resource.h" | |
yzshen1
2013/12/04 19:32:51
this is not necessary, right?
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
11 #include "ppapi/shared_impl/var.h" | |
12 #include "ppapi/thunk/enter.h" | |
yzshen1
2013/12/04 19:32:51
ditto
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
13 | |
14 namespace { | |
15 | |
16 std::string StringFromPPVar(PP_Var var) { | |
yzshen1
2013/12/04 19:32:51
const &, please.
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
17 scoped_refptr<ppapi::StringVar> name_stringvar = | |
18 ppapi::StringVar::FromPPVar(var); | |
yzshen1
2013/12/04 19:32:51
Please check NULL before using it.
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
19 return name_stringvar->value(); | |
20 } | |
21 | |
22 } | |
23 | |
24 namespace ppapi { | |
25 namespace proxy { | |
26 | |
27 UMAPrivateResource::UMAPrivateResource( | |
28 Connection connection, PP_Instance instance) | |
29 : PluginResource(connection, instance) { | |
30 SendCreate(RENDERER, PpapiHostMsg_UMA_Create()); | |
31 } | |
32 | |
33 UMAPrivateResource::~UMAPrivateResource() { | |
34 } | |
35 | |
36 thunk::PPB_UMA_Singleton_API* UMAPrivateResource::AsPPB_UMA_Singleton_API() { | |
37 return this; | |
38 } | |
39 | |
40 void UMAPrivateResource::HistogramCustomTimes( | |
41 PP_Instance instance, | |
42 struct PP_Var name, | |
43 int64_t sample, | |
44 int64_t min, | |
45 int64_t max, | |
46 uint32_t bucket_count) { | |
47 | |
yzshen1
2013/12/04 19:32:51
no need to have this line (all methods below)
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
48 if (name.type != PP_VARTYPE_STRING) | |
49 return; | |
50 | |
51 Post(RENDERER, PpapiHostMsg_UMA_HistogramCustomTimes(StringFromPPVar(name), | |
52 sample, | |
53 min, | |
yzshen1
2013/12/04 19:32:51
wrong indent (all methods below)
elijahtaylor1
2013/12/21 02:26:21
Done.
| |
54 max, | |
55 bucket_count)); | |
56 } | |
57 | |
58 void UMAPrivateResource::HistogramCustomCounts( | |
59 PP_Instance instance, | |
60 struct PP_Var name, | |
61 int32_t sample, | |
62 int32_t min, | |
63 int32_t max, | |
64 uint32_t bucket_count) { | |
65 | |
66 if (name.type != PP_VARTYPE_STRING) | |
67 return; | |
68 | |
69 Post(RENDERER, PpapiHostMsg_UMA_HistogramCustomCounts(StringFromPPVar(name), | |
70 sample, | |
71 min, | |
72 max, | |
73 bucket_count)); | |
74 } | |
75 | |
76 void UMAPrivateResource::HistogramEnumeration( | |
77 PP_Instance instance, | |
78 struct PP_Var name, | |
79 int32_t sample, | |
80 int32_t boundary_value) { | |
81 | |
82 if (name.type != PP_VARTYPE_STRING) | |
83 return; | |
84 | |
85 Post(RENDERER, PpapiHostMsg_UMA_HistogramEnumeration(StringFromPPVar(name), | |
86 sample, | |
87 boundary_value)); | |
88 } | |
89 | |
90 } // namespace proxy | |
91 } // namespace ppapi | |
92 | |
OLD | NEW |