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

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

Issue 18546008: [SPDY] Use WeakPtr<SpdySession> everywhere but SpdySessionPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test, other minor formatting/comment changes Created 7 years, 5 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
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/spdy/spdy_websocket_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ 5 #ifndef NET_SPDY_SPDY_WEBSOCKET_STREAM_H_
6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ 6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Called when data is received. 51 // Called when data is received.
52 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0; 52 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0;
53 53
54 // Called when SpdyStream is closed. 54 // Called when SpdyStream is closed.
55 virtual void OnCloseSpdyStream() = 0; 55 virtual void OnCloseSpdyStream() = 0;
56 56
57 protected: 57 protected:
58 virtual ~Delegate() {} 58 virtual ~Delegate() {}
59 }; 59 };
60 60
61 SpdyWebSocketStream(SpdySession* spdy_session, Delegate* delegate); 61 SpdyWebSocketStream(const base::WeakPtr<SpdySession>& spdy_session,
62 Delegate* delegate);
62 virtual ~SpdyWebSocketStream(); 63 virtual ~SpdyWebSocketStream();
63 64
64 // Initializes SPDY stream for the WebSocket. 65 // Initializes SPDY stream for the WebSocket.
65 // It might create SPDY stream asynchronously. In this case, this method 66 // It might create SPDY stream asynchronously. In this case, this method
66 // returns ERR_IO_PENDING and call OnCreatedSpdyStream delegate with result 67 // returns ERR_IO_PENDING and call OnCreatedSpdyStream delegate with result
67 // after completion. In other cases, delegate does not be called. 68 // after completion. In other cases, delegate does not be called.
68 int InitializeStream(const GURL& url, 69 int InitializeStream(const GURL& url,
69 RequestPriority request_priority, 70 RequestPriority request_priority,
70 const BoundNetLog& stream_net_log); 71 const BoundNetLog& stream_net_log);
71 72
(...skipping 11 matching lines...) Expand all
83 84
84 private: 85 private:
85 friend class SpdyWebSocketStreamTest; 86 friend class SpdyWebSocketStreamTest;
86 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamTest, Basic); 87 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamTest, Basic);
87 88
88 void OnSpdyStreamCreated(int status); 89 void OnSpdyStreamCreated(int status);
89 90
90 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; 91 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_;
91 SpdyStreamRequest stream_request_; 92 SpdyStreamRequest stream_request_;
92 base::WeakPtr<SpdyStream> stream_; 93 base::WeakPtr<SpdyStream> stream_;
93 scoped_refptr<SpdySession> spdy_session_; 94 const base::WeakPtr<SpdySession> spdy_session_;
94 size_t pending_send_data_length_; 95 size_t pending_send_data_length_;
95 Delegate* delegate_; 96 Delegate* delegate_;
96 97
97 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); 98 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream);
98 }; 99 };
99 100
100 } // namespace net 101 } // namespace net
101 102
102 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ 103 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/spdy/spdy_websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698