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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 void WebSocketResource::OnReplyReceived( | 323 void WebSocketResource::OnReplyReceived( |
324 const ResourceMessageReplyParams& params, | 324 const ResourceMessageReplyParams& params, |
325 const IPC::Message& msg) { | 325 const IPC::Message& msg) { |
326 if (params.sequence()) { | 326 if (params.sequence()) { |
327 PluginResource::OnReplyReceived(params, msg); | 327 PluginResource::OnReplyReceived(params, msg); |
328 return; | 328 return; |
329 } | 329 } |
330 | 330 |
331 IPC_BEGIN_MESSAGE_MAP(WebSocketResource, msg) | 331 PPAPI_BEGIN_MESSAGE_MAP(WebSocketResource, msg) |
332 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( | 332 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( |
333 PpapiPluginMsg_WebSocket_ReceiveTextReply, | 333 PpapiPluginMsg_WebSocket_ReceiveTextReply, |
334 OnPluginMsgReceiveTextReply) | 334 OnPluginMsgReceiveTextReply) |
335 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( | 335 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( |
336 PpapiPluginMsg_WebSocket_ReceiveBinaryReply, | 336 PpapiPluginMsg_WebSocket_ReceiveBinaryReply, |
337 OnPluginMsgReceiveBinaryReply) | 337 OnPluginMsgReceiveBinaryReply) |
338 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_0( | 338 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_0( |
339 PpapiPluginMsg_WebSocket_ErrorReply, | 339 PpapiPluginMsg_WebSocket_ErrorReply, |
340 OnPluginMsgErrorReply) | 340 OnPluginMsgErrorReply) |
341 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( | 341 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( |
342 PpapiPluginMsg_WebSocket_BufferedAmountReply, | 342 PpapiPluginMsg_WebSocket_BufferedAmountReply, |
343 OnPluginMsgBufferedAmountReply) | 343 OnPluginMsgBufferedAmountReply) |
344 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( | 344 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( |
345 PpapiPluginMsg_WebSocket_StateReply, | 345 PpapiPluginMsg_WebSocket_StateReply, |
346 OnPluginMsgStateReply) | 346 OnPluginMsgStateReply) |
347 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( | 347 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL( |
348 PpapiPluginMsg_WebSocket_ClosedReply, | 348 PpapiPluginMsg_WebSocket_ClosedReply, |
349 OnPluginMsgClosedReply) | 349 OnPluginMsgClosedReply) |
350 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_UNHANDLED(NOTREACHED()) | 350 PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_UNHANDLED(NOTREACHED()) |
351 IPC_END_MESSAGE_MAP() | 351 PPAPI_END_MESSAGE_MAP() |
352 } | 352 } |
353 | 353 |
354 void WebSocketResource::OnPluginMsgConnectReply( | 354 void WebSocketResource::OnPluginMsgConnectReply( |
355 const ResourceMessageReplyParams& params, | 355 const ResourceMessageReplyParams& params, |
356 const std::string& url, | 356 const std::string& url, |
357 const std::string& protocol) { | 357 const std::string& protocol) { |
358 if (!TrackedCallback::IsPending(connect_callback_) || | 358 if (!TrackedCallback::IsPending(connect_callback_) || |
359 TrackedCallback::IsScheduledToRun(connect_callback_)) { | 359 TrackedCallback::IsScheduledToRun(connect_callback_)) { |
360 return; | 360 return; |
361 } | 361 } |
(...skipping 115 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 |