1 // Copyright 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.
5 // From ppb_host_resolver.idl modified Thu Jun 20 15:36:07 2013.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_host_resolver.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppb_host_resolver_api.h"
13 #include "ppapi/thunk/ppb_instance_api.h"
14 #include "ppapi/thunk/resource_creation_api.h"
15 #include "ppapi/thunk/thunk.h"
22 PP_Resource
Create(PP_Instance instance
) {
23 VLOG(4) << "PPB_HostResolver::Create()";
24 EnterResourceCreation
enter(instance
);
27 return enter
.functions()->CreateHostResolver(instance
);
30 PP_Bool
IsHostResolver(PP_Resource resource
) {
31 VLOG(4) << "PPB_HostResolver::IsHostResolver()";
32 EnterResource
<PPB_HostResolver_API
> enter(resource
, false);
33 return PP_FromBool(enter
.succeeded());
36 int32_t Resolve(PP_Resource host_resolver
,
39 const struct PP_HostResolver_Hint
* hint
,
40 struct PP_CompletionCallback callback
) {
41 VLOG(4) << "PPB_HostResolver::Resolve()";
42 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, callback
, true);
44 return enter
.retval();
45 return enter
.SetResult(enter
.object()->Resolve(host
,
51 struct PP_Var
GetCanonicalName(PP_Resource host_resolver
) {
52 VLOG(4) << "PPB_HostResolver::GetCanonicalName()";
53 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
55 return PP_MakeUndefined();
56 return enter
.object()->GetCanonicalName();
59 uint32_t GetNetAddressCount(PP_Resource host_resolver
) {
60 VLOG(4) << "PPB_HostResolver::GetNetAddressCount()";
61 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
64 return enter
.object()->GetNetAddressCount();
67 PP_Resource
GetNetAddress(PP_Resource host_resolver
, uint32_t index
) {
68 VLOG(4) << "PPB_HostResolver::GetNetAddress()";
69 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
72 return enter
.object()->GetNetAddress(index
);
75 const PPB_HostResolver_1_0 g_ppb_hostresolver_thunk_1_0
= {
86 const PPB_HostResolver_1_0
* GetPPB_HostResolver_1_0_Thunk() {
87 return &g_ppb_hostresolver_thunk_1_0
;