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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 273 flip::FlipControlFlags flags = flip::CONTROL_FLAG_NONE; |
274 if (!delegate->request()->upload_data) | 274 if (!delegate->data()) |
275 flags = flip::CONTROL_FLAG_FIN; | 275 flags = flip::CONTROL_FLAG_FIN; |
276 | 276 |
277 // Create a SYN_STREAM packet and add to the output queue. | 277 // Create a SYN_STREAM packet and add to the output queue. |
278 flip::FlipSynStreamControlFrame* syn_frame = | 278 flip::FlipSynStreamControlFrame* syn_frame = |
279 flip_framer_.CreateSynStream(stream_id, priority, flags, false, &headers); | 279 flip_framer_.CreateSynStream(stream_id, priority, flags, false, &headers); |
280 int length = sizeof(flip::FlipFrame) + syn_frame->length(); | 280 int length = sizeof(flip::FlipFrame) + syn_frame->length(); |
281 IOBufferWithSize* buffer = | 281 IOBufferWithSize* buffer = |
282 new IOBufferWithSize(length); | 282 new IOBufferWithSize(length); |
283 memcpy(buffer->data(), syn_frame, length); | 283 memcpy(buffer->data(), syn_frame, length); |
284 delete[] syn_frame; | 284 delete[] syn_frame; |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 return false; | 890 return false; |
891 } | 891 } |
892 | 892 |
893 void FlipStreamImpl::OnError(int err) { | 893 void FlipStreamImpl::OnError(int err) { |
894 if (delegate_) | 894 if (delegate_) |
895 delegate_->OnClose(err); | 895 delegate_->OnClose(err); |
896 } | 896 } |
897 | 897 |
898 } // namespace net | 898 } // namespace net |
899 | 899 |
OLD | NEW |