| OLD | NEW |
| 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 return false; | 780 return false; |
| 781 | 781 |
| 782 return confirmed_bad_modules_detected_ > 0; | 782 return confirmed_bad_modules_detected_ > 0; |
| 783 } | 783 } |
| 784 | 784 |
| 785 void EnumerateModulesModel::AcknowledgeConflictNotification() { | 785 void EnumerateModulesModel::AcknowledgeConflictNotification() { |
| 786 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 786 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 787 | 787 |
| 788 if (!conflict_notification_acknowledged_) { | 788 if (!conflict_notification_acknowledged_) { |
| 789 conflict_notification_acknowledged_ = true; | 789 conflict_notification_acknowledged_ = true; |
| 790 FOR_EACH_OBSERVER(Observer, observers_, OnConflictsAcknowledged()); | 790 for (Observer& observer : observers_) |
| 791 observer.OnConflictsAcknowledged(); |
| 791 } | 792 } |
| 792 } | 793 } |
| 793 | 794 |
| 794 int EnumerateModulesModel::suspected_bad_modules_detected() const { | 795 int EnumerateModulesModel::suspected_bad_modules_detected() const { |
| 795 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 796 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 796 return suspected_bad_modules_detected_; | 797 return suspected_bad_modules_detected_; |
| 797 } | 798 } |
| 798 | 799 |
| 799 // Returns the number of confirmed bad modules found in the last scan. | 800 // Returns the number of confirmed bad modules found in the last scan. |
| 800 // Returns 0 if no scan has taken place yet. | 801 // Returns 0 if no scan has taken place yet. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 // Windows its an atomic write. | 838 // Windows its an atomic write. |
| 838 if (!background_mode) | 839 if (!background_mode) |
| 839 module_enumerator_->SetPerModuleDelayToZero(); | 840 module_enumerator_->SetPerModuleDelayToZero(); |
| 840 return; | 841 return; |
| 841 } | 842 } |
| 842 | 843 |
| 843 // Only allow a single scan per process lifetime. Immediately notify any | 844 // Only allow a single scan per process lifetime. Immediately notify any |
| 844 // observers that the scan is complete. At this point |enumerated_modules_| is | 845 // observers that the scan is complete. At this point |enumerated_modules_| is |
| 845 // safe to access as no potentially racing blocking pool task can exist. | 846 // safe to access as no potentially racing blocking pool task can exist. |
| 846 if (!enumerated_modules_.empty()) { | 847 if (!enumerated_modules_.empty()) { |
| 847 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted()); | 848 for (Observer& observer : observers_) |
| 849 observer.OnScanCompleted(); |
| 848 return; | 850 return; |
| 849 } | 851 } |
| 850 | 852 |
| 851 // ScanNow does not block, rather it simply schedules a task. | 853 // ScanNow does not block, rather it simply schedules a task. |
| 852 module_enumerator_.reset(new ModuleEnumerator(this)); | 854 module_enumerator_.reset(new ModuleEnumerator(this)); |
| 853 if (!background_mode) | 855 if (!background_mode) |
| 854 module_enumerator_->SetPerModuleDelayToZero(); | 856 module_enumerator_->SetPerModuleDelayToZero(); |
| 855 module_enumerator_->ScanNow(&enumerated_modules_); | 857 module_enumerator_->ScanNow(&enumerated_modules_); |
| 856 } | 858 } |
| 857 | 859 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 } | 983 } |
| 982 | 984 |
| 983 module_enumerator_.reset(); | 985 module_enumerator_.reset(); |
| 984 | 986 |
| 985 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 987 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
| 986 suspected_bad_modules_detected_); | 988 suspected_bad_modules_detected_); |
| 987 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 989 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
| 988 confirmed_bad_modules_detected_); | 990 confirmed_bad_modules_detected_); |
| 989 | 991 |
| 990 // Forward the callback to any registered observers. | 992 // Forward the callback to any registered observers. |
| 991 FOR_EACH_OBSERVER(Observer, observers_, OnScanCompleted()); | 993 for (Observer& observer : observers_) |
| 994 observer.OnScanCompleted(); |
| 992 } | 995 } |
| OLD | NEW |