Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / ppapi / thunk / ppb_instance_thunk.cc
blobd8117fa1a415d7b79320a628bf209de476859fef
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/thunk/thunk.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_instance_api.h"
8 #include "ppapi/thunk/resource_creation_api.h"
10 namespace ppapi {
11 namespace thunk {
13 namespace {
15 PP_Var GetWindowObject(PP_Instance instance) {
16 EnterInstance enter(instance);
17 if (enter.failed())
18 return PP_MakeUndefined();
19 return enter.functions()->GetWindowObject(instance);
22 PP_Var GetOwnerElementObject(PP_Instance instance) {
23 EnterInstance enter(instance);
24 if (enter.failed())
25 return PP_MakeUndefined();
26 return enter.functions()->GetOwnerElementObject(instance);
29 PP_Bool BindGraphics(PP_Instance instance, PP_Resource graphics_id) {
30 EnterInstance enter(instance);
31 if (enter.failed())
32 return PP_FALSE;
33 return enter.functions()->BindGraphics(instance, graphics_id);
36 PP_Bool IsFullFrame(PP_Instance instance) {
37 EnterInstance enter(instance);
38 if (enter.failed())
39 return PP_FALSE;
40 return enter.functions()->IsFullFrame(instance);
43 PP_Var ExecuteScript(PP_Instance instance,
44 PP_Var script,
45 PP_Var* exception) {
46 EnterInstance enter(instance);
47 if (enter.failed())
48 return PP_MakeUndefined();
49 return enter.functions()->ExecuteScript(instance, script, exception);
52 const PPB_Instance g_ppb_instance_thunk = {
53 &BindGraphics,
54 &IsFullFrame
57 const PPB_Instance_Private g_ppb_instance_private_thunk = {
58 &GetWindowObject,
59 &GetOwnerElementObject,
60 &ExecuteScript
63 } // namespace
65 const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk() {
66 return &g_ppb_instance_thunk;
68 const PPB_Instance_Private_0_1* GetPPB_Instance_Private_0_1_Thunk() {
69 return &g_ppb_instance_private_thunk;
72 } // namespace thunk
73 } // namespace ppapi