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

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

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <list> 10 #include <list>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 scoped_refptr<SpdyStream>* spdy_stream, 78 scoped_refptr<SpdyStream>* spdy_stream,
79 const BoundNetLog& stream_net_log); 79 const BoundNetLog& stream_net_log);
80 80
81 // Create a new stream for a given |url|. Writes it out to |spdy_stream|. 81 // Create a new stream for a given |url|. Writes it out to |spdy_stream|.
82 // Returns a net error code, possibly ERR_IO_PENDING. 82 // Returns a net error code, possibly ERR_IO_PENDING.
83 int CreateStream( 83 int CreateStream(
84 const GURL& url, 84 const GURL& url,
85 RequestPriority priority, 85 RequestPriority priority,
86 scoped_refptr<SpdyStream>* spdy_stream, 86 scoped_refptr<SpdyStream>* spdy_stream,
87 const BoundNetLog& stream_net_log, 87 const BoundNetLog& stream_net_log,
88 OldCompletionCallback* callback); 88 const CompletionCallback& callback);
89 89
90 // Remove PendingCreateStream objects on transaction deletion 90 // Remove PendingCreateStream objects on transaction deletion
91 void CancelPendingCreateStreams(const scoped_refptr<SpdyStream>* spdy_stream); 91 void CancelPendingCreateStreams(const scoped_refptr<SpdyStream>* spdy_stream);
92 92
93 // Used by SpdySessionPool to initialize with a pre-existing SSL socket. For 93 // Used by SpdySessionPool to initialize with a pre-existing SSL socket. For
94 // testing, setting is_secure to false allows initialization with a 94 // testing, setting is_secure to false allows initialization with a
95 // pre-existing TCP socket. 95 // pre-existing TCP socket.
96 // Returns OK on success, or an error on failure. 96 // Returns OK on success, or an error on failure.
97 net::Error InitializeWithSocket(ClientSocketHandle* connection, 97 net::Error InitializeWithSocket(ClientSocketHandle* connection,
98 bool is_secure, 98 bool is_secure,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Returns true if flow control is enabled for the session. 227 // Returns true if flow control is enabled for the session.
228 bool is_flow_control_enabled() const { 228 bool is_flow_control_enabled() const {
229 return flow_control_; 229 return flow_control_;
230 } 230 }
231 231
232 const BoundNetLog& net_log() const { return net_log_; } 232 const BoundNetLog& net_log() const { return net_log_; }
233 233
234 int GetPeerAddress(AddressList* address) const; 234 int GetPeerAddress(AddressList* address) const;
235 int GetLocalAddress(IPEndPoint* address) const; 235 int GetLocalAddress(IPEndPoint* address) const;
236 236
237 // LayeredPool methods: 237 // LayeredPool implementation.
238 virtual bool CloseOneIdleConnection() OVERRIDE; 238 virtual bool CloseOneIdleConnection() OVERRIDE;
239 239
240 private: 240 private:
241 friend class base::RefCounted<SpdySession>; 241 friend class base::RefCounted<SpdySession>;
242
242 // Allow tests to access our innards for testing purposes. 243 // Allow tests to access our innards for testing purposes.
243 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping); 244 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping);
244 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); 245 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing);
245 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); 246 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream);
246 247
247 struct PendingCreateStream { 248 struct PendingCreateStream {
248 PendingCreateStream(const GURL& url, RequestPriority priority, 249 PendingCreateStream(const GURL& url, RequestPriority priority,
249 scoped_refptr<SpdyStream>* spdy_stream, 250 scoped_refptr<SpdyStream>* spdy_stream,
250 const BoundNetLog& stream_net_log, 251 const BoundNetLog& stream_net_log,
251 OldCompletionCallback* callback) 252 const CompletionCallback& callback)
252 : url(&url), priority(priority), spdy_stream(spdy_stream), 253 : url(&url),
253 stream_net_log(&stream_net_log), callback(callback) { } 254 priority(priority),
255 spdy_stream(spdy_stream),
256 stream_net_log(&stream_net_log),
257 callback(callback) {}
258 ~PendingCreateStream();
254 259
255 const GURL* url; 260 const GURL* url;
256 RequestPriority priority; 261 RequestPriority priority;
257 scoped_refptr<SpdyStream>* spdy_stream; 262 scoped_refptr<SpdyStream>* spdy_stream;
258 const BoundNetLog* stream_net_log; 263 const BoundNetLog* stream_net_log;
259 OldCompletionCallback* callback; 264 CompletionCallback callback;
260 }; 265 };
261 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > 266 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> >
262 PendingCreateStreamQueue; 267 PendingCreateStreamQueue;
263 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; 268 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap;
264 // Only HTTP push a stream. 269 // Only HTTP push a stream.
265 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; 270 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap;
266 typedef std::priority_queue<SpdyIOBuffer> OutputQueue; 271 typedef std::priority_queue<SpdyIOBuffer> OutputQueue;
267 272
268 struct CallbackResultPair { 273 struct CallbackResultPair {
269 CallbackResultPair() : result(OK) {} 274 CallbackResultPair() : result(OK) {}
270 CallbackResultPair(OldCompletionCallback* callback_in, int result_in) 275 CallbackResultPair(const CompletionCallback& callback_in, int result_in)
271 : callback(callback_in), result(result_in) {} 276 : callback(callback_in), result(result_in) {}
277 ~CallbackResultPair();
272 278
273 OldCompletionCallback* callback; 279 CompletionCallback callback;
274 int result; 280 int result;
275 }; 281 };
276 282
277 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> 283 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair>
278 PendingCallbackMap; 284 PendingCallbackMap;
279 285
280 enum State { 286 enum State {
281 IDLE, 287 IDLE,
282 CONNECTING, 288 CONNECTING,
283 CONNECTED, 289 CONNECTED,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 const spdy::SpdyControlFlags flags_; 626 const spdy::SpdyControlFlags flags_;
621 const spdy::SpdyStreamId id_; 627 const spdy::SpdyStreamId id_;
622 const spdy::SpdyStreamId associated_stream_; 628 const spdy::SpdyStreamId associated_stream_;
623 629
624 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); 630 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter);
625 }; 631 };
626 632
627 } // namespace net 633 } // namespace net
628 634
629 #endif // NET_SPDY_SPDY_SESSION_H_ 635 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698