| 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/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "content/browser/streams/stream.h" | 8 #include "content/browser/streams/stream.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/http/http_byte_range.h" | 11 #include "net/http/http_byte_range.h" |
| 12 #include "net/http/http_response_headers.h" | 12 #include "net/http/http_response_headers.h" |
| 13 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
| 14 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
| 15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 StreamURLRequestJob::StreamURLRequestJob( | 19 StreamURLRequestJob::StreamURLRequestJob( |
| 20 net::URLRequest* request, | 20 net::URLRequest* request, |
| 21 net::NetworkDelegate* network_delegate, | 21 net::NetworkDelegate* network_delegate, |
| 22 scoped_refptr<Stream> stream) | 22 scoped_refptr<Stream> stream) |
| 23 : net::URLRequestJob(request, network_delegate), | 23 : net::URLRequestJob(request, network_delegate), |
| 24 weak_factory_(this), | |
| 25 stream_(stream), | 24 stream_(stream), |
| 26 headers_set_(false), | 25 headers_set_(false), |
| 27 pending_buffer_size_(0), | 26 pending_buffer_size_(0), |
| 28 total_bytes_read_(0), | 27 total_bytes_read_(0), |
| 29 max_range_(0), | 28 max_range_(0), |
| 30 request_failed_(false) { | 29 request_failed_(false), |
| 30 weak_factory_(this) { |
| 31 DCHECK(stream_.get()); | 31 DCHECK(stream_.get()); |
| 32 stream_->SetReadObserver(this); | 32 stream_->SetReadObserver(this); |
| 33 } | 33 } |
| 34 | 34 |
| 35 StreamURLRequestJob::~StreamURLRequestJob() { | 35 StreamURLRequestJob::~StreamURLRequestJob() { |
| 36 ClearStream(); | 36 ClearStream(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void StreamURLRequestJob::OnDataAvailable(Stream* stream) { | 39 void StreamURLRequestJob::OnDataAvailable(Stream* stream) { |
| 40 // Clear the IO_PENDING status. | 40 // Clear the IO_PENDING status. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 | 240 |
| 241 void StreamURLRequestJob::ClearStream() { | 241 void StreamURLRequestJob::ClearStream() { |
| 242 if (stream_.get()) { | 242 if (stream_.get()) { |
| 243 stream_->RemoveReadObserver(this); | 243 stream_->RemoveReadObserver(this); |
| 244 stream_ = NULL; | 244 stream_ = NULL; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace content | 248 } // namespace content |
| OLD | NEW |