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

Unified Diff: net/websockets/websocket_job.h

Issue 3020068: WebSocket over SPDY. (Closed)
Patch Set: fix unittests Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_websocket_stream_unittest.cc ('k') | net/websockets/websocket_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_job.h
diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h
index f19653d29ae4874032b22208467c550dc8445e84..bc45a66d7cbb1dcd964fc886d5fcab1ecd16899d 100644
--- a/net/websockets/websocket_job.h
+++ b/net/websockets/websocket_job.h
@@ -13,6 +13,7 @@
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/socket_stream/socket_stream_job.h"
+#include "net/spdy/spdy_websocket_stream.h"
class GURL;
@@ -29,7 +30,9 @@ class WebSocketHandshakeResponseHandler;
// see HttpOnly cookies, so it injects cookie header in handshake request and
// strips set-cookie headers in handshake response.
// TODO(ukai): refactor websocket.cc to use this.
-class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
+class WebSocketJob : public SocketStreamJob,
+ public SocketStream::Delegate,
+ public SpdyWebSocketStreamDelegate {
public:
// This is state of WebSocket, not SocketStream.
enum State {
@@ -67,6 +70,22 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
virtual void OnError(
const SocketStream* socket, int error);
+ // SpdyWebSocketStreamDelegate methods.
+ virtual void OnCreatedSpdyStream(
+ SpdyWebSocketStream* spdy_websocket_stream, int status);
+ virtual void OnSentSpdyHeaders(
+ SpdyWebSocketStream* spdy_websocket_stream);
+ virtual int OnReceivedSpdyResponseHeader(
+ SpdyWebSocketStream* spdy_websocket_stream,
+ const spdy::SpdyHeaderBlock& headers,
+ int status);
+ virtual void OnSentSpdyData(
+ SpdyWebSocketStream* spdy_websocket_stream, int amount_sent);
+ virtual void OnReceivedSpdyData(
+ SpdyWebSocketStream* spdy_websocket_stream, const char* data, int length);
+ virtual void OnCloseSpdyStream(
+ SpdyWebSocketStream* spdy_websocket_stream);
+
private:
friend class WebSocketThrottle;
friend class WebSocketJobTest;
@@ -86,11 +105,14 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
GURL GetURLForCookies() const;
const AddressList& address_list() const;
+ int TrySpdyStream();
void SetWaiting();
bool IsWaiting() const;
void Wakeup();
- void DoCallback();
+ void DoCallback(int result);
+ void SendDataInternal(const char* data, int length);
+ void CloseInternal();
void SendPending();
SocketStream::Delegate* delegate_;
@@ -114,6 +136,9 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
scoped_refptr<DrainableIOBuffer> current_buffer_;
scoped_ptr<WebSocketFrameHandler> receive_frame_handler_;
+ scoped_ptr<SpdyWebSocketStream> spdy_websocket_stream_;
+ std::string challenge_;
+
DISALLOW_COPY_AND_ASSIGN(WebSocketJob);
};
« no previous file with comments | « net/spdy/spdy_websocket_stream_unittest.cc ('k') | net/websockets/websocket_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698