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

Side by Side Diff: webkit/plugins/ppapi/ppb_websocket_impl.cc

Issue 10169036: WebSocket Pepper API: the second Close() should not return error code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix grammar nits Created 8 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/plugins/ppapi/ppb_websocket_impl.h" 5 #include "webkit/plugins/ppapi/ppb_websocket_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (reason.type != PP_VARTYPE_UNDEFINED) { 229 if (reason.type != PP_VARTYPE_UNDEFINED) {
230 // Validate |reason|. 230 // Validate |reason|.
231 reason_string = StringVar::FromPPVar(reason); 231 reason_string = StringVar::FromPPVar(reason);
232 if (!reason_string || 232 if (!reason_string ||
233 reason_string->value().size() > kMaxReasonSizeInBytes) 233 reason_string->value().size() > kMaxReasonSizeInBytes)
234 return PP_ERROR_BADARGUMENT; 234 return PP_ERROR_BADARGUMENT;
235 web_reason = WebString::fromUTF8(reason_string->value()); 235 web_reason = WebString::fromUTF8(reason_string->value());
236 } 236 }
237 237
238 // Check state. 238 // Check state.
239 if (state_ == PP_WEBSOCKETREADYSTATE_CLOSING || 239 if (state_ == PP_WEBSOCKETREADYSTATE_CLOSING)
240 state_ == PP_WEBSOCKETREADYSTATE_CLOSED)
241 return PP_ERROR_INPROGRESS; 240 return PP_ERROR_INPROGRESS;
241 if (state_ == PP_WEBSOCKETREADYSTATE_CLOSED)
242 return PP_OK;
242 243
243 // Validate |callback| (Doesn't support blocking callback) 244 // Validate |callback| (Doesn't support blocking callback)
244 if (!callback.func) 245 if (!callback.func)
245 return PP_ERROR_BLOCKS_MAIN_THREAD; 246 return PP_ERROR_BLOCKS_MAIN_THREAD;
246 247
247 // Install |callback|. 248 // Install |callback|.
248 close_callback_ = new TrackedCallback(this, callback); 249 close_callback_ = new TrackedCallback(this, callback);
249 250
250 // Abort ongoing connect. 251 // Abort ongoing connect.
251 if (state_ == PP_WEBSOCKETREADYSTATE_CONNECTING) { 252 if (state_ == PP_WEBSOCKETREADYSTATE_CONNECTING) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 529
529 *receive_callback_var_ = received_messages_.front()->GetPPVar(); 530 *receive_callback_var_ = received_messages_.front()->GetPPVar();
530 received_messages_.pop(); 531 received_messages_.pop();
531 receive_callback_var_ = NULL; 532 receive_callback_var_ = NULL;
532 wait_for_receive_ = false; 533 wait_for_receive_ = false;
533 return PP_OK; 534 return PP_OK;
534 } 535 }
535 536
536 } // namespace ppapi 537 } // namespace ppapi
537 } // namespace webkit 538 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698