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

Side by Side Diff: ppapi/cpp/tcp_socket.h

Issue 17314012: Move PPB_TCPSocket out of dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/cpp/dev/tcp_socket_dev.cc ('k') | ppapi/cpp/tcp_socket.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CPP_DEV_TCP_SOCKET_DEV_H_ 5 #ifndef PPAPI_CPP_TCP_SOCKET_H_
6 #define PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_ 6 #define PPAPI_CPP_TCP_SOCKET_H_
7 7
8 #include "ppapi/c/dev/ppb_tcp_socket_dev.h" 8 #include "ppapi/c/ppb_tcp_socket.h"
9 #include "ppapi/cpp/net_address.h" 9 #include "ppapi/cpp/net_address.h"
10 #include "ppapi/cpp/pass_ref.h" 10 #include "ppapi/cpp/pass_ref.h"
11 #include "ppapi/cpp/resource.h" 11 #include "ppapi/cpp/resource.h"
12 12
13 namespace pp { 13 namespace pp {
14 14
15 class CompletionCallback; 15 class CompletionCallback;
16 class InstanceHandle; 16 class InstanceHandle;
17 17
18 /// The <code>TCPSocket_Dev</code> class provides TCP socket operations. 18 /// The <code>TCPSocket</code> class provides TCP socket operations.
19 /// 19 ///
20 /// Permissions: Apps permission <code>socket</code> with subrule 20 /// Permissions: Apps permission <code>socket</code> with subrule
21 /// <code>tcp-connect</code> is required for <code>Connect()</code>. 21 /// <code>tcp-connect</code> is required for <code>Connect()</code>.
22 /// For more details about network communication permissions, please see: 22 /// For more details about network communication permissions, please see:
23 /// http://developer.chrome.com/apps/app_network.html 23 /// http://developer.chrome.com/apps/app_network.html
24 class TCPSocket_Dev: public Resource { 24 class TCPSocket : public Resource {
25 public: 25 public:
26 /// Default constructor for creating an is_null() <code>TCPSocket_Dev</code> 26 /// Default constructor for creating an is_null() <code>TCPSocket</code>
27 /// object. 27 /// object.
28 TCPSocket_Dev(); 28 TCPSocket();
29 29
30 /// A constructor used to create a <code>TCPSocket_Dev</code> object. 30 /// A constructor used to create a <code>TCPSocket</code> object.
31 /// 31 ///
32 /// @param[in] instance The instance with which this resource will be 32 /// @param[in] instance The instance with which this resource will be
33 /// associated. 33 /// associated.
34 explicit TCPSocket_Dev(const InstanceHandle& instance); 34 explicit TCPSocket(const InstanceHandle& instance);
35 35
36 /// A constructor used when you have received a <code>PP_Resource</code> as a 36 /// A constructor used when you have received a <code>PP_Resource</code> as a
37 /// return value that has had 1 ref added for you. 37 /// return value that has had 1 ref added for you.
38 /// 38 ///
39 /// @param[in] resource A <code>PPB_TCPSocket_Dev</code> resource. 39 /// @param[in] resource A <code>PPB_TCPSocket</code> resource.
40 TCPSocket_Dev(PassRef, PP_Resource resource); 40 TCPSocket(PassRef, PP_Resource resource);
41 41
42 /// The copy constructor for <code>TCPSocket_Dev</code>. 42 /// The copy constructor for <code>TCPSocket</code>.
43 /// 43 ///
44 /// @param[in] other A reference to another <code>TCPSocket_Dev</code>. 44 /// @param[in] other A reference to another <code>TCPSocket</code>.
45 TCPSocket_Dev(const TCPSocket_Dev& other); 45 TCPSocket(const TCPSocket& other);
46 46
47 /// The destructor. 47 /// The destructor.
48 virtual ~TCPSocket_Dev(); 48 virtual ~TCPSocket();
49 49
50 /// The assignment operator for <code>TCPSocket_Dev</code>. 50 /// The assignment operator for <code>TCPSocket</code>.
51 /// 51 ///
52 /// @param[in] other A reference to another <code>TCPSocket_Dev</code>. 52 /// @param[in] other A reference to another <code>TCPSocket</code>.
53 /// 53 ///
54 /// @return A reference to this <code>TCPSocket_Dev</code> object. 54 /// @return A reference to this <code>TCPSocket</code> object.
55 TCPSocket_Dev& operator=(const TCPSocket_Dev& other); 55 TCPSocket& operator=(const TCPSocket& other);
56 56
57 /// Static function for determining whether the browser supports the 57 /// Static function for determining whether the browser supports the
58 /// <code>PPB_TCPSocket_Dev</code> interface. 58 /// <code>PPB_TCPSocket</code> interface.
59 /// 59 ///
60 /// @return true if the interface is available, false otherwise. 60 /// @return true if the interface is available, false otherwise.
61 static bool IsAvailable(); 61 static bool IsAvailable();
62 62
63 /// Connects the socket to the given address. 63 /// Connects the socket to the given address.
64 /// 64 ///
65 /// @param[in] addr A <code>NetAddress</code> object. 65 /// @param[in] addr A <code>NetAddress</code> object.
66 /// @param[in] callback A <code>CompletionCallback</code> to be called upon 66 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
67 /// completion. 67 /// completion.
68 /// 68 ///
(...skipping 25 matching lines...) Expand all
94 94
95 /// Reads data from the socket. The socket must be connected. It may perform a 95 /// Reads data from the socket. The socket must be connected. It may perform a
96 /// partial read. 96 /// partial read.
97 /// 97 ///
98 /// <strong>Caveat:</strong> You should be careful about the lifetime of 98 /// <strong>Caveat:</strong> You should be careful about the lifetime of
99 /// <code>buffer</code>. Typically you will use a 99 /// <code>buffer</code>. Typically you will use a
100 /// <code>CompletionCallbackFactory</code> to scope callbacks to the lifetime 100 /// <code>CompletionCallbackFactory</code> to scope callbacks to the lifetime
101 /// of your class. When your class goes out of scope, the callback factory 101 /// of your class. When your class goes out of scope, the callback factory
102 /// will not actually cancel the operation, but will rather just skip issuing 102 /// will not actually cancel the operation, but will rather just skip issuing
103 /// the callback on your class. This means that if the underlying 103 /// the callback on your class. This means that if the underlying
104 /// <code>PPB_TCPSocket_Dev</code> resource outlives your class, the browser 104 /// <code>PPB_TCPSocket</code> resource outlives your class, the browser
105 /// will still try to write into your buffer when the operation completes. 105 /// will still try to write into your buffer when the operation completes.
106 /// The buffer must be kept valid until then to avoid memory corruption. 106 /// The buffer must be kept valid until then to avoid memory corruption.
107 /// If you want to release the buffer while the <code>Read()</code> call is 107 /// If you want to release the buffer while the <code>Read()</code> call is
108 /// still pending, you should call <code>Close()</code> to ensure that the 108 /// still pending, you should call <code>Close()</code> to ensure that the
109 /// buffer won't be accessed in the future. 109 /// buffer won't be accessed in the future.
110 /// 110 ///
111 /// @param[out] buffer The buffer to store the received data on success. It 111 /// @param[out] buffer The buffer to store the received data on success. It
112 /// must be at least as large as <code>bytes_to_read</code>. 112 /// must be at least as large as <code>bytes_to_read</code>.
113 /// @param[in] bytes_to_read The number of bytes to read. 113 /// @param[in] bytes_to_read The number of bytes to read.
114 /// @param[in] callback A <code>CompletionCallback</code> to be called upon 114 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
(...skipping 24 matching lines...) Expand all
139 /// pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> 139 /// pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code>
140 /// if pending IO was interrupted. After a call to this method, no output 140 /// if pending IO was interrupted. After a call to this method, no output
141 /// buffer pointers passed into previous <code>Read()</code> calls will be 141 /// buffer pointers passed into previous <code>Read()</code> calls will be
142 /// accessed. It is not valid to call <code>Connect()</code> again. 142 /// accessed. It is not valid to call <code>Connect()</code> again.
143 /// 143 ///
144 /// The socket is implicitly closed if it is destroyed, so you are not 144 /// The socket is implicitly closed if it is destroyed, so you are not
145 /// required to call this method. 145 /// required to call this method.
146 void Close(); 146 void Close();
147 147
148 /// Sets a socket option on the TCP socket. 148 /// Sets a socket option on the TCP socket.
149 /// Please see the <code>PP_TCPSocket_Option_Dev</code> description for option 149 /// Please see the <code>PP_TCPSocket_Option</code> description for option
150 /// names, value types and allowed values. 150 /// names, value types and allowed values.
151 /// 151 ///
152 /// @param[in] name The option to set. 152 /// @param[in] name The option to set.
153 /// @param[in] value The option value to set. 153 /// @param[in] value The option value to set.
154 /// @param[in] callback A <code>CompletionCallback</code> to be called upon 154 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
155 /// completion. 155 /// completion.
156 /// 156 ///
157 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. 157 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
158 //// 158 ////
159 int32_t SetOption(PP_TCPSocket_Option_Dev name, 159 int32_t SetOption(PP_TCPSocket_Option name,
160 const Var& value, 160 const Var& value,
161 const CompletionCallback& callback); 161 const CompletionCallback& callback);
162 }; 162 };
163 163
164 } // namespace pp 164 } // namespace pp
165 165
166 #endif // PPAPI_CPP_DEV_TCP_SOCKET__DevDEV_H_ 166 #endif // PPAPI_CPP_TCP_SOCKET_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/tcp_socket_dev.cc ('k') | ppapi/cpp/tcp_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698