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

Side by Side Diff: chrome/browser/win/enumerate_modules_model.cc

Issue 2368393004: Move EnumerateModulesModel work to the blocking pool. (Closed)
Patch Set: Address gab's comments. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/win/enumerate_modules_model.h ('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) 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 "chrome/browser/win/enumerate_modules_model.h" 5 #include "chrome/browser/win/enumerate_modules_model.h"
6 6
7 #include <softpub.h> 7 #include <softpub.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <tlhelp32.h> 10 #include <tlhelp32.h>
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 ModuleEnumerator::~ModuleEnumerator() { 371 ModuleEnumerator::~ModuleEnumerator() {
372 } 372 }
373 373
374 void ModuleEnumerator::ScanNow(ModulesVector* list) { 374 void ModuleEnumerator::ScanNow(ModulesVector* list) {
375 DCHECK_CURRENTLY_ON(BrowserThread::UI); 375 DCHECK_CURRENTLY_ON(BrowserThread::UI);
376 enumerated_modules_ = list; 376 enumerated_modules_ = list;
377 377
378 // This object can't be reaped until it has finished scanning, so its safe 378 // This object can't be reaped until it has finished scanning, so its safe
379 // to post a raw pointer to another thread. 379 // to post a raw pointer to another thread. It will simply be leaked if the
380 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 380 // scanning has not been finished before shutdown.
381 base::Bind(&ModuleEnumerator::ScanImpl, 381 BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
382 base::Unretained(this))); 382 FROM_HERE,
383 base::Bind(&ModuleEnumerator::ScanImpl,
384 base::Unretained(this)),
385 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
383 } 386 }
384 387
385 void ModuleEnumerator::ScanImpl() { 388 void ModuleEnumerator::ScanImpl() {
386 base::TimeTicks start_time = base::TimeTicks::Now(); 389 base::TimeTicks start_time = base::TimeTicks::Now();
387 390
388 enumerated_modules_->clear(); 391 enumerated_modules_->clear();
389 392
390 // Make sure the path mapping vector is setup so we can collapse paths. 393 // Make sure the path mapping vector is setup so we can collapse paths.
391 PreparePathMappings(); 394 PreparePathMappings();
392 395
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 module_enumerator_.reset(); 861 module_enumerator_.reset();
859 862
860 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", 863 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
861 suspected_bad_modules_detected_); 864 suspected_bad_modules_detected_);
862 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", 865 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
863 confirmed_bad_modules_detected_); 866 confirmed_bad_modules_detected_);
864 867
865 // Forward the callback to any registered observers. 868 // Forward the callback to any registered observers.
866 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted()); 869 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted());
867 } 870 }
OLDNEW
« no previous file with comments | « chrome/browser/win/enumerate_modules_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698