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

Unified Diff: chrome/browser/apps/shortcut_manager.cc

Issue 19482003: ShortcutManager constructor: Added DCHECK for UI thread. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add the same check to TestingProfile::Init. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/shortcut_manager.cc
diff --git a/chrome/browser/apps/shortcut_manager.cc b/chrome/browser/apps/shortcut_manager.cc
index 7ed2da5b863467dbb9fc51a47380f6cdacb06c1f..914d1fd0431f717287b38df786060e6567b32a99 100644
--- a/chrome/browser/apps/shortcut_manager.cc
+++ b/chrome/browser/apps/shortcut_manager.cc
@@ -61,6 +61,12 @@ AppShortcutManager::AppShortcutManager(Profile* profile)
is_profile_info_cache_observer_(false),
prefs_(profile->GetPrefs()),
weak_factory_(this) {
+ // Use of g_browser_process requires that we are either on the UI thread, or
+ // there are no threads initialized (such as in unit tests).
+ DCHECK(
+ !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) ||
+ content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
@@ -69,9 +75,6 @@ AppShortcutManager::AppShortcutManager(Profile* profile)
registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
content::Source<Profile>(profile_));
- // TODO(mgiuca): This use of g_browser_process should be DCHECKed for
- // content::BrowserThread::CurrentlyOn(content::BrowserThread::UI). This check
- // currently fails browser_tests, due to http://crbug.com/251191.
ProfileManager* profile_manager = g_browser_process->profile_manager();
// profile_manager might be NULL in testing environments.
if (profile_manager) {
« no previous file with comments | « no previous file | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698