| 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/proxy/websocket_resource.h" | 5 #include "ppapi/proxy/websocket_resource.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 void WebSocketResource::OnPluginMsgReceiveBinaryReply( | 417 void WebSocketResource::OnPluginMsgReceiveBinaryReply( |
| 418 const ResourceMessageReplyParams& params, | 418 const ResourceMessageReplyParams& params, |
| 419 const std::vector<uint8_t>& message) { | 419 const std::vector<uint8_t>& message) { |
| 420 // Dispose packets after receiving an error or in invalid state. | 420 // Dispose packets after receiving an error or in invalid state. |
| 421 if (error_was_received_ || !InValidStateToReceive(state_)) | 421 if (error_was_received_ || !InValidStateToReceive(state_)) |
| 422 return; | 422 return; |
| 423 | 423 |
| 424 // Append received data to queue. | 424 // Append received data to queue. |
| 425 scoped_refptr<Var> message_var( | 425 scoped_refptr<Var> message_var( |
| 426 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferVar( | 426 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferVar( |
| 427 message.size(), | 427 static_cast<uint32_t>(message.size()), |
| 428 &message.front())); | 428 &message.front())); |
| 429 received_messages_.push(message_var); | 429 received_messages_.push(message_var); |
| 430 | 430 |
| 431 if (!TrackedCallback::IsPending(receive_callback_) || | 431 if (!TrackedCallback::IsPending(receive_callback_) || |
| 432 TrackedCallback::IsScheduledToRun(receive_callback_)) { | 432 TrackedCallback::IsScheduledToRun(receive_callback_)) { |
| 433 return; | 433 return; |
| 434 } | 434 } |
| 435 | 435 |
| 436 receive_callback_->Run(DoReceive()); | 436 receive_callback_->Run(DoReceive()); |
| 437 } | 437 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return PP_OK; | 477 return PP_OK; |
| 478 | 478 |
| 479 *receive_callback_var_ = received_messages_.front()->GetPPVar(); | 479 *receive_callback_var_ = received_messages_.front()->GetPPVar(); |
| 480 received_messages_.pop(); | 480 received_messages_.pop(); |
| 481 receive_callback_var_ = NULL; | 481 receive_callback_var_ = NULL; |
| 482 return PP_OK; | 482 return PP_OK; |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace proxy | 485 } // namespace proxy |
| 486 } // namespace ppapi | 486 } // namespace ppapi |
| OLD | NEW |