| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ppb_flash_tcp_socket_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/task.h" | 14 #include "base/task.h" |
| 15 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
| 16 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_resource_tracker.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/shared_impl/resource.h" | 19 #include "ppapi/shared_impl/resource.h" |
| 20 #include "ppapi/thunk/ppb_flash_tcp_socket_api.h" | 20 #include "ppapi/thunk/ppb_flash_tcp_socket_api.h" |
| 21 #include "ppapi/thunk/thunk.h" | 21 #include "ppapi/thunk/thunk.h" |
| 22 | 22 |
| 23 using ppapi::HostResource; | |
| 24 using ppapi::Resource; | |
| 25 using ppapi::thunk::PPB_Flash_TCPSocket_API; | 23 using ppapi::thunk::PPB_Flash_TCPSocket_API; |
| 26 | 24 |
| 27 namespace pp { | 25 namespace ppapi { |
| 28 namespace proxy { | 26 namespace proxy { |
| 29 | 27 |
| 30 const int32_t kFlashTCPSocketMaxReadSize = 1024 * 1024; | 28 const int32_t kFlashTCPSocketMaxReadSize = 1024 * 1024; |
| 31 const int32_t kFlashTCPSocketMaxWriteSize = 1024 * 1024; | 29 const int32_t kFlashTCPSocketMaxWriteSize = 1024 * 1024; |
| 32 | 30 |
| 33 class FlashTCPSocket; | 31 class FlashTCPSocket; |
| 34 | 32 |
| 35 namespace { | 33 namespace { |
| 36 | 34 |
| 37 typedef std::map<uint32, FlashTCPSocket*> IDToSocketMap; | 35 typedef std::map<uint32, FlashTCPSocket*> IDToSocketMap; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 const void* target_interface) | 348 const void* target_interface) |
| 351 : InterfaceProxy(dispatcher, target_interface) { | 349 : InterfaceProxy(dispatcher, target_interface) { |
| 352 } | 350 } |
| 353 | 351 |
| 354 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { | 352 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { |
| 355 } | 353 } |
| 356 | 354 |
| 357 // static | 355 // static |
| 358 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { | 356 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { |
| 359 static const Info info = { | 357 static const Info info = { |
| 360 ::ppapi::thunk::GetPPB_Flash_TCPSocket_Thunk(), | 358 thunk::GetPPB_Flash_TCPSocket_Thunk(), |
| 361 PPB_FLASH_TCPSOCKET_INTERFACE, | 359 PPB_FLASH_TCPSOCKET_INTERFACE, |
| 362 INTERFACE_ID_PPB_FLASH_TCPSOCKET, | 360 INTERFACE_ID_PPB_FLASH_TCPSOCKET, |
| 363 false, | 361 false, |
| 364 &CreateFlashTCPSocketProxy, | 362 &CreateFlashTCPSocketProxy, |
| 365 }; | 363 }; |
| 366 return &info; | 364 return &info; |
| 367 } | 365 } |
| 368 | 366 |
| 369 // static | 367 // static |
| 370 PP_Resource PPB_Flash_TCPSocket_Proxy::CreateProxyResource( | 368 PP_Resource PPB_Flash_TCPSocket_Proxy::CreateProxyResource( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 NOTREACHED(); | 430 NOTREACHED(); |
| 433 return; | 431 return; |
| 434 } | 432 } |
| 435 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 433 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
| 436 if (iter == g_id_to_socket->end()) | 434 if (iter == g_id_to_socket->end()) |
| 437 return; | 435 return; |
| 438 iter->second->OnWriteCompleted(succeeded, bytes_written); | 436 iter->second->OnWriteCompleted(succeeded, bytes_written); |
| 439 } | 437 } |
| 440 | 438 |
| 441 } // namespace proxy | 439 } // namespace proxy |
| 442 } // namespace pp | 440 } // namespace ppapi |
| OLD | NEW |