| 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 "android_webview/browser/net/android_stream_reader_url_request_job.h" | 5 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "android_webview/browser/input_stream.h" | 9 #include "android_webview/browser/input_stream.h" |
| 10 #include "android_webview/browser/net/input_stream_reader.h" | 10 #include "android_webview/browser/net/input_stream_reader.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 void AndroidStreamReaderURLRequestJob::Start() { | 125 void AndroidStreamReaderURLRequestJob::Start() { |
| 126 DCHECK(thread_checker_.CalledOnValidThread()); | 126 DCHECK(thread_checker_.CalledOnValidThread()); |
| 127 // Start reading asynchronously so that all error reporting and data | 127 // Start reading asynchronously so that all error reporting and data |
| 128 // callbacks happen as they would for network requests. | 128 // callbacks happen as they would for network requests. |
| 129 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, | 129 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, |
| 130 net::ERR_IO_PENDING)); | 130 net::ERR_IO_PENDING)); |
| 131 | 131 |
| 132 delegate_->OnStart(); |
| 133 |
| 132 // This could be done in the InputStreamReader but would force more | 134 // This could be done in the InputStreamReader but would force more |
| 133 // complex synchronization in the delegate. | 135 // complex synchronization in the delegate. |
| 134 GetWorkerThreadRunner()->PostTask( | 136 GetWorkerThreadRunner()->PostTask( |
| 135 FROM_HERE, | 137 FROM_HERE, |
| 136 base::Bind( | 138 base::Bind( |
| 137 &OpenInputStreamOnWorkerThread, | 139 &OpenInputStreamOnWorkerThread, |
| 138 base::MessageLoop::current()->message_loop_proxy(), | 140 base::MessageLoop::current()->message_loop_proxy(), |
| 139 // This is intentional - the job could be deleted while the callback | 141 // This is intentional - the job could be deleted while the callback |
| 140 // is executing on the background thread. | 142 // is executing on the background thread. |
| 141 // The delegate will be "returned" to the job once the InputStream | 143 // The delegate will be "returned" to the job once the InputStream |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } else { | 355 } else { |
| 354 // We don't support multiple range requests in one single URL request, | 356 // We don't support multiple range requests in one single URL request, |
| 355 // because we need to do multipart encoding here. | 357 // because we need to do multipart encoding here. |
| 356 NotifyDone(net::URLRequestStatus( | 358 NotifyDone(net::URLRequestStatus( |
| 357 net::URLRequestStatus::FAILED, | 359 net::URLRequestStatus::FAILED, |
| 358 net::ERR_REQUEST_RANGE_NOT_SATISFIABLE)); | 360 net::ERR_REQUEST_RANGE_NOT_SATISFIABLE)); |
| 359 } | 361 } |
| 360 } | 362 } |
| 361 } | 363 } |
| 362 } | 364 } |
| OLD | NEW |