Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Side by Side Diff: ppapi/thunk/ppb_udp_socket_thunk.cc

Issue 690903002: Remove timing limitation of SetOption invocation for PPAPI sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fixed implementation. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 // From ppb_udp_socket.idl modified Mon Jun 24 15:10:54 2013. 5 // From ppb_udp_socket.idl modified Mon Jun 24 15:10:54 2013.
6 6
7 #include "ppapi/c/pp_completion_callback.h" 7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_udp_socket.h" 9 #include "ppapi/c/ppb_udp_socket.h"
10 #include "ppapi/shared_impl/tracked_callback.h" 10 #include "ppapi/shared_impl/tracked_callback.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 void Close(PP_Resource udp_socket) { 78 void Close(PP_Resource udp_socket) {
79 VLOG(4) << "PPB_UDPSocket::Close()"; 79 VLOG(4) << "PPB_UDPSocket::Close()";
80 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true); 80 EnterResource<PPB_UDPSocket_API> enter(udp_socket, true);
81 if (enter.failed()) 81 if (enter.failed())
82 return; 82 return;
83 enter.object()->Close(); 83 enter.object()->Close();
84 } 84 }
85 85
86 int32_t SetOption1_0(PP_Resource udp_socket,
87 PP_UDPSocket_Option name,
88 struct PP_Var value,
89 struct PP_CompletionCallback callback) {
90 VLOG(4) << "PPB_UDPSocket::SetOption1_0()";
91 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
92 if (enter.failed())
93 return enter.retval();
94 return enter.SetResult(
95 enter.object()->SetOption1_0(name, value, enter.callback()));
96 }
97
86 int32_t SetOption(PP_Resource udp_socket, 98 int32_t SetOption(PP_Resource udp_socket,
87 PP_UDPSocket_Option name, 99 PP_UDPSocket_Option name,
88 struct PP_Var value, 100 struct PP_Var value,
89 struct PP_CompletionCallback callback) { 101 struct PP_CompletionCallback callback) {
90 VLOG(4) << "PPB_UDPSocket::SetOption()"; 102 VLOG(4) << "PPB_UDPSocket::SetOption()";
91 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true); 103 EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
92 if (enter.failed()) 104 if (enter.failed())
93 return enter.retval(); 105 return enter.retval();
94 return enter.SetResult( 106 return enter.SetResult(
95 enter.object()->SetOption(name, value, enter.callback())); 107 enter.object()->SetOption(name, value, enter.callback()));
96 } 108 }
97 109
98 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = {&Create, 110 const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = {
99 &IsUDPSocket, 111 &Create,
100 &Bind, 112 &IsUDPSocket,
101 &GetBoundAddress, 113 &Bind,
102 &RecvFrom, 114 &GetBoundAddress,
103 &SendTo, 115 &RecvFrom,
104 &Close, 116 &SendTo,
105 &SetOption}; 117 &Close,
118 &SetOption1_0
119 };
120
121 const PPB_UDPSocket_1_1 g_ppb_udpsocket_thunk_1_1 = {
122 &Create,
123 &IsUDPSocket,
124 &Bind,
125 &GetBoundAddress,
126 &RecvFrom,
127 &SendTo,
128 &Close,
129 &SetOption
130 };
106 131
107 } // namespace 132 } // namespace
108 133
109 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() { 134 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() {
110 return &g_ppb_udpsocket_thunk_1_0; 135 return &g_ppb_udpsocket_thunk_1_0;
111 } 136 }
112 137
138 PPAPI_THUNK_EXPORT const PPB_UDPSocket_1_1* GetPPB_UDPSocket_1_1_Thunk() {
139 return &g_ppb_udpsocket_thunk_1_1;
140 }
141
113 } // namespace thunk 142 } // namespace thunk
114 } // namespace ppapi 143 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698