summaryrefslogtreecommitdiffstats
path: root/chrome/browser/enumerate_modules_model_win.h
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 08:57:45 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 08:57:45 +0000
commitd80268a511216fb8b0f815e50f415046a7320b7f (patch)
treec73482c104ec4605d47c7e9e0b20639fc4c6946c /chrome/browser/enumerate_modules_model_win.h
parentf2b94f97aded3c9e93116bcac143bf2ccb653d46 (diff)
downloadchromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.zip
chromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.tar.gz
chromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.tar.bz2
Integrate about:conflicts with --diagnostics
This should enable the user to find conflicting dlls that are crashing Chrome on startup. This changelist introduces a limited_mode for scanning, since the diagnostics tests run without the help of many Chrome services, so we can't use the File thread for asynchronous scanning or the notification system. Also changed the scanning so that if no signature/description is given in the blacklist, then we mark the DLL as a confirmed match if the name and the location match (before we used to match it as a 'suspected' match). A very sizable chunk of the blacklist is malware, which has no signature, so this gives us the ability to trigger the wrench badge on finding malware (that part remains opt-in through about:flags). Also added failure count to diagnostics output (sometimes the error scrolls off screen, so having a note at the bottom helps). BUG=51105 TEST=All diagnostics tests run as part of the unit tests. Review URL: http://codereview.chromium.org/6098004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/enumerate_modules_model_win.h')
-rw-r--r--chrome/browser/enumerate_modules_model_win.h47
1 files changed, 34 insertions, 13 deletions
diff --git a/chrome/browser/enumerate_modules_model_win.h b/chrome/browser/enumerate_modules_model_win.h
index 1f524c8..4364bb6 100644
--- a/chrome/browser/enumerate_modules_model_win.h
+++ b/chrome/browser/enumerate_modules_model_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -119,11 +119,15 @@ class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> {
~ModuleEnumerator();
// Start scanning the loaded module list (if a scan is not already in
- // progress). This function does not block while reading the module list, but
- // will notify when done through the MODULE_LIST_ENUMERATED notification.
+ // progress). This function does not block while reading the module list
+ // (unless we are in limited_mode, see below), and will notify when done
+ // through the MODULE_LIST_ENUMERATED notification.
// The process will also send MODULE_INCOMPATIBILITY_DETECTED if an
// incompatible module was detected.
- void ScanNow(ModulesVector* list);
+ // When in |limited_mode|, this function will not leverage the File thread
+ // to run asynchronously and will therefore block until scanning is done
+ // (and will also not send out any notifications).
+ void ScanNow(ModulesVector* list, bool limited_mode);
private:
FRIEND_TEST_ALL_PREFIXES(EnumerateModulesTest, CollapsePath);
@@ -131,13 +135,14 @@ class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> {
// The (currently) hard coded blacklist of known bad modules.
static const BlacklistEntry kModuleBlacklist[];
- // This function does the actual file scanning work on the FILE thread. It
- // enumerates all loaded modules in the process and other modules of
- // interest, such as the registered Winsock LSP modules and stores them in
- // |enumerated_modules_|. It then normalizes the module info and matches
- // them against a blacklist of known bad modules. Finally, it calls
- // ReportBack to let the observer know we are done.
- void ScanOnFileThread();
+ // This function does the actual file scanning work on the FILE thread (or
+ // block the main thread when in limited_mode). It enumerates all loaded
+ // modules in the process and other modules of interest, such as the
+ // registered Winsock LSP modules and stores them in |enumerated_modules_|.
+ // It then normalizes the module info and matches them against a blacklist
+ // of known bad modules. Finally, it calls ReportBack to let the observer
+ // know we are done.
+ void ScanImpl();
// Enumerate all modules loaded into the Chrome process.
void EnumerateLoadedModules();
@@ -200,6 +205,9 @@ class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> {
// The observer, who needs to be notified when we are done.
EnumerateModulesModel* observer_;
+ // See limited_mode below.
+ bool limited_mode_;
+
// The thread that we need to call back on to report that we are done.
BrowserThread::ID callback_thread_id_;
@@ -235,8 +243,14 @@ class EnumerateModulesModel {
return confirmed_bad_modules_detected_;
}
- // Asynchronously start the scan for the loaded module list.
- // When the list is ready.
+ // Set to true when we the scanning process can not rely on certain Chrome
+ // services to exists.
+ void set_limited_mode(bool limited_mode) {
+ limited_mode_ = limited_mode;
+ }
+
+ // Asynchronously start the scan for the loaded module list, except when in
+ // limited_mode (in which case it blocks).
void ScanNow();
// Gets the whole module list as a ListValue.
@@ -268,6 +282,13 @@ class EnumerateModulesModel {
// start scanning for modules after a certain amount of time has passed.
base::OneShotTimer<EnumerateModulesModel> check_modules_timer_;
+ // While normally |false|, this mode can be set to indicate that the scanning
+ // process should not rely on certain services normally available to Chrome,
+ // such as the resource bundle and the notification system, not to mention
+ // having multiple threads. This mode is useful during diagnostics, which
+ // runs without firing up all necessary Chrome services first.
+ bool limited_mode_;
+
// True if we are currently scanning for modules.
bool scanning_;