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 Mon Jun 24 15:10:54 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/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_host_resolver_api.h"
20 PP_Resource
Create(PP_Instance instance
) {
21 VLOG(4) << "PPB_HostResolver::Create()";
22 EnterResourceCreation
enter(instance
);
25 return enter
.functions()->CreateHostResolver(instance
);
28 PP_Bool
IsHostResolver(PP_Resource resource
) {
29 VLOG(4) << "PPB_HostResolver::IsHostResolver()";
30 EnterResource
<PPB_HostResolver_API
> enter(resource
, false);
31 return PP_FromBool(enter
.succeeded());
34 int32_t Resolve(PP_Resource host_resolver
,
37 const struct PP_HostResolver_Hint
* hint
,
38 struct PP_CompletionCallback callback
) {
39 VLOG(4) << "PPB_HostResolver::Resolve()";
40 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, callback
, true);
42 return enter
.retval();
43 return enter
.SetResult(
44 enter
.object()->Resolve(host
, port
, hint
, enter
.callback()));
47 struct PP_Var
GetCanonicalName(PP_Resource host_resolver
) {
48 VLOG(4) << "PPB_HostResolver::GetCanonicalName()";
49 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
51 return PP_MakeUndefined();
52 return enter
.object()->GetCanonicalName();
55 uint32_t GetNetAddressCount(PP_Resource host_resolver
) {
56 VLOG(4) << "PPB_HostResolver::GetNetAddressCount()";
57 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
60 return enter
.object()->GetNetAddressCount();
63 PP_Resource
GetNetAddress(PP_Resource host_resolver
, uint32_t index
) {
64 VLOG(4) << "PPB_HostResolver::GetNetAddress()";
65 EnterResource
<PPB_HostResolver_API
> enter(host_resolver
, true);
68 return enter
.object()->GetNetAddress(index
);
71 const PPB_HostResolver_1_0 g_ppb_hostresolver_thunk_1_0
= {&Create
,
80 PPAPI_THUNK_EXPORT
const PPB_HostResolver_1_0
* GetPPB_HostResolver_1_0_Thunk() {
81 return &g_ppb_hostresolver_thunk_1_0
;