| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/flip/flip_session.h" | 5 #include "net/flip/flip_session.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 priority = 3; | 263 priority = 3; |
| 264 } | 264 } |
| 265 | 265 |
| 266 DCHECK(priority >= FLIP_PRIORITY_HIGHEST && | 266 DCHECK(priority >= FLIP_PRIORITY_HIGHEST && |
| 267 priority <= FLIP_PRIORITY_LOWEST); | 267 priority <= FLIP_PRIORITY_LOWEST); |
| 268 | 268 |
| 269 // Convert from HttpRequestHeaders to Flip Headers. | 269 // Convert from HttpRequestHeaders to Flip Headers. |
| 270 flip::FlipHeaderBlock headers; | 270 flip::FlipHeaderBlock headers; |
| 271 CreateFlipHeadersFromHttpRequest(delegate->request(), &headers); | 271 CreateFlipHeadersFromHttpRequest(delegate->request(), &headers); |
| 272 | 272 |
| 273 flip::FlipControlFlags flags = flip::CONTROL_FLAG_NONE; |
| 274 if (!delegate->request()->upload_data) |
| 275 flags = flip::CONTROL_FLAG_FIN; |
| 276 |
| 273 // Create a SYN_STREAM packet and add to the output queue. | 277 // Create a SYN_STREAM packet and add to the output queue. |
| 274 flip::FlipSynStreamControlFrame* syn_frame = | 278 flip::FlipSynStreamControlFrame* syn_frame = |
| 275 flip_framer_.CreateSynStream(stream_id, priority, | 279 flip_framer_.CreateSynStream(stream_id, priority, flags, false, &headers); |
| 276 flip::CONTROL_FLAG_NONE, false, &headers); | |
| 277 int length = sizeof(flip::FlipFrame) + syn_frame->length(); | 280 int length = sizeof(flip::FlipFrame) + syn_frame->length(); |
| 278 IOBufferWithSize* buffer = | 281 IOBufferWithSize* buffer = |
| 279 new IOBufferWithSize(length); | 282 new IOBufferWithSize(length); |
| 280 memcpy(buffer->data(), syn_frame, length); | 283 memcpy(buffer->data(), syn_frame, length); |
| 281 delete[] syn_frame; | 284 delete[] syn_frame; |
| 282 queue_.push(PrioritizedIOBuffer(buffer, priority)); | 285 queue_.push(PrioritizedIOBuffer(buffer, priority)); |
| 283 | 286 |
| 284 static StatsCounter flip_requests("flip.requests"); | 287 static StatsCounter flip_requests("flip.requests"); |
| 285 flip_requests.Increment(); | 288 flip_requests.Increment(); |
| 286 | 289 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 return false; | 890 return false; |
| 888 } | 891 } |
| 889 | 892 |
| 890 void FlipStreamImpl::OnError(int err) { | 893 void FlipStreamImpl::OnError(int err) { |
| 891 if (delegate_) | 894 if (delegate_) |
| 892 delegate_->OnClose(err); | 895 delegate_->OnClose(err); |
| 893 } | 896 } |
| 894 | 897 |
| 895 } // namespace net | 898 } // namespace net |
| 896 | 899 |
| OLD | NEW |