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

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

Issue 9113044: Convert to new enter method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PATCH DESCRIPTIONS ARE A STUPID WASTE OF TIME Created 8 years, 10 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_audio_trusted_thunk.cc ('k') | ppapi/thunk/ppb_buffer_trusted_thunk.cc » ('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 #include "ppapi/c/trusted/ppb_broker_trusted.h" 5 #include "ppapi/c/trusted/ppb_broker_trusted.h"
6 #include "ppapi/c/pp_errors.h" 6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/thunk/common.h"
8 #include "ppapi/thunk/enter.h" 7 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h" 8 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/ppb_broker_api.h" 9 #include "ppapi/thunk/ppb_broker_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 10 #include "ppapi/thunk/resource_creation_api.h"
12 11
13 namespace ppapi { 12 namespace ppapi {
14 namespace thunk { 13 namespace thunk {
15 14
16 namespace { 15 namespace {
17 16
18 PP_Resource CreateTrusted(PP_Instance instance) { 17 PP_Resource CreateTrusted(PP_Instance instance) {
19 EnterFunction<ResourceCreationAPI> enter(instance, true); 18 EnterFunction<ResourceCreationAPI> enter(instance, true);
20 if (enter.failed()) 19 if (enter.failed())
21 return 0; 20 return 0;
22 return enter.functions()->CreateBroker(instance); 21 return enter.functions()->CreateBroker(instance);
23 } 22 }
24 23
25 PP_Bool IsBrokerTrusted(PP_Resource resource) { 24 PP_Bool IsBrokerTrusted(PP_Resource resource) {
26 EnterResource<PPB_Broker_API> enter(resource, false); 25 EnterResource<PPB_Broker_API> enter(resource, false);
27 return PP_FromBool(enter.succeeded()); 26 return PP_FromBool(enter.succeeded());
28 } 27 }
29 28
30 int32_t Connect(PP_Resource resource, 29 int32_t Connect(PP_Resource resource,
31 PP_CompletionCallback connect_callback) { 30 PP_CompletionCallback callback) {
32 EnterResource<PPB_Broker_API> enter(resource, true); 31 EnterResource<PPB_Broker_API> enter(resource, callback, true);
33 if (enter.failed()) 32 if (enter.failed())
34 return MayForceCallback(connect_callback, PP_ERROR_BADRESOURCE); 33 return enter.retval();
35 int32_t result = enter.object()->Connect(connect_callback); 34 return enter.SetResult(enter.object()->Connect(callback));
36 return MayForceCallback(connect_callback, result);
37 } 35 }
38 36
39 int32_t GetHandle(PP_Resource resource, int32_t* handle) { 37 int32_t GetHandle(PP_Resource resource, int32_t* handle) {
40 EnterResource<PPB_Broker_API> enter(resource, true); 38 EnterResource<PPB_Broker_API> enter(resource, true);
41 if (enter.failed()) 39 if (enter.failed())
42 return PP_ERROR_BADRESOURCE; 40 return enter.retval();
43 return enter.object()->GetHandle(handle); 41 return enter.object()->GetHandle(handle);
44 } 42 }
45 43
46 const PPB_BrokerTrusted g_ppb_broker_thunk = { 44 const PPB_BrokerTrusted g_ppb_broker_thunk = {
47 &CreateTrusted, 45 &CreateTrusted,
48 &IsBrokerTrusted, 46 &IsBrokerTrusted,
49 &Connect, 47 &Connect,
50 &GetHandle, 48 &GetHandle,
51 }; 49 };
52 50
53 } // namespace 51 } // namespace
54 52
55 const PPB_BrokerTrusted_0_2* GetPPB_BrokerTrusted_0_2_Thunk() { 53 const PPB_BrokerTrusted_0_2* GetPPB_BrokerTrusted_0_2_Thunk() {
56 return &g_ppb_broker_thunk; 54 return &g_ppb_broker_thunk;
57 } 55 }
58 56
59 } // namespace thunk 57 } // namespace thunk
60 } // namespace ppapi 58 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_audio_trusted_thunk.cc ('k') | ppapi/thunk/ppb_buffer_trusted_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698