OLD | NEW |
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/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/c/pp_var.h" | 6 #include "ppapi/c/pp_var.h" |
7 #include "ppapi/thunk/common.h" | 7 #include "ppapi/thunk/common.h" |
8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/ppb_websocket_api.h" | 10 #include "ppapi/thunk/ppb_websocket_api.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 int32_t SendMessage(PP_Resource resource, PP_Var message) { | 64 int32_t SendMessage(PP_Resource resource, PP_Var message) { |
65 EnterResource<PPB_WebSocket_API> enter(resource, false); | 65 EnterResource<PPB_WebSocket_API> enter(resource, false); |
66 if (enter.failed()) | 66 if (enter.failed()) |
67 return PP_ERROR_BADRESOURCE; | 67 return PP_ERROR_BADRESOURCE; |
68 return enter.object()->SendMessage(message); | 68 return enter.object()->SendMessage(message); |
69 } | 69 } |
70 | 70 |
71 uint64_t GetBufferedAmount(PP_Resource resource) { | 71 uint64_t GetBufferedAmount(PP_Resource resource) { |
72 EnterResource<PPB_WebSocket_API> enter(resource, false); | 72 EnterResource<PPB_WebSocket_API> enter(resource, false); |
73 if (enter.failed()) | 73 if (enter.failed()) |
74 return PP_ERROR_BADRESOURCE; | 74 return 0; |
75 return enter.object()->GetBufferedAmount(); | 75 return enter.object()->GetBufferedAmount(); |
76 } | 76 } |
77 | 77 |
78 uint16_t GetCloseCode(PP_Resource resource) { | 78 uint16_t GetCloseCode(PP_Resource resource) { |
79 EnterResource<PPB_WebSocket_API> enter(resource, false); | 79 EnterResource<PPB_WebSocket_API> enter(resource, false); |
80 if (enter.failed()) | 80 if (enter.failed()) |
81 return PP_ERROR_BADRESOURCE; | 81 return 0; |
82 return enter.object()->GetCloseCode(); | 82 return enter.object()->GetCloseCode(); |
83 } | 83 } |
84 | 84 |
85 PP_Var GetCloseReason(PP_Resource resource) { | 85 PP_Var GetCloseReason(PP_Resource resource) { |
86 EnterResource<PPB_WebSocket_API> enter(resource, false); | 86 EnterResource<PPB_WebSocket_API> enter(resource, false); |
87 if (enter.failed()) | 87 if (enter.failed()) |
88 return PP_MakeUndefined(); | 88 return PP_MakeUndefined(); |
89 return enter.object()->GetCloseReason(); | 89 return enter.object()->GetCloseReason(); |
90 } | 90 } |
91 | 91 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { | 180 const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { |
181 return &g_ppb_websocket_0_1_thunk; | 181 return &g_ppb_websocket_0_1_thunk; |
182 } | 182 } |
183 | 183 |
184 const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() { | 184 const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() { |
185 return &g_ppb_websocket_0_9_thunk; | 185 return &g_ppb_websocket_0_9_thunk; |
186 } | 186 } |
187 | 187 |
188 } // namespace thunk | 188 } // namespace thunk |
189 } // namespace ppapi | 189 } // namespace ppapi |
OLD | NEW |