OLD | NEW |
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 #include "content/browser/byte_stream.h" | 5 #include "content/browser/byte_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 void ByteStreamReaderImpl::TransferDataInternal( | 357 void ByteStreamReaderImpl::TransferDataInternal( |
358 scoped_ptr<ContentVector> transfer_buffer, | 358 scoped_ptr<ContentVector> transfer_buffer, |
359 size_t buffer_size, | 359 size_t buffer_size, |
360 bool source_complete, | 360 bool source_complete, |
361 DownloadInterruptReason status) { | 361 DownloadInterruptReason status) { |
362 DCHECK(my_task_runner_->RunsTasksOnCurrentThread()); | 362 DCHECK(my_task_runner_->RunsTasksOnCurrentThread()); |
363 | 363 |
364 bool was_empty = available_contents_.empty(); | 364 bool was_empty = available_contents_.empty(); |
365 | 365 |
366 if (transfer_buffer.get()) { | 366 if (transfer_buffer) { |
367 available_contents_.insert(available_contents_.end(), | 367 available_contents_.insert(available_contents_.end(), |
368 transfer_buffer->begin(), | 368 transfer_buffer->begin(), |
369 transfer_buffer->end()); | 369 transfer_buffer->end()); |
370 } | 370 } |
371 | 371 |
372 if (source_complete) { | 372 if (source_complete) { |
373 received_status_ = true; | 373 received_status_ = true; |
374 status_ = status; | 374 status_ = status; |
375 } | 375 } |
376 | 376 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 ByteStreamReaderImpl* out = new ByteStreamReaderImpl( | 425 ByteStreamReaderImpl* out = new ByteStreamReaderImpl( |
426 output_task_runner, output_flag, buffer_size); | 426 output_task_runner, output_flag, buffer_size); |
427 | 427 |
428 in->SetPeer(out, output_task_runner, output_flag); | 428 in->SetPeer(out, output_task_runner, output_flag); |
429 out->SetPeer(in, input_task_runner, input_flag); | 429 out->SetPeer(in, input_task_runner, input_flag); |
430 input->reset(in); | 430 input->reset(in); |
431 output->reset(out); | 431 output->reset(out); |
432 } | 432 } |
433 | 433 |
434 } // namespace content | 434 } // namespace content |
OLD | NEW |