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

Side by Side Diff: chrome/browser/extensions/extension_garbage_collector.cc

Issue 1092963004: [chrome/browser/extensions] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/extension_garbage_collector.h" 5 #include "chrome/browser/extensions/extension_garbage_collector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 base::FileEnumerator::DIRECTORIES); 152 base::FileEnumerator::DIRECTORIES);
153 153
154 for (base::FilePath extension_path = enumerator.Next(); 154 for (base::FilePath extension_path = enumerator.Next();
155 !extension_path.empty(); 155 !extension_path.empty();
156 extension_path = enumerator.Next()) { 156 extension_path = enumerator.Next()) {
157 CheckExtensionDirectory(extension_path, extension_paths); 157 CheckExtensionDirectory(extension_path, extension_paths);
158 } 158 }
159 } 159 }
160 160
161 void ExtensionGarbageCollector::GarbageCollectExtensions() { 161 void ExtensionGarbageCollector::GarbageCollectExtensions() {
162 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 162 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
163 163
164 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); 164 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_);
165 DCHECK(extension_prefs); 165 DCHECK(extension_prefs);
166 166
167 if (extension_prefs->pref_service()->ReadOnly()) 167 if (extension_prefs->pref_service()->ReadOnly())
168 return; 168 return;
169 169
170 if (crx_installs_in_progress_ > 0) { 170 if (crx_installs_in_progress_ > 0) {
171 // Don't garbage collect while there are installations in progress, 171 // Don't garbage collect while there are installations in progress,
172 // which may be using the temporary installation directory. Try to garbage 172 // which may be using the temporary installation directory. Try to garbage
(...skipping 25 matching lines...) Expand all
198 if (!service->GetFileTaskRunner()->PostTask( 198 if (!service->GetFileTaskRunner()->PostTask(
199 FROM_HERE, 199 FROM_HERE,
200 base::Bind(&GarbageCollectExtensionsOnFileThread, 200 base::Bind(&GarbageCollectExtensionsOnFileThread,
201 service->install_directory(), 201 service->install_directory(),
202 extension_paths))) { 202 extension_paths))) {
203 NOTREACHED(); 203 NOTREACHED();
204 } 204 }
205 } 205 }
206 206
207 void ExtensionGarbageCollector::GarbageCollectIsolatedStorageIfNeeded() { 207 void ExtensionGarbageCollector::GarbageCollectIsolatedStorageIfNeeded() {
208 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 208 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
209 209
210 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); 210 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_);
211 DCHECK(extension_prefs); 211 DCHECK(extension_prefs);
212 if (!extension_prefs->NeedsStorageGarbageCollection()) 212 if (!extension_prefs->NeedsStorageGarbageCollection())
213 return; 213 return;
214 extension_prefs->SetNeedsStorageGarbageCollection(false); 214 extension_prefs->SetNeedsStorageGarbageCollection(false);
215 215
216 scoped_ptr<base::hash_set<base::FilePath> > active_paths( 216 scoped_ptr<base::hash_set<base::FilePath> > active_paths(
217 new base::hash_set<base::FilePath>()); 217 new base::hash_set<base::FilePath>());
218 scoped_ptr<ExtensionSet> extensions = 218 scoped_ptr<ExtensionSet> extensions =
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // accounting. 252 // accounting.
253 NOTREACHED(); 253 NOTREACHED();
254 254
255 // Don't let the count go negative to avoid garbage collecting when 255 // Don't let the count go negative to avoid garbage collecting when
256 // an install is actually in progress. 256 // an install is actually in progress.
257 crx_installs_in_progress_ = 0; 257 crx_installs_in_progress_ = 0;
258 } 258 }
259 } 259 }
260 260
261 } // namespace extensions 261 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_data_migrator.cc ('k') | chrome/browser/extensions/extension_gcm_app_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698