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

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

Issue 8956008: WebSocket Pepper API: C++ utility class implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add unit tests Created 8 years, 11 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
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 switch (binary_type) { 418 switch (binary_type) {
419 case PP_WEBSOCKETBINARYTYPE_BLOB_DEV: 419 case PP_WEBSOCKETBINARYTYPE_BLOB_DEV:
420 binary_type_ = WebSocket::BinaryTypeBlob; 420 binary_type_ = WebSocket::BinaryTypeBlob;
421 break; 421 break;
422 case PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV: 422 case PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV:
423 binary_type_ = WebSocket::BinaryTypeArrayBuffer; 423 binary_type_ = WebSocket::BinaryTypeArrayBuffer;
424 break; 424 break;
425 default: 425 default:
426 return PP_FALSE; 426 return PP_FALSE;
427 } 427 }
428 if (!websocket_.get()) 428 // WebKit API setBinaryType() is called when Connect() is called.
429 return PP_FALSE; 429 // If the websocket_ contains an object; it means Connect() is already
430 websocket_->setBinaryType(binary_type_); 430 // called, call WebKit API here to reflect the setting as soon as possible.
431 if (websocket_.get())
432 websocket_->setBinaryType(binary_type_);
dmichael (off chromium) 2012/02/01 23:05:18 This looks like leftovers from another CL?
Takashi Toyoshima 2012/02/03 07:58:27 Yes. This difference was removed in the next patch
431 return PP_TRUE; 433 return PP_TRUE;
432 } 434 }
433 435
434 PP_WebSocketBinaryType_Dev PPB_WebSocket_Impl::GetBinaryType() { 436 PP_WebSocketBinaryType_Dev PPB_WebSocket_Impl::GetBinaryType() {
435 switch (binary_type_) { 437 switch (binary_type_) {
436 case WebSocket::BinaryTypeBlob: 438 case WebSocket::BinaryTypeBlob:
437 return PP_WEBSOCKETBINARYTYPE_BLOB_DEV; 439 return PP_WEBSOCKETBINARYTYPE_BLOB_DEV;
438 case WebSocket::BinaryTypeArrayBuffer: 440 case WebSocket::BinaryTypeArrayBuffer:
439 return PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV; 441 return PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV;
440 default: 442 default:
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 559
558 *receive_callback_var_ = received_messages_.front()->GetPPVar(); 560 *receive_callback_var_ = received_messages_.front()->GetPPVar();
559 received_messages_.pop(); 561 received_messages_.pop();
560 receive_callback_var_ = NULL; 562 receive_callback_var_ = NULL;
561 wait_for_receive_ = false; 563 wait_for_receive_ = false;
562 return PP_OK; 564 return PP_OK;
563 } 565 }
564 566
565 } // namespace ppapi 567 } // namespace ppapi
566 } // namespace webkit 568 } // namespace webkit
OLDNEW
« ppapi/utility/websocket/websocket_api.cc ('K') | « ppapi/utility/websocket/websocket_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698