| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/streams/stream_url_request_job.h" | 5 #include "content/browser/streams/stream_url_request_job.h" |
| 6 | 6 |
| 7 #include "base/location.h" | |
| 8 #include "base/single_thread_task_runner.h" | |
| 9 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/thread_task_runner_handle.h" | |
| 11 #include "content/browser/streams/stream.h" | 8 #include "content/browser/streams/stream.h" |
| 12 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 13 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 14 #include "net/http/http_byte_range.h" | 11 #include "net/http/http_byte_range.h" |
| 15 #include "net/http/http_response_headers.h" | 12 #include "net/http/http_response_headers.h" |
| 16 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
| 17 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
| 18 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
| 19 | 16 |
| 20 namespace content { | 17 namespace content { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 pending_buffer_ = NULL; | 73 pending_buffer_ = NULL; |
| 77 pending_buffer_size_ = 0; | 74 pending_buffer_size_ = 0; |
| 78 | 75 |
| 79 total_bytes_read_ += bytes_read; | 76 total_bytes_read_ += bytes_read; |
| 80 NotifyReadComplete(bytes_read); | 77 NotifyReadComplete(bytes_read); |
| 81 } | 78 } |
| 82 | 79 |
| 83 // net::URLRequestJob methods. | 80 // net::URLRequestJob methods. |
| 84 void StreamURLRequestJob::Start() { | 81 void StreamURLRequestJob::Start() { |
| 85 // Continue asynchronously. | 82 // Continue asynchronously. |
| 86 base::ThreadTaskRunnerHandle::Get()->PostTask( | 83 base::MessageLoop::current()->PostTask( |
| 87 FROM_HERE, | 84 FROM_HERE, |
| 88 base::Bind(&StreamURLRequestJob::DidStart, weak_factory_.GetWeakPtr())); | 85 base::Bind(&StreamURLRequestJob::DidStart, weak_factory_.GetWeakPtr())); |
| 89 } | 86 } |
| 90 | 87 |
| 91 void StreamURLRequestJob::Kill() { | 88 void StreamURLRequestJob::Kill() { |
| 92 net::URLRequestJob::Kill(); | 89 net::URLRequestJob::Kill(); |
| 93 weak_factory_.InvalidateWeakPtrs(); | 90 weak_factory_.InvalidateWeakPtrs(); |
| 94 ClearStream(); | 91 ClearStream(); |
| 95 } | 92 } |
| 96 | 93 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 239 } |
| 243 | 240 |
| 244 void StreamURLRequestJob::ClearStream() { | 241 void StreamURLRequestJob::ClearStream() { |
| 245 if (stream_.get()) { | 242 if (stream_.get()) { |
| 246 stream_->RemoveReadObserver(this); | 243 stream_->RemoveReadObserver(this); |
| 247 stream_ = NULL; | 244 stream_ = NULL; |
| 248 } | 245 } |
| 249 } | 246 } |
| 250 | 247 |
| 251 } // namespace content | 248 } // namespace content |
| OLD | NEW |