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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 virtual ~AbortCallbackTask() {} | 42 virtual ~AbortCallbackTask() {} |
43 virtual void Run() { | 43 virtual void Run() { |
44 if (callback_.func) | 44 if (callback_.func) |
45 PP_RunCompletionCallback(&callback_, PP_ERROR_ABORTED); | 45 PP_RunCompletionCallback(&callback_, PP_ERROR_ABORTED); |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 PP_CompletionCallback callback_; | 49 PP_CompletionCallback callback_; |
50 }; | 50 }; |
51 | 51 |
52 InterfaceProxy* CreateFlashTCPSocketProxy(Dispatcher* dispatcher) { | 52 InterfaceProxy* CreateFlashTCPSocketProxy(Dispatcher* dispatcher, |
53 return new PPB_Flash_TCPSocket_Proxy(dispatcher); | 53 const void* target_interface) { |
| 54 return new PPB_Flash_TCPSocket_Proxy(dispatcher, target_interface); |
54 } | 55 } |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 class FlashTCPSocket : public PPB_Flash_TCPSocket_API, | 59 class FlashTCPSocket : public PPB_Flash_TCPSocket_API, |
59 public Resource { | 60 public Resource { |
60 public: | 61 public: |
61 FlashTCPSocket(const HostResource& resource, uint32 socket_id); | 62 FlashTCPSocket(const HostResource& resource, uint32 socket_id); |
62 virtual ~FlashTCPSocket(); | 63 virtual ~FlashTCPSocket(); |
63 | 64 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 PP_CompletionCallback* callback) { | 382 PP_CompletionCallback* callback) { |
382 DCHECK(callback); | 383 DCHECK(callback); |
383 | 384 |
384 if (callback->func) { | 385 if (callback->func) { |
385 MessageLoop::current()->PostTask(FROM_HERE, | 386 MessageLoop::current()->PostTask(FROM_HERE, |
386 new AbortCallbackTask(*callback)); | 387 new AbortCallbackTask(*callback)); |
387 *callback = PP_BlockUntilComplete(); | 388 *callback = PP_BlockUntilComplete(); |
388 } | 389 } |
389 } | 390 } |
390 | 391 |
391 PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy(Dispatcher* dispatcher) | 392 PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy( |
392 : InterfaceProxy(dispatcher) { | 393 Dispatcher* dispatcher, |
| 394 const void* target_interface) |
| 395 : InterfaceProxy(dispatcher, target_interface) { |
393 } | 396 } |
394 | 397 |
395 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { | 398 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { |
396 } | 399 } |
397 | 400 |
398 // static | 401 // static |
399 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { | 402 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { |
400 static const Info info = { | 403 static const Info info = { |
401 thunk::GetPPB_Flash_TCPSocket_Thunk(), | 404 thunk::GetPPB_Flash_TCPSocket_Thunk(), |
402 PPB_FLASH_TCPSOCKET_INTERFACE, | 405 PPB_FLASH_TCPSOCKET_INTERFACE, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 return; | 493 return; |
491 } | 494 } |
492 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 495 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
493 if (iter == g_id_to_socket->end()) | 496 if (iter == g_id_to_socket->end()) |
494 return; | 497 return; |
495 iter->second->OnWriteCompleted(succeeded, bytes_written); | 498 iter->second->OnWriteCompleted(succeeded, bytes_written); |
496 } | 499 } |
497 | 500 |
498 } // namespace proxy | 501 } // namespace proxy |
499 } // namespace ppapi | 502 } // namespace ppapi |
OLD | NEW |