OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/thunk/enter.h" | 6 #include "ppapi/thunk/enter.h" |
7 #include "ppapi/thunk/thunk.h" | 7 #include "ppapi/thunk/thunk.h" |
8 #include "ppapi/thunk/ppb_network_monitor_private_api.h" | 8 #include "ppapi/thunk/ppb_network_monitor_private_api.h" |
9 #include "ppapi/thunk/resource_creation_api.h" | 9 #include "ppapi/thunk/resource_creation_api.h" |
10 | 10 |
11 namespace ppapi { | 11 namespace ppapi { |
12 namespace thunk { | 12 namespace thunk { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor; | 16 typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor; |
17 | 17 |
18 PP_Resource Create(PP_Instance instance, | 18 PP_Resource Create(PP_Instance instance) { |
yzshen1
2013/09/04 19:52:01
FYI: You could use [generate_thunk] in the idl fil
Sergey Ulanov
2013/09/04 22:22:32
Done.
| |
19 PPB_NetworkMonitor_Callback callback, | |
20 void* user_data) { | |
21 EnterResourceCreation enter(instance); | 19 EnterResourceCreation enter(instance); |
22 if (enter.failed()) | 20 if (enter.failed()) |
23 return 0; | 21 return 0; |
24 return enter.functions()->CreateNetworkMonitor(instance, callback, user_data); | 22 return enter.functions()->CreateNetworkMonitor(instance); |
23 } | |
24 | |
25 int32_t UpdateNetworkList(PP_Resource network_monitor, | |
26 PP_Resource* network_list, | |
27 struct PP_CompletionCallback callback) { | |
28 EnterNetworkMonitor enter(network_monitor, callback, true); | |
29 if (enter.failed()) | |
30 return enter.retval(); | |
31 return enter.SetResult(enter.object()->UpdateNetworkList( | |
32 network_list, enter.callback())); | |
25 } | 33 } |
26 | 34 |
27 PP_Bool IsNetworkMonitor(PP_Resource resource) { | 35 PP_Bool IsNetworkMonitor(PP_Resource resource) { |
28 EnterNetworkMonitor enter(resource, false); | 36 EnterNetworkMonitor enter(resource, false); |
29 return PP_FromBool(enter.succeeded()); | 37 return PP_FromBool(enter.succeeded()); |
30 } | 38 } |
31 | 39 |
32 const PPB_NetworkMonitor_Private g_ppb_network_monitor_private_thunk = { | 40 const PPB_NetworkMonitor_Private g_ppb_network_monitor_private_thunk = { |
33 &Create, | 41 &Create, |
42 &UpdateNetworkList, | |
34 &IsNetworkMonitor, | 43 &IsNetworkMonitor, |
35 }; | 44 }; |
36 | 45 |
37 } // namespace | 46 } // namespace |
38 | 47 |
39 const PPB_NetworkMonitor_Private_0_2* | 48 const PPB_NetworkMonitor_Private_0_3* |
40 GetPPB_NetworkMonitor_Private_0_2_Thunk() { | 49 GetPPB_NetworkMonitor_Private_0_3_Thunk() { |
41 return &g_ppb_network_monitor_private_thunk; | 50 return &g_ppb_network_monitor_private_thunk; |
42 } | 51 } |
43 | 52 |
44 } // namespace thunk | 53 } // namespace thunk |
45 } // namespace ppapi | 54 } // namespace ppapi |
OLD | NEW |