OLD | NEW |
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 #include "net/spdy/spdy_websocket_stream.h" | 5 #include "net/spdy/spdy_websocket_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 Close(); | 32 Close(); |
33 } | 33 } |
34 | 34 |
35 int SpdyWebSocketStream::InitializeStream(const GURL& url, | 35 int SpdyWebSocketStream::InitializeStream(const GURL& url, |
36 RequestPriority request_priority, | 36 RequestPriority request_priority, |
37 const BoundNetLog& net_log) { | 37 const BoundNetLog& net_log) { |
38 if (spdy_session_->IsClosed()) | 38 if (spdy_session_->IsClosed()) |
39 return ERR_SOCKET_NOT_CONNECTED; | 39 return ERR_SOCKET_NOT_CONNECTED; |
40 | 40 |
41 int rv = stream_request_.StartRequest( | 41 int rv = stream_request_.StartRequest( |
42 spdy_session_, url, request_priority, net_log, | 42 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url, request_priority, net_log, |
43 base::Bind(&SpdyWebSocketStream::OnSpdyStreamCreated, | 43 base::Bind(&SpdyWebSocketStream::OnSpdyStreamCreated, |
44 weak_ptr_factory_.GetWeakPtr())); | 44 weak_ptr_factory_.GetWeakPtr())); |
45 | 45 |
46 if (rv == OK) { | 46 if (rv == OK) { |
47 stream_ = stream_request_.ReleaseStream(); | 47 stream_ = stream_request_.ReleaseStream(); |
48 DCHECK(stream_); | 48 DCHECK(stream_); |
49 stream_->SetDelegate(this); | 49 stream_->SetDelegate(this); |
50 } | 50 } |
51 return rv; | 51 return rv; |
52 } | 52 } |
(...skipping 22 matching lines...) Expand all Loading... |
75 return ERR_IO_PENDING; | 75 return ERR_IO_PENDING; |
76 } | 76 } |
77 | 77 |
78 void SpdyWebSocketStream::Close() { | 78 void SpdyWebSocketStream::Close() { |
79 if (stream_) { | 79 if (stream_) { |
80 stream_->Close(); | 80 stream_->Close(); |
81 DCHECK(!stream_); | 81 DCHECK(!stream_); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 SpdySendStatus SpdyWebSocketStream::OnSendRequestHeadersComplete() { | 85 void SpdyWebSocketStream::OnSendRequestHeadersComplete() { |
86 DCHECK(delegate_); | 86 DCHECK(delegate_); |
87 delegate_->OnSentSpdyHeaders(); | 87 delegate_->OnSentSpdyHeaders(); |
88 return NO_MORE_DATA_TO_SEND; | |
89 } | 88 } |
90 | 89 |
91 void SpdyWebSocketStream::OnSendBody() { | 90 void SpdyWebSocketStream::OnSendBody() { |
92 CHECK(false); | 91 CHECK(false); |
93 } | 92 } |
94 | 93 |
95 void SpdyWebSocketStream::OnSendBodyComplete() { | 94 void SpdyWebSocketStream::OnSendBodyComplete() { |
96 CHECK(false); | 95 CHECK(false); |
97 } | 96 } |
98 | 97 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (result == OK) { | 130 if (result == OK) { |
132 stream_ = stream_request_.ReleaseStream(); | 131 stream_ = stream_request_.ReleaseStream(); |
133 DCHECK(stream_); | 132 DCHECK(stream_); |
134 stream_->SetDelegate(this); | 133 stream_->SetDelegate(this); |
135 } | 134 } |
136 DCHECK(delegate_); | 135 DCHECK(delegate_); |
137 delegate_->OnCreatedSpdyStream(result); | 136 delegate_->OnCreatedSpdyStream(result); |
138 } | 137 } |
139 | 138 |
140 } // namespace net | 139 } // namespace net |
OLD | NEW |