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.
5 #include "ppapi/c/pp_var.h"
6 #include "ppapi/c/private/ppb_host_resolver_private.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_host_resolver_private_api.h"
10 #include "ppapi/thunk/resource_creation_api.h"
11 #include "ppapi/thunk/thunk.h"
18 typedef EnterResource
<PPB_HostResolver_Private_API
> EnterHostResolver
;
20 PP_Resource
Create(PP_Instance instance
) {
21 EnterResourceCreation
enter(instance
);
24 return enter
.functions()->CreateHostResolverPrivate(instance
);
27 PP_Bool
IsHostResolver(PP_Resource resource
) {
28 EnterHostResolver
enter(resource
, false);
29 return PP_FromBool(enter
.succeeded());
32 int32_t Resolve(PP_Resource host_resolver
,
35 const PP_HostResolver_Private_Hint
* hint
,
36 PP_CompletionCallback callback
) {
37 EnterHostResolver
enter(host_resolver
, callback
, true);
39 return enter
.retval();
40 return enter
.SetResult(enter
.object()->Resolve(host
, port
, hint
,
44 PP_Var
GetCanonicalName(PP_Resource host_resolver
) {
45 EnterHostResolver
enter(host_resolver
, true);
47 return PP_MakeUndefined();
48 return enter
.object()->GetCanonicalName();
51 uint32_t GetSize(PP_Resource host_resolver
) {
52 EnterHostResolver
enter(host_resolver
, true);
55 return enter
.object()->GetSize();
58 PP_Bool
GetNetAddress(PP_Resource host_resolver
,
60 PP_NetAddress_Private
* addr
) {
61 EnterHostResolver
enter(host_resolver
, true);
64 return PP_FromBool(enter
.object()->GetNetAddress(index
, addr
));
67 const PPB_HostResolver_Private g_ppb_host_resolver_thunk
= {
78 const PPB_HostResolver_Private_0_1
* GetPPB_HostResolver_Private_0_1_Thunk() {
79 return &g_ppb_host_resolver_thunk
;