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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 request_->set_upload(params->upload.get()); | 305 request_->set_upload(params->upload.get()); |
306 request_->set_context(g_request_context); | 306 request_->set_context(g_request_context); |
307 SimpleAppCacheSystem::SetExtraRequestInfo( | 307 SimpleAppCacheSystem::SetExtraRequestInfo( |
308 request_.get(), params->appcache_host_id, params->request_type); | 308 request_.get(), params->appcache_host_id, params->request_type); |
309 | 309 |
310 download_to_file_ = params->download_to_file; | 310 download_to_file_ = params->download_to_file; |
311 if (download_to_file_) { | 311 if (download_to_file_) { |
312 FilePath path; | 312 FilePath path; |
313 if (file_util::CreateTemporaryFile(&path)) { | 313 if (file_util::CreateTemporaryFile(&path)) { |
314 downloaded_file_ = DeletableFileReference::GetOrCreate( | 314 downloaded_file_ = DeletableFileReference::GetOrCreate( |
315 path, base::MessageLoopProxy::CreateForCurrentThread()); | 315 path, base::MessageLoopProxy::current()); |
316 file_stream_.Open( | 316 file_stream_.Open( |
317 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); | 317 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 request_->Start(); | 321 request_->Start(); |
322 | 322 |
323 if (request_->has_upload() && | 323 if (request_->has_upload() && |
324 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { | 324 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { |
325 upload_progress_timer_.Start( | 325 upload_progress_timer_.Start( |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 | 917 |
918 // static | 918 // static |
919 scoped_refptr<base::MessageLoopProxy> | 919 scoped_refptr<base::MessageLoopProxy> |
920 SimpleResourceLoaderBridge::GetIoThread() { | 920 SimpleResourceLoaderBridge::GetIoThread() { |
921 if (!EnsureIOThread()) { | 921 if (!EnsureIOThread()) { |
922 LOG(DFATAL) << "Failed to create IO thread."; | 922 LOG(DFATAL) << "Failed to create IO thread."; |
923 return NULL; | 923 return NULL; |
924 } | 924 } |
925 return g_io_thread->message_loop_proxy(); | 925 return g_io_thread->message_loop_proxy(); |
926 } | 926 } |
OLD | NEW |