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

Side by Side Diff: ppapi/shared_impl/private/ppb_udp_socket_shared.h

Issue 11441012: PPB_UDPSocket_Private is switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 years 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
OLDNEW
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 #ifndef PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_UDP_SOCKET_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ 6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_UDP_SOCKET_SHARED_H_
7
8 #include <string>
9 7
10 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
11 #include "ppapi/shared_impl/resource.h" 9 #include "ppapi/shared_impl/ppapi_shared_export.h"
12 #include "ppapi/shared_impl/tracked_callback.h" 10 #include "ppapi/shared_impl/tracked_callback.h"
13 #include "ppapi/thunk/ppb_udp_socket_private_api.h" 11 #include "ppapi/thunk/ppb_udp_socket_private_api.h"
14 12
15 namespace ppapi { 13 namespace ppapi {
16 14
17 // This class provides the shared implementation of a 15 class PPAPI_SHARED_EXPORT PPB_UDPSocket_Shared
18 // PPB_UDPSocket_Private. The functions that actually send messages 16 : public thunk::PPB_UDPSocket_Private_API {
19 // to browser are implemented differently for the proxied and
20 // non-proxied derived classes.
21 class PPAPI_SHARED_EXPORT UDPSocketPrivateImpl
22 : public thunk::PPB_UDPSocket_Private_API,
23 public Resource {
24 public: 17 public:
25 // C-tor used in Impl case. 18 PPB_UDPSocket_Shared();
26 UDPSocketPrivateImpl(PP_Instance instance, uint32 socket_id); 19 virtual ~PPB_UDPSocket_Shared();
27 // C-tor used in Proxy case.
28 UDPSocketPrivateImpl(const HostResource& resource, uint32 socket_id);
29
30 virtual ~UDPSocketPrivateImpl();
31 20
32 // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_RecvFrom 21 // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_RecvFrom
33 // message is allowed to request. 22 // message is allowed to request.
34 static const int32_t kMaxReadSize; 23 static const int32_t kMaxReadSize;
35 // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo 24 // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo
36 // message is allowed to carry. 25 // message is allowed to carry.
37 static const int32_t kMaxWriteSize; 26 static const int32_t kMaxWriteSize;
38 27
39 // Resource overrides.
40 virtual PPB_UDPSocket_Private_API* AsPPB_UDPSocket_Private_API() OVERRIDE;
41
42 // PPB_UDPSocket_Private_API implementation. 28 // PPB_UDPSocket_Private_API implementation.
43 virtual int32_t SetSocketFeature(PP_UDPSocketFeature_Private name, 29 virtual int32_t SetSocketFeature(PP_UDPSocketFeature_Private name,
44 PP_Var value) OVERRIDE; 30 PP_Var value) OVERRIDE;
45 virtual int32_t Bind(const PP_NetAddress_Private* addr, 31 virtual int32_t Bind(const PP_NetAddress_Private* addr,
46 scoped_refptr<TrackedCallback> callback) OVERRIDE; 32 scoped_refptr<TrackedCallback> callback) OVERRIDE;
47 virtual PP_Bool GetBoundAddress(PP_NetAddress_Private* addr) OVERRIDE; 33 virtual PP_Bool GetBoundAddress(PP_NetAddress_Private* addr) OVERRIDE;
48 virtual int32_t RecvFrom(char* buffer, 34 virtual int32_t RecvFrom(char* buffer,
49 int32_t num_bytes, 35 int32_t num_bytes,
50 scoped_refptr<TrackedCallback> callback) OVERRIDE; 36 scoped_refptr<TrackedCallback> callback) OVERRIDE;
51 virtual PP_Bool GetRecvFromAddress(PP_NetAddress_Private* addr) OVERRIDE; 37 virtual PP_Bool GetRecvFromAddress(PP_NetAddress_Private* addr) OVERRIDE;
(...skipping 14 matching lines...) Expand all
66 // Send functions that need to be implemented differently for 52 // Send functions that need to be implemented differently for
67 // the proxied and non-proxied derived classes. 53 // the proxied and non-proxied derived classes.
68 virtual void SendBoolSocketFeature(int32_t name, bool value) = 0; 54 virtual void SendBoolSocketFeature(int32_t name, bool value) = 0;
69 virtual void SendBind(const PP_NetAddress_Private& addr) = 0; 55 virtual void SendBind(const PP_NetAddress_Private& addr) = 0;
70 virtual void SendRecvFrom(int32_t num_bytes) = 0; 56 virtual void SendRecvFrom(int32_t num_bytes) = 0;
71 virtual void SendSendTo(const std::string& buffer, 57 virtual void SendSendTo(const std::string& buffer,
72 const PP_NetAddress_Private& addr) = 0; 58 const PP_NetAddress_Private& addr) = 0;
73 virtual void SendClose() = 0; 59 virtual void SendClose() = 0;
74 60
75 protected: 61 protected:
76 void Init(uint32 socket_id);
77 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); 62 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback);
78 63
79 uint32 socket_id_;
80
81 bool bound_; 64 bool bound_;
82 bool closed_; 65 bool closed_;
83 66
84 scoped_refptr<TrackedCallback> bind_callback_; 67 scoped_refptr<TrackedCallback> bind_callback_;
85 scoped_refptr<TrackedCallback> recvfrom_callback_; 68 scoped_refptr<TrackedCallback> recvfrom_callback_;
86 scoped_refptr<TrackedCallback> sendto_callback_; 69 scoped_refptr<TrackedCallback> sendto_callback_;
87 70
88 char* read_buffer_; 71 char* read_buffer_;
89 int32_t bytes_to_read_; 72 int32_t bytes_to_read_;
90 73
91 PP_NetAddress_Private recvfrom_addr_; 74 PP_NetAddress_Private recvfrom_addr_;
92 PP_NetAddress_Private bound_addr_; 75 PP_NetAddress_Private bound_addr_;
93 76
94 DISALLOW_COPY_AND_ASSIGN(UDPSocketPrivateImpl); 77 DISALLOW_COPY_AND_ASSIGN(PPB_UDPSocket_Shared);
95 }; 78 };
96 79
97 } // namespace ppapi 80 } // namespace ppapi
98 81
99 #endif // PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ 82 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_UDP_SOCKET_SHARED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698