| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/linked_ptr.h" | 8 #include "base/linked_ptr.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 net::Error error = ReadSocket(); | 218 net::Error error = ReadSocket(); |
| 219 if (error == ERR_IO_PENDING) | 219 if (error == ERR_IO_PENDING) |
| 220 return OK; | 220 return OK; |
| 221 return error; | 221 return error; |
| 222 } | 222 } |
| 223 | 223 |
| 224 net::Error SpdySession::Connect( | 224 net::Error SpdySession::Connect( |
| 225 const std::string& group_name, | 225 const std::string& group_name, |
| 226 const scoped_refptr<TCPSocketParams>& destination, | 226 const scoped_refptr<TCPSocketParams>& destination, |
| 227 RequestPriority priority) { | 227 RequestPriority priority) { |
| 228 DCHECK(priority >= SPDY_PRIORITY_HIGHEST && priority <= SPDY_PRIORITY_LOWEST); | 228 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES); |
| 229 | 229 |
| 230 // If the connect process is started, let the caller continue. | 230 // If the connect process is started, let the caller continue. |
| 231 if (state_ > IDLE) | 231 if (state_ > IDLE) |
| 232 return net::OK; | 232 return net::OK; |
| 233 | 233 |
| 234 state_ = CONNECTING; | 234 state_ = CONNECTING; |
| 235 | 235 |
| 236 static StatsCounter spdy_sessions("spdy.sessions"); | 236 static StatsCounter spdy_sessions("spdy.sessions"); |
| 237 spdy_sessions.Increment(); | 237 spdy_sessions.Increment(); |
| 238 | 238 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 stream->set_path(path); | 377 stream->set_path(path); |
| 378 stream->set_net_log(stream_net_log); | 378 stream->set_net_log(stream_net_log); |
| 379 stream->set_send_window_size(initial_send_window_size_); | 379 stream->set_send_window_size(initial_send_window_size_); |
| 380 ActivateStream(stream); | 380 ActivateStream(stream); |
| 381 | 381 |
| 382 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyPriorityCount", | 382 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyPriorityCount", |
| 383 static_cast<int>(priority), 0, 10, 11); | 383 static_cast<int>(priority), 0, 10, 11); |
| 384 | 384 |
| 385 LOG(INFO) << "SpdyStream: Creating stream " << stream_id << " for " << url; | 385 LOG(INFO) << "SpdyStream: Creating stream " << stream_id << " for " << url; |
| 386 // TODO(mbelshe): Optimize memory allocations | 386 // TODO(mbelshe): Optimize memory allocations |
| 387 DCHECK(priority >= SPDY_PRIORITY_HIGHEST && | 387 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES); |
| 388 priority <= SPDY_PRIORITY_LOWEST); | |
| 389 | 388 |
| 390 DCHECK_EQ(active_streams_[stream_id].get(), stream.get()); | 389 DCHECK_EQ(active_streams_[stream_id].get(), stream.get()); |
| 391 return OK; | 390 return OK; |
| 392 } | 391 } |
| 393 | 392 |
| 394 int SpdySession::WriteSynStream( | 393 int SpdySession::WriteSynStream( |
| 395 spdy::SpdyStreamId stream_id, | 394 spdy::SpdyStreamId stream_id, |
| 396 RequestPriority priority, | 395 RequestPriority priority, |
| 397 spdy::SpdyControlFlags flags, | 396 spdy::SpdyControlFlags flags, |
| 398 const linked_ptr<spdy::SpdyHeaderBlock>& headers) { | 397 const linked_ptr<spdy::SpdyHeaderBlock>& headers) { |
| 399 // Find our stream | 398 // Find our stream |
| 400 if (!IsStreamActive(stream_id)) | 399 if (!IsStreamActive(stream_id)) |
| 401 return ERR_INVALID_SPDY_STREAM; | 400 return ERR_INVALID_SPDY_STREAM; |
| 402 const scoped_refptr<SpdyStream>& stream = active_streams_[stream_id]; | 401 const scoped_refptr<SpdyStream>& stream = active_streams_[stream_id]; |
| 403 CHECK_EQ(stream->stream_id(), stream_id); | 402 CHECK_EQ(stream->stream_id(), stream_id); |
| 404 | 403 |
| 405 scoped_ptr<spdy::SpdySynStreamControlFrame> syn_frame( | 404 scoped_ptr<spdy::SpdySynStreamControlFrame> syn_frame( |
| 406 spdy_framer_.CreateSynStream(stream_id, 0, priority, flags, false, | 405 spdy_framer_.CreateSynStream( |
| 407 headers.get())); | 406 stream_id, 0, |
| 407 ConvertRequestPriorityToSpdyPriority(priority), |
| 408 flags, false, headers.get())); |
| 408 QueueFrame(syn_frame.get(), priority, stream); | 409 QueueFrame(syn_frame.get(), priority, stream); |
| 409 | 410 |
| 410 static StatsCounter spdy_requests("spdy.requests"); | 411 static StatsCounter spdy_requests("spdy.requests"); |
| 411 spdy_requests.Increment(); | 412 spdy_requests.Increment(); |
| 412 streams_initiated_count_++; | 413 streams_initiated_count_++; |
| 413 | 414 |
| 414 LOG(INFO) << "SPDY SYN_STREAM HEADERS ----------------------------------"; | 415 LOG(INFO) << "SPDY SYN_STREAM HEADERS ----------------------------------"; |
| 415 DumpSpdyHeaders(*headers); | 416 DumpSpdyHeaders(*headers); |
| 416 | 417 |
| 417 const BoundNetLog& log = stream->net_log(); | 418 const BoundNetLog& log = stream->net_log(); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate", | 1329 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate", |
| 1329 setting.second, | 1330 setting.second, |
| 1330 1, 100, 50); | 1331 1, 100, 50); |
| 1331 break; | 1332 break; |
| 1332 } | 1333 } |
| 1333 } | 1334 } |
| 1334 } | 1335 } |
| 1335 } | 1336 } |
| 1336 | 1337 |
| 1337 } // namespace net | 1338 } // namespace net |
| OLD | NEW |