Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 6612051: In BlobURLRequestJob, open files asynchronously to avoid blocking the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added DCHECK, merged with trunk Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/blob/blob_url_request_job_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 }; 95 };
96 96
97 static net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, 97 static net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request,
98 const std::string& scheme) { 98 const std::string& scheme) {
99 webkit_blob::BlobStorageController* blob_storage_controller = 99 webkit_blob::BlobStorageController* blob_storage_controller =
100 static_cast<TestShellRequestContext*>(request->context())-> 100 static_cast<TestShellRequestContext*>(request->context())->
101 blob_storage_controller(); 101 blob_storage_controller();
102 return new webkit_blob::BlobURLRequestJob( 102 return new webkit_blob::BlobURLRequestJob(
103 request, 103 request,
104 blob_storage_controller->GetBlobDataFromUrl(request->url()), 104 blob_storage_controller->GetBlobDataFromUrl(request->url()),
105 NULL); 105 SimpleResourceLoaderBridge::GetIoThread());
106 } 106 }
107 107
108 TestShellRequestContextParams* g_request_context_params = NULL; 108 TestShellRequestContextParams* g_request_context_params = NULL;
109 TestShellRequestContext* g_request_context = NULL; 109 TestShellRequestContext* g_request_context = NULL;
110 base::Thread* g_cache_thread = NULL; 110 base::Thread* g_cache_thread = NULL;
111 111
112 //----------------------------------------------------------------------------- 112 //-----------------------------------------------------------------------------
113 113
114 class IOThread : public base::Thread { 114 class IOThread : public base::Thread {
115 public: 115 public:
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 // static 916 // static
917 scoped_refptr<base::MessageLoopProxy> 917 scoped_refptr<base::MessageLoopProxy>
918 SimpleResourceLoaderBridge::GetIoThread() { 918 SimpleResourceLoaderBridge::GetIoThread() {
919 if (!EnsureIOThread()) { 919 if (!EnsureIOThread()) {
920 LOG(DFATAL) << "Failed to create IO thread."; 920 LOG(DFATAL) << "Failed to create IO thread.";
921 return NULL; 921 return NULL;
922 } 922 }
923 return g_io_thread->message_loop_proxy(); 923 return g_io_thread->message_loop_proxy();
924 } 924 }
OLDNEW
« no previous file with comments | « webkit/blob/blob_url_request_job_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698