diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 01:54:45 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 01:54:45 +0000 |
commit | ff42ee3f10b3f741ae52313f6f4ae73597b4e13c (patch) | |
tree | 59853941b945aceeb4e8bb495259cf50b5514a6e /net/socket_stream/socket_stream.h | |
parent | 95d291980d768c38e1f70bc041957870913e07f6 (diff) | |
download | chromium_src-ff42ee3f10b3f741ae52313f6f4ae73597b4e13c.zip chromium_src-ff42ee3f10b3f741ae52313f6f4ae73597b4e13c.tar.gz chromium_src-ff42ee3f10b3f741ae52313f6f4ae73597b4e13c.tar.bz2 |
Refactor SocketStream to report error to the delegate.
error status will be reported to the delegate (e.g. websocket experiment task)
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/346010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream/socket_stream.h')
-rw-r--r-- | net/socket_stream/socket_stream.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index c1aaf6e..b9961f4 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -79,6 +79,11 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { // By default, no credential is available and close the connection. socket->Close(); } + + // Called when an error occured. + // This is only for error reporting to the delegate. + // |error| is net::Error. + virtual void OnError(const SocketStream* socket, int error) {} }; SocketStream(const GURL& url, Delegate* delegate); @@ -171,7 +176,8 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { STATE_SOCKS_CONNECT_COMPLETE, STATE_SSL_CONNECT, STATE_SSL_CONNECT_COMPLETE, - STATE_READ_WRITE + STATE_READ_WRITE, + STATE_AUTH_REQUIRED, }; enum ProxyMode { @@ -184,11 +190,12 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { friend class base::RefCountedThreadSafe<SocketStream>; ~SocketStream(); - // Finish the job. Once finished, calls OnClose of delegate, and no more + // Finishes the job. + // Calls OnError and OnClose of delegate, and no more // notifications will be sent to delegate. - void Finish(); + void Finish(int result); - void DidEstablishConnection(); + int DidEstablishConnection(); void DidReceiveData(int result); void DidSendData(int result); @@ -196,7 +203,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { void OnReadCompleted(int result); void OnWriteCompleted(int result); - int DoLoop(int result); + void DoLoop(int result); int DoResolveProxy(); int DoResolveProxyComplete(int result); |