Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Side by Side Diff: ppapi/thunk/ppb_network_monitor_private_thunk.cc

Issue 23453025: Refactor PPB_NetworkMonitor_Private interface to use CompletionCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/ppb_network_monitor_private_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // From private/ppb_network_monitor_private.idl,
6 // modified Wed Sep 4 14:16:07 2013.
7
8 #include "ppapi/c/pp_completion_callback.h"
5 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/private/ppb_network_monitor_private.h"
11 #include "ppapi/shared_impl/tracked_callback.h"
6 #include "ppapi/thunk/enter.h" 12 #include "ppapi/thunk/enter.h"
13 #include "ppapi/thunk/ppb_instance_api.h"
14 #include "ppapi/thunk/ppb_network_monitor_api.h"
15 #include "ppapi/thunk/resource_creation_api.h"
7 #include "ppapi/thunk/thunk.h" 16 #include "ppapi/thunk/thunk.h"
8 #include "ppapi/thunk/ppb_network_monitor_private_api.h"
9 #include "ppapi/thunk/resource_creation_api.h"
10 17
11 namespace ppapi { 18 namespace ppapi {
12 namespace thunk { 19 namespace thunk {
13 20
14 namespace { 21 namespace {
15 22
16 typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor; 23 PP_Resource Create(PP_Instance instance) {
17 24 VLOG(4) << "PPB_NetworkMonitor_Private::Create()";
18 PP_Resource Create(PP_Instance instance,
19 PPB_NetworkMonitor_Callback callback,
20 void* user_data) {
21 EnterResourceCreation enter(instance); 25 EnterResourceCreation enter(instance);
22 if (enter.failed()) 26 if (enter.failed())
23 return 0; 27 return 0;
24 return enter.functions()->CreateNetworkMonitor(instance, callback, user_data); 28 return enter.functions()->CreateNetworkMonitorPrivate(instance);
29 }
30
31 int32_t UpdateNetworkList(PP_Resource network_monitor,
32 PP_Resource* network_list,
33 struct PP_CompletionCallback callback) {
34 VLOG(4) << "PPB_NetworkMonitor_Private::UpdateNetworkList()";
35 EnterResource<PPB_NetworkMonitor_API> enter(network_monitor, callback, true);
36 if (enter.failed())
37 return enter.retval();
38 return enter.SetResult(enter.object()->UpdateNetworkList(network_list,
39 enter.callback()));
25 } 40 }
26 41
27 PP_Bool IsNetworkMonitor(PP_Resource resource) { 42 PP_Bool IsNetworkMonitor(PP_Resource resource) {
28 EnterNetworkMonitor enter(resource, false); 43 VLOG(4) << "PPB_NetworkMonitor_Private::IsNetworkMonitor()";
44 EnterResource<PPB_NetworkMonitor_API> enter(resource, false);
29 return PP_FromBool(enter.succeeded()); 45 return PP_FromBool(enter.succeeded());
30 } 46 }
31 47
32 const PPB_NetworkMonitor_Private g_ppb_network_monitor_private_thunk = { 48 const PPB_NetworkMonitor_Private_0_3 g_ppb_networkmonitor_private_thunk_0_3 = {
33 &Create, 49 &Create,
34 &IsNetworkMonitor, 50 &UpdateNetworkList,
51 &IsNetworkMonitor
35 }; 52 };
36 53
37 } // namespace 54 } // namespace
38 55
39 const PPB_NetworkMonitor_Private_0_2* 56 const PPB_NetworkMonitor_Private_0_3*
40 GetPPB_NetworkMonitor_Private_0_2_Thunk() { 57 GetPPB_NetworkMonitor_Private_0_3_Thunk() {
41 return &g_ppb_network_monitor_private_thunk; 58 return &g_ppb_networkmonitor_private_thunk_0_3;
42 } 59 }
43 60
44 } // namespace thunk 61 } // namespace thunk
45 } // namespace ppapi 62 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_network_monitor_private_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698