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

Side by Side Diff: net/spdy/spdy_websocket_stream.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 #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 "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/spdy/spdy_framer.h" 12 #include "net/spdy/spdy_framer.h"
13 #include "net/spdy/spdy_protocol.h" 13 #include "net/spdy/spdy_protocol.h"
14 #include "net/spdy/spdy_session.h" 14 #include "net/spdy/spdy_session.h"
15 #include "net/spdy/spdy_stream.h" 15 #include "net/spdy/spdy_stream.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 SpdyWebSocketStream::SpdyWebSocketStream( 20 SpdyWebSocketStream::SpdyWebSocketStream(
21 const base::WeakPtr<SpdySession>& spdy_session, Delegate* delegate) 21 const base::WeakPtr<SpdySession>& spdy_session,
22 Delegate* delegate)
22 : weak_ptr_factory_(this), 23 : weak_ptr_factory_(this),
23 spdy_session_(spdy_session), 24 spdy_session_(spdy_session),
24 pending_send_data_length_(0), 25 pending_send_data_length_(0),
25 delegate_(delegate) { 26 delegate_(delegate) {
26 DCHECK(spdy_session_.get()); 27 DCHECK(spdy_session_.get());
27 DCHECK(delegate_); 28 DCHECK(delegate_);
28 } 29 }
29 30
30 SpdyWebSocketStream::~SpdyWebSocketStream() { 31 SpdyWebSocketStream::~SpdyWebSocketStream() {
31 delegate_ = NULL; 32 delegate_ = NULL;
32 Close(); 33 Close();
33 } 34 }
34 35
35 int SpdyWebSocketStream::InitializeStream(const GURL& url, 36 int SpdyWebSocketStream::InitializeStream(const GURL& url,
36 RequestPriority request_priority, 37 RequestPriority request_priority,
37 const BoundNetLog& net_log) { 38 const BoundNetLog& net_log) {
38 if (!spdy_session_) 39 if (!spdy_session_)
39 return ERR_SOCKET_NOT_CONNECTED; 40 return ERR_SOCKET_NOT_CONNECTED;
40 41
41 int rv = stream_request_.StartRequest( 42 int rv = stream_request_.StartRequest(
42 SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url, request_priority, net_log, 43 SPDY_BIDIRECTIONAL_STREAM,
44 spdy_session_,
45 url,
46 request_priority,
47 net_log,
43 base::Bind(&SpdyWebSocketStream::OnSpdyStreamCreated, 48 base::Bind(&SpdyWebSocketStream::OnSpdyStreamCreated,
44 weak_ptr_factory_.GetWeakPtr())); 49 weak_ptr_factory_.GetWeakPtr()));
45 50
46 if (rv == OK) { 51 if (rv == OK) {
47 stream_ = stream_request_.ReleaseStream(); 52 stream_ = stream_request_.ReleaseStream();
48 DCHECK(stream_.get()); 53 DCHECK(stream_.get());
49 stream_->SetDelegate(this); 54 stream_->SetDelegate(this);
50 } 55 }
51 return rv; 56 return rv;
52 } 57 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (result == OK) { 126 if (result == OK) {
122 stream_ = stream_request_.ReleaseStream(); 127 stream_ = stream_request_.ReleaseStream();
123 DCHECK(stream_.get()); 128 DCHECK(stream_.get());
124 stream_->SetDelegate(this); 129 stream_->SetDelegate(this);
125 } 130 }
126 DCHECK(delegate_); 131 DCHECK(delegate_);
127 delegate_->OnCreatedSpdyStream(result); 132 delegate_->OnCreatedSpdyStream(result);
128 } 133 }
129 134
130 } // namespace net 135 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698