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

Side by Side Diff: net/disk_cache/backend_impl.cc

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « net/base/network_change_notifier_linux.cc ('k') | net/disk_cache/in_flight_io.cc » ('j') | 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) 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 "net/disk_cache/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // possible at this time, at the price of leaving dirty entries behind. 362 // possible at this time, at the price of leaving dirty entries behind.
363 background_queue_.DropPendingIO(); 363 background_queue_.DropPendingIO();
364 } 364 }
365 365
366 if (background_queue_.BackgroundIsCurrentThread()) { 366 if (background_queue_.BackgroundIsCurrentThread()) {
367 // Unit tests may use the same thread for everything. 367 // Unit tests may use the same thread for everything.
368 CleanupCache(); 368 CleanupCache();
369 } else { 369 } else {
370 background_queue_.background_thread()->PostTask( 370 background_queue_.background_thread()->PostTask(
371 FROM_HERE, base::Bind(&FinalCleanupCallback, base::Unretained(this))); 371 FROM_HERE, base::Bind(&FinalCleanupCallback, base::Unretained(this)));
372 // http://crbug.com/74623
373 base::ThreadRestrictions::ScopedAllowWait allow_wait;
372 done_.Wait(); 374 done_.Wait();
373 } 375 }
374 } 376 }
375 377
376 // If the initialization of the cache fails, and force is true, we will discard 378 // If the initialization of the cache fails, and force is true, we will discard
377 // the whole cache and create a new one. In order to process a potentially large 379 // the whole cache and create a new one. In order to process a potentially large
378 // number of files, we'll rename the cache folder to old_ + original_name + 380 // number of files, we'll rename the cache folder to old_ + original_name +
379 // number, (located on the same parent folder), and spawn a worker thread to 381 // number, (located on the same parent folder), and spawn a worker thread to
380 // delete all the files on all the stale cache folders. The whole process can 382 // delete all the files on all the stale cache folders. The whole process can
381 // still fail if we are not able to rename the cache folder (for instance due to 383 // still fail if we are not able to rename the cache folder (for instance due to
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 if (total_memory > kMaxBuffersSize || total_memory <= 0) 2172 if (total_memory > kMaxBuffersSize || total_memory <= 0)
2171 total_memory = kMaxBuffersSize; 2173 total_memory = kMaxBuffersSize;
2172 2174
2173 done = true; 2175 done = true;
2174 } 2176 }
2175 2177
2176 return static_cast<int>(total_memory); 2178 return static_cast<int>(total_memory);
2177 } 2179 }
2178 2180
2179 } // namespace disk_cache 2181 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | net/disk_cache/in_flight_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698