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

Side by Side Diff: jingle/glue/chrome_async_socket.h

Issue 628123002: Replacing the OVERRIDE with override and FINAL with final in jingle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « jingle/glue/channel_socket_adapter.h ('k') | jingle/glue/chrome_async_socket_unittest.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 (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 // An implementation of buzz::AsyncSocket that uses Chrome sockets. 5 // An implementation of buzz::AsyncSocket that uses Chrome sockets.
6 6
7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ 7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_
8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ 8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_
9 9
10 #if !defined(FEATURE_ENABLE_SSL) 10 #if !defined(FEATURE_ENABLE_SSL)
(...skipping 29 matching lines...) Expand all
40 size_t read_buf_size, 40 size_t read_buf_size,
41 size_t write_buf_size); 41 size_t write_buf_size);
42 42
43 // Does not raise any signals. 43 // Does not raise any signals.
44 virtual ~ChromeAsyncSocket(); 44 virtual ~ChromeAsyncSocket();
45 45
46 // buzz::AsyncSocket implementation. 46 // buzz::AsyncSocket implementation.
47 47
48 // The current state (see buzz::AsyncSocket::State; all but 48 // The current state (see buzz::AsyncSocket::State; all but
49 // STATE_CLOSING is used). 49 // STATE_CLOSING is used).
50 virtual State state() OVERRIDE; 50 virtual State state() override;
51 51
52 // The last generated error. Errors are generated when the main 52 // The last generated error. Errors are generated when the main
53 // functions below return false or when SignalClosed is raised due 53 // functions below return false or when SignalClosed is raised due
54 // to an asynchronous error. 54 // to an asynchronous error.
55 virtual Error error() OVERRIDE; 55 virtual Error error() override;
56 56
57 // GetError() (which is of type net::Error) != net::OK only when 57 // GetError() (which is of type net::Error) != net::OK only when
58 // error() == ERROR_WINSOCK. 58 // error() == ERROR_WINSOCK.
59 virtual int GetError() OVERRIDE; 59 virtual int GetError() override;
60 60
61 // Tries to connect to the given address. 61 // Tries to connect to the given address.
62 // 62 //
63 // If state() is not STATE_CLOSED, sets error to ERROR_WRONGSTATE 63 // If state() is not STATE_CLOSED, sets error to ERROR_WRONGSTATE
64 // and returns false. 64 // and returns false.
65 // 65 //
66 // If |address| has an empty hostname or a zero port, sets error to 66 // If |address| has an empty hostname or a zero port, sets error to
67 // ERROR_DNS and returns false. (We don't use the IP address even 67 // ERROR_DNS and returns false. (We don't use the IP address even
68 // if it's present, as DNS resolution is done by 68 // if it's present, as DNS resolution is done by
69 // |resolving_client_socket_factory_|. But it's perfectly fine if 69 // |resolving_client_socket_factory_|. But it's perfectly fine if
70 // the hostname is a stringified IP address.) 70 // the hostname is a stringified IP address.)
71 // 71 //
72 // Otherwise, starts the connection process and returns true. 72 // Otherwise, starts the connection process and returns true.
73 // SignalConnected will be raised when the connection is successful; 73 // SignalConnected will be raised when the connection is successful;
74 // otherwise, SignalClosed will be raised with a net error set. 74 // otherwise, SignalClosed will be raised with a net error set.
75 virtual bool Connect(const rtc::SocketAddress& address) OVERRIDE; 75 virtual bool Connect(const rtc::SocketAddress& address) override;
76 76
77 // Tries to read at most |len| bytes into |data|. 77 // Tries to read at most |len| bytes into |data|.
78 // 78 //
79 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or 79 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or
80 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false. 80 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false.
81 // 81 //
82 // Otherwise, fills in |len_read| with the number of bytes read and 82 // Otherwise, fills in |len_read| with the number of bytes read and
83 // returns true. If this is called when state() is 83 // returns true. If this is called when state() is
84 // STATE_TLS_CONNECTING, reads 0 bytes. (We have to handle this 84 // STATE_TLS_CONNECTING, reads 0 bytes. (We have to handle this
85 // case because StartTls() is called during a slot connected to 85 // case because StartTls() is called during a slot connected to
86 // SignalRead after parsing the final non-TLS reply from the server 86 // SignalRead after parsing the final non-TLS reply from the server
87 // [see XmppClient::Private::OnSocketRead()].) 87 // [see XmppClient::Private::OnSocketRead()].)
88 virtual bool Read(char* data, size_t len, size_t* len_read) OVERRIDE; 88 virtual bool Read(char* data, size_t len, size_t* len_read) override;
89 89
90 // Queues up |len| bytes of |data| for writing. 90 // Queues up |len| bytes of |data| for writing.
91 // 91 //
92 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or 92 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or
93 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false. 93 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false.
94 // 94 //
95 // If the given data is too big for the internal write buffer, sets 95 // If the given data is too big for the internal write buffer, sets
96 // error to ERROR_WINSOCK/net::ERR_INSUFFICIENT_RESOURCES and 96 // error to ERROR_WINSOCK/net::ERR_INSUFFICIENT_RESOURCES and
97 // returns false. 97 // returns false.
98 // 98 //
99 // Otherwise, queues up the data and returns true. If this is 99 // Otherwise, queues up the data and returns true. If this is
100 // called when state() == STATE_TLS_CONNECTING, the data is will be 100 // called when state() == STATE_TLS_CONNECTING, the data is will be
101 // sent only after the TLS connection succeeds. (See StartTls() 101 // sent only after the TLS connection succeeds. (See StartTls()
102 // below for why this happens.) 102 // below for why this happens.)
103 // 103 //
104 // Note that there's no guarantee that the data will actually be 104 // Note that there's no guarantee that the data will actually be
105 // sent; however, it is guaranteed that the any data sent will be 105 // sent; however, it is guaranteed that the any data sent will be
106 // sent in FIFO order. 106 // sent in FIFO order.
107 virtual bool Write(const char* data, size_t len) OVERRIDE; 107 virtual bool Write(const char* data, size_t len) override;
108 108
109 // If the socket is not already closed, closes the socket and raises 109 // If the socket is not already closed, closes the socket and raises
110 // SignalClosed. Always returns true. 110 // SignalClosed. Always returns true.
111 virtual bool Close() OVERRIDE; 111 virtual bool Close() override;
112 112
113 // Tries to change to a TLS connection with the given domain name. 113 // Tries to change to a TLS connection with the given domain name.
114 // 114 //
115 // If state() is not STATE_OPEN or there are pending reads or 115 // If state() is not STATE_OPEN or there are pending reads or
116 // writes, sets error to ERROR_WRONGSTATE and returns false. (In 116 // writes, sets error to ERROR_WRONGSTATE and returns false. (In
117 // practice, this means that StartTls() can only be called from a 117 // practice, this means that StartTls() can only be called from a
118 // slot connected to SignalRead.) 118 // slot connected to SignalRead.)
119 // 119 //
120 // Otherwise, starts the TLS connection process and returns true. 120 // Otherwise, starts the TLS connection process and returns true.
121 // SignalSSLConnected will be raised when the connection is 121 // SignalSSLConnected will be raised when the connection is
122 // successful; otherwise, SignalClosed will be raised with a net 122 // successful; otherwise, SignalClosed will be raised with a net
123 // error set. 123 // error set.
124 virtual bool StartTls(const std::string& domain_name) OVERRIDE; 124 virtual bool StartTls(const std::string& domain_name) override;
125 125
126 // Signal behavior: 126 // Signal behavior:
127 // 127 //
128 // SignalConnected: raised whenever the connect initiated by a call 128 // SignalConnected: raised whenever the connect initiated by a call
129 // to Connect() is complete. 129 // to Connect() is complete.
130 // 130 //
131 // SignalSSLConnected: raised whenever the connect initiated by a 131 // SignalSSLConnected: raised whenever the connect initiated by a
132 // call to StartTls() is complete. Not actually used by 132 // call to StartTls() is complete. Not actually used by
133 // XmppClient. (It just assumes that if SignalRead is raised after a 133 // XmppClient. (It just assumes that if SignalRead is raised after a
134 // call to StartTls(), the connection has been successfully 134 // call to StartTls(), the connection has been successfully
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 size_t write_end_; 205 size_t write_end_;
206 206
207 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_; 207 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_;
208 208
209 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); 209 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket);
210 }; 210 };
211 211
212 } // namespace jingle_glue 212 } // namespace jingle_glue
213 213
214 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ 214 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_
OLDNEW
« no previous file with comments | « jingle/glue/channel_socket_adapter.h ('k') | jingle/glue/chrome_async_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698