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

Side by Side Diff: chrome/browser/enumerate_modules_model_win.cc

Issue 6098009: Make sure the histogram counters for about:conflicts get uploaded.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « no previous file | 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 #include "chrome/browser/enumerate_modules_model_win.h" 5 #include "chrome/browser/enumerate_modules_model_win.h"
6 6
7 #include <Tlhelp32.h> 7 #include <Tlhelp32.h>
8 #include <wintrust.h> 8 #include <wintrust.h>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 void ModuleEnumerator::ScanImpl() { 340 void ModuleEnumerator::ScanImpl() {
341 base::TimeTicks start_time = base::TimeTicks::Now(); 341 base::TimeTicks start_time = base::TimeTicks::Now();
342 342
343 enumerated_modules_->clear(); 343 enumerated_modules_->clear();
344 344
345 // Make sure the path mapping vector is setup so we can collapse paths. 345 // Make sure the path mapping vector is setup so we can collapse paths.
346 PreparePathMappings(); 346 PreparePathMappings();
347 347
348 base::TimeTicks checkpoint = base::TimeTicks::Now();
349
350 // Enumerating loaded modules must happen first since the other types of 348 // Enumerating loaded modules must happen first since the other types of
351 // modules check for duplication against the loaded modules. 349 // modules check for duplication against the loaded modules.
350 base::TimeTicks checkpoint = base::TimeTicks::Now();
352 EnumerateLoadedModules(); 351 EnumerateLoadedModules();
353 HISTOGRAM_TIMES("Conflicts.EnumerateLoadedModules", 352 base::TimeTicks checkpoint2 = base::TimeTicks::Now();
354 base::TimeTicks::Now() - checkpoint); 353 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateLoadedModules",
354 checkpoint2 - checkpoint);
355 355
356 checkpoint = base::TimeTicks::Now(); 356 checkpoint = checkpoint2;
357 EnumerateShellExtensions(); 357 EnumerateShellExtensions();
358 HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions", 358 checkpoint2 = base::TimeTicks::Now();
359 base::TimeTicks::Now() - checkpoint); 359 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions",
360 checkpoint2 - checkpoint);
360 361
361 checkpoint = base::TimeTicks::Now(); 362 checkpoint = checkpoint2;
362 EnumerateWinsockModules(); 363 EnumerateWinsockModules();
363 HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules", 364 checkpoint2 = base::TimeTicks::Now();
364 base::TimeTicks::Now() - checkpoint); 365 UMA_HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules",
366 checkpoint2 - checkpoint);
365 367
366 MatchAgainstBlacklist(); 368 MatchAgainstBlacklist();
367 369
368 std::sort(enumerated_modules_->begin(), 370 std::sort(enumerated_modules_->begin(),
369 enumerated_modules_->end(), ModuleSort); 371 enumerated_modules_->end(), ModuleSort);
370 372
371 if (!limited_mode_) { 373 if (!limited_mode_) {
372 // Send a reply back on the UI thread. 374 // Send a reply back on the UI thread.
373 BrowserThread::PostTask( 375 BrowserThread::PostTask(
374 callback_thread_id_, FROM_HERE, 376 callback_thread_id_, FROM_HERE,
375 NewRunnableMethod(this, &ModuleEnumerator::ReportBack)); 377 NewRunnableMethod(this, &ModuleEnumerator::ReportBack));
376 } else { 378 } else {
377 // We are on the main thread already. 379 // We are on the main thread already.
378 ReportBack(); 380 ReportBack();
379 } 381 }
380 382
381 HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime", 383 UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime",
382 base::TimeTicks::Now() - start_time); 384 base::TimeTicks::Now() - start_time);
383 } 385 }
384 386
385 void ModuleEnumerator::EnumerateLoadedModules() { 387 void ModuleEnumerator::EnumerateLoadedModules() {
386 // Get all modules in the current process. 388 // Get all modules in the current process.
387 ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 389 ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
388 ::GetCurrentProcessId())); 390 ::GetCurrentProcessId()));
389 if (!snap.Get()) 391 if (!snap.Get())
390 return; 392 return;
391 393
392 // Walk the module list. 394 // Walk the module list.
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 module != enumerated_modules_.end(); ++module) { 832 module != enumerated_modules_.end(); ++module) {
831 if (module->status == ModuleEnumerator::CONFIRMED_BAD) 833 if (module->status == ModuleEnumerator::CONFIRMED_BAD)
832 ++confirmed_bad_modules_detected_; 834 ++confirmed_bad_modules_detected_;
833 if (module->status == ModuleEnumerator::SUSPECTED_BAD) 835 if (module->status == ModuleEnumerator::SUSPECTED_BAD)
834 ++suspected_bad_modules_detected_; 836 ++suspected_bad_modules_detected_;
835 } 837 }
836 838
837 scanning_ = false; 839 scanning_ = false;
838 lock->Release(); 840 lock->Release();
839 841
840 HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", 842 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
841 suspected_bad_modules_detected_); 843 suspected_bad_modules_detected_);
842 HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", 844 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
843 confirmed_bad_modules_detected_); 845 confirmed_bad_modules_detected_);
844 846
845 // Notifications are not available in limited mode. 847 // Notifications are not available in limited mode.
846 if (limited_mode_) 848 if (limited_mode_)
847 return; 849 return;
848 850
849 NotificationService::current()->Notify( 851 NotificationService::current()->Notify(
850 NotificationType::MODULE_LIST_ENUMERATED, 852 NotificationType::MODULE_LIST_ENUMERATED,
851 Source<EnumerateModulesModel>(this), 853 Source<EnumerateModulesModel>(this),
852 NotificationService::NoDetails()); 854 NotificationService::NoDetails());
853 855
(...skipping 23 matching lines...) Expand all
877 GenerateHash(WideToUTF8(module.name), &filename); 879 GenerateHash(WideToUTF8(module.name), &filename);
878 GenerateHash(WideToUTF8(module.location), &location); 880 GenerateHash(WideToUTF8(module.location), &location);
879 GenerateHash(WideToUTF8(module.description), &description); 881 GenerateHash(WideToUTF8(module.description), &description);
880 GenerateHash(WideToUTF8(module.digital_signer), &signer); 882 GenerateHash(WideToUTF8(module.digital_signer), &signer);
881 883
882 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, 884 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS,
883 ASCIIToUTF16(filename), ASCIIToUTF16(location), 885 ASCIIToUTF16(filename), ASCIIToUTF16(location),
884 ASCIIToUTF16(description), ASCIIToUTF16(signer)); 886 ASCIIToUTF16(description), ASCIIToUTF16(signer));
885 return GURL(UTF16ToUTF8(url)); 887 return GURL(UTF16ToUTF8(url));
886 } 888 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698