| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
| 6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
| 7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
| 8 // browser uses IPC. | 8 // browser uses IPC. |
| 9 // | 9 // |
| 10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 path, base::MessageLoopProxy::current()); | 314 path, base::MessageLoopProxy::current()); |
| 315 file_stream_.Open( | 315 file_stream_.Open( |
| 316 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); | 316 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 request_->Start(); | 320 request_->Start(); |
| 321 | 321 |
| 322 if (request_->has_upload() && | 322 if (request_->has_upload() && |
| 323 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { | 323 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { |
| 324 upload_progress_timer_.Start(FROM_HERE, | 324 upload_progress_timer_.Start( |
| 325 base::TimeDelta::FromMilliseconds(kUpdateUploadProgressIntervalMsec), | 325 base::TimeDelta::FromMilliseconds(kUpdateUploadProgressIntervalMsec), |
| 326 this, &RequestProxy::MaybeUpdateUploadProgress); | 326 this, &RequestProxy::MaybeUpdateUploadProgress); |
| 327 } | 327 } |
| 328 | 328 |
| 329 delete params; | 329 delete params; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void AsyncCancel() { | 332 void AsyncCancel() { |
| 333 // This can be null in cases where the request is already done. | 333 // This can be null in cases where the request is already done. |
| 334 if (!request_.get()) | 334 if (!request_.get()) |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 | 899 |
| 900 // static | 900 // static |
| 901 scoped_refptr<base::MessageLoopProxy> | 901 scoped_refptr<base::MessageLoopProxy> |
| 902 SimpleResourceLoaderBridge::GetIoThread() { | 902 SimpleResourceLoaderBridge::GetIoThread() { |
| 903 if (!EnsureIOThread()) { | 903 if (!EnsureIOThread()) { |
| 904 LOG(DFATAL) << "Failed to create IO thread."; | 904 LOG(DFATAL) << "Failed to create IO thread."; |
| 905 return NULL; | 905 return NULL; |
| 906 } | 906 } |
| 907 return g_io_thread->message_loop_proxy(); | 907 return g_io_thread->message_loop_proxy(); |
| 908 } | 908 } |
| OLD | NEW |