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

Side by Side Diff: ppapi/proxy/ppb_flash_tcp_socket_proxy.cc

Issue 7740038: Use macros to define pepper interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New patch Created 9 years, 3 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
« no previous file with comments | « ppapi/proxy/ppb_flash_tcp_socket_proxy.h ('k') | ppapi/proxy/ppb_font_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 const void* target_interface) { 53 return new PPB_Flash_TCPSocket_Proxy(dispatcher);
54 return new PPB_Flash_TCPSocket_Proxy(dispatcher, target_interface);
55 } 54 }
56 55
57 } // namespace 56 } // namespace
58 57
59 class FlashTCPSocket : public PPB_Flash_TCPSocket_API, 58 class FlashTCPSocket : public PPB_Flash_TCPSocket_API,
60 public Resource { 59 public Resource {
61 public: 60 public:
62 FlashTCPSocket(const HostResource& resource, uint32 socket_id); 61 FlashTCPSocket(const HostResource& resource, uint32 socket_id);
63 virtual ~FlashTCPSocket(); 62 virtual ~FlashTCPSocket();
64 63
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 PP_CompletionCallback* callback) { 381 PP_CompletionCallback* callback) {
383 DCHECK(callback); 382 DCHECK(callback);
384 383
385 if (callback->func) { 384 if (callback->func) {
386 MessageLoop::current()->PostTask(FROM_HERE, 385 MessageLoop::current()->PostTask(FROM_HERE,
387 new AbortCallbackTask(*callback)); 386 new AbortCallbackTask(*callback));
388 *callback = PP_BlockUntilComplete(); 387 *callback = PP_BlockUntilComplete();
389 } 388 }
390 } 389 }
391 390
392 PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy( 391 PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy(Dispatcher* dispatcher)
393 Dispatcher* dispatcher, 392 : InterfaceProxy(dispatcher) {
394 const void* target_interface)
395 : InterfaceProxy(dispatcher, target_interface) {
396 } 393 }
397 394
398 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() { 395 PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() {
399 } 396 }
400 397
401 // static 398 // static
402 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() { 399 const InterfaceProxy::Info* PPB_Flash_TCPSocket_Proxy::GetInfo() {
403 static const Info info = { 400 static const Info info = {
404 thunk::GetPPB_Flash_TCPSocket_Thunk(), 401 thunk::GetPPB_Flash_TCPSocket_Thunk(),
405 PPB_FLASH_TCPSOCKET_INTERFACE, 402 PPB_FLASH_TCPSOCKET_INTERFACE,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return; 490 return;
494 } 491 }
495 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); 492 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id);
496 if (iter == g_id_to_socket->end()) 493 if (iter == g_id_to_socket->end())
497 return; 494 return;
498 iter->second->OnWriteCompleted(succeeded, bytes_written); 495 iter->second->OnWriteCompleted(succeeded, bytes_written);
499 } 496 }
500 497
501 } // namespace proxy 498 } // namespace proxy
502 } // namespace ppapi 499 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_tcp_socket_proxy.h ('k') | ppapi/proxy/ppb_font_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698