diff options
author | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 12:08:49 +0000 |
---|---|---|
committer | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 12:08:49 +0000 |
commit | a9cf2b958d433646fa76a60e6777939ee62fcab4 (patch) | |
tree | 21f7cc785e7db72f5e04e4db0363aabc6a54929e /net/websockets | |
parent | c4c6dfd201e0e0d7e72d90fc7a16928c3ff78ee2 (diff) | |
download | chromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.zip chromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.tar.gz chromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.tar.bz2 |
Rename WebSocketStreamBase to WebSocketHandshakeStreamBase in order to better reflect its new function.
This name change previously was done in CL
https://codereview.chromium.org/25417005/ but it caused numerous merge
conflicts. So it has been split out into this CL.
Also add an Upgrade() method which produces a WebSocketStream from a
WebSocketHandshakeStreamBase. This is for use inside the implementation of
WebSocketStream::CreateAndConnectStream().
BUG=312515
Review URL: https://codereview.chromium.org/49043009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets')
-rw-r--r-- | net/websockets/README | 6 | ||||
-rw-r--r-- | net/websockets/websocket_handshake_stream_base.h | 63 | ||||
-rw-r--r-- | net/websockets/websocket_stream_base.h | 55 |
3 files changed, 66 insertions, 58 deletions
diff --git a/net/websockets/README b/net/websockets/README index bca38c9..0670903 100644 --- a/net/websockets/README +++ b/net/websockets/README @@ -43,24 +43,24 @@ websocket_deflater.h websocket_deflater_test.cc websocket_errors.cc websocket_errors.h +websocket_errors_test.cc +websocket_event_interface.h websocket_extension.cc websocket_extension.h websocket_extension_parser.cc websocket_extension_parser.h websocket_extension_parser_test.cc -websocket_errors_test.cc -websocket_event_interface.h websocket_frame.cc websocket_frame.h websocket_frame_parser.cc websocket_frame_parser.h websocket_frame_parser_test.cc websocket_frame_test.cc +websocket_handshake_stream_base.h websocket_inflater.cc websocket_inflater.h websocket_inflater_test.cc websocket_mux.h -websocket_stream_base.h websocket_stream.cc websocket_stream.h websocket_test_util.cc diff --git a/net/websockets/websocket_handshake_stream_base.h b/net/websockets/websocket_handshake_stream_base.h new file mode 100644 index 0000000..d81b626 --- /dev/null +++ b/net/websockets/websocket_handshake_stream_base.h @@ -0,0 +1,63 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ +#define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ + +// This file is included from net/http files. +// Since net/http can be built without linking net/websockets code, +// this file must not introduce any link-time dependencies on websockets. + +#include "base/basictypes.h" +#include "base/memory/weak_ptr.h" +#include "net/http/http_stream_base.h" +#include "net/websockets/websocket_stream.h" + +namespace net { + +class ClientSocketHandle; +class SpdySession; + +// WebSocketHandshakeStreamBase is the base class of +// WebSocketBasicHandshakeStream. net/http code uses this interface to handle +// WebSocketBasicHandshakeStream when it needs to be treated differently from +// HttpStreamBase. +class NET_EXPORT WebSocketHandshakeStreamBase : public HttpStreamBase { + public: + class Factory { + public: + virtual ~Factory() {} + + // Create a WebSocketBasicHandshakeStream. This function (or the returned + // object) takes the ownership of |connection|. This is called after the + // underlying connection has been established but before any handshake data + // has been transferred. + virtual WebSocketHandshakeStreamBase* CreateBasicStream( + ClientSocketHandle* connection, + bool using_proxy) = 0; + + // Create a WebSocketSpdyHandshakeStream (unimplemented as of October 2013) + virtual WebSocketHandshakeStreamBase* CreateSpdyStream( + const base::WeakPtr<SpdySession>& session, + bool use_relative_url) = 0; + }; + + virtual ~WebSocketHandshakeStreamBase() {} + + // After the handshake has completed, this method creates a WebSocketStream + // (of the appropriate type) from the WebSocketHandshakeStreamBase object. + // The WebSocketHandshakeStreamBase object is unusable after Upgrade() has + // been called. + virtual scoped_ptr<WebSocketStream> Upgrade() = 0; + + protected: + WebSocketHandshakeStreamBase() {} + + private: + DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamBase); +}; + +} // namespace net + +#endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ diff --git a/net/websockets/websocket_stream_base.h b/net/websockets/websocket_stream_base.h deleted file mode 100644 index fbf90ff..0000000 --- a/net/websockets/websocket_stream_base.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_ -#define NET_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_ - -// This file is included from net/http files. -// Since net/http can be built without linking net/websockets code, -// this file should not depend on net/websockets. - -#include "base/basictypes.h" -#include "base/memory/weak_ptr.h" -#include "net/http/http_stream_base.h" - -namespace net { - -class ClientSocketHandle; -class SpdySession; - -// WebSocketStreamBase is the base class of WebSocketBasicHandshakeStream. -// net/http code uses this interface to handle WebSocketBasicHandshakeStream -// when it needs to be treated differently from HttpStreamBase. -class NET_EXPORT WebSocketStreamBase : public HttpStreamBase { - public: - class Factory { - public: - virtual ~Factory() {} - - // Create a WebSocketBasicHandshakeStream. This function (or the returned - // object) takes the ownership of |connection|. This is called after the - // underlying connection has been established but before any handshake data - // has been transferred. - virtual WebSocketStreamBase* CreateBasicStream( - ClientSocketHandle* connection, - bool using_proxy) = 0; - - // Create a WebSocketSpdyHandshakeStream (unimplemented as of October 2013) - virtual WebSocketStreamBase* CreateSpdyStream( - const base::WeakPtr<SpdySession>& session, - bool use_relative_url) = 0; - }; - - virtual ~WebSocketStreamBase() {} - - protected: - WebSocketStreamBase() {} - - private: - DISALLOW_COPY_AND_ASSIGN(WebSocketStreamBase); -}; - -} // namespace net - -#endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_BASE_H_ |