diff options
author | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-23 22:21:41 +0000 |
---|---|---|
committer | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-23 22:21:41 +0000 |
commit | b898f0108b4e39bb86577455470dd42490ff1b7b (patch) | |
tree | f59ecf47f020f2b81c8eeea964e234e6e7eb3213 /chrome/browser | |
parent | bd2262e1ed75af9c45fabe371aa66f83ee3831e5 (diff) | |
download | chromium_src-b898f0108b4e39bb86577455470dd42490ff1b7b.zip chromium_src-b898f0108b4e39bb86577455470dd42490ff1b7b.tar.gz chromium_src-b898f0108b4e39bb86577455470dd42490ff1b7b.tar.bz2 |
base::Bind fixes
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8566033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/omnibox_search_hint.cc | 11 | ||||
-rw-r--r-- | chrome/browser/oom_priority_manager.cc | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 22ff1b5..8e0ae20 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -4,7 +4,9 @@ #include "chrome/browser/omnibox_search_hint.h" +#include "base/bind.h" #include "base/command_line.h" +#include "base/memory/weak_ptr.h" #include "base/metrics/histogram.h" #include "base/task.h" // TODO(avi): remove when conversions not needed any more @@ -79,7 +81,7 @@ class HintInfoBar : public ConfirmInfoBarDelegate { bool should_expire_; // Used to delay the expiration of the info-bar. - ScopedRunnableMethodFactory<HintInfoBar> method_factory_; + base::WeakPtrFactory<HintInfoBar> weak_factory_; DISALLOW_COPY_AND_ASSIGN(HintInfoBar); }; @@ -89,11 +91,12 @@ HintInfoBar::HintInfoBar(OmniboxSearchHint* omnibox_hint) omnibox_hint_(omnibox_hint), action_taken_(false), should_expire_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { // We want the info-bar to stick-around for few seconds and then be hidden // on the next navigation after that. - MessageLoop::current()->PostDelayedTask(FROM_HERE, - method_factory_.NewRunnableMethod(&HintInfoBar::AllowExpiry), + MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&HintInfoBar::AllowExpiry, weak_factory_.GetWeakPtr()), 8000); // 8 seconds. } diff --git a/chrome/browser/oom_priority_manager.cc b/chrome/browser/oom_priority_manager.cc index df8da3a..d684de8 100644 --- a/chrome/browser/oom_priority_manager.cc +++ b/chrome/browser/oom_priority_manager.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <vector> +#include "base/bind.h" #include "base/process.h" #include "base/process_util.h" #include "base/string16.h" @@ -181,8 +182,8 @@ void OomPriorityManager::AdjustFocusedTabScoreOnFileThread() { void OomPriorityManager::OnFocusTabScoreAdjustmentTimeout() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod( - this, &OomPriorityManager::AdjustFocusedTabScoreOnFileThread)); + base::Bind( + &OomPriorityManager::AdjustFocusedTabScoreOnFileThread, this)); } void OomPriorityManager::Observe(int type, @@ -251,9 +252,8 @@ void OomPriorityManager::AdjustOomPriorities() { TabStatsList stats_list = GetTabStatsOnUIThread(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, - &OomPriorityManager::AdjustOomPrioritiesOnFileThread, - stats_list)); + base::Bind(&OomPriorityManager::AdjustOomPrioritiesOnFileThread, + this, stats_list)); } OomPriorityManager::TabStatsList OomPriorityManager::GetTabStatsOnUIThread() { |