diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 22:14:10 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 22:14:10 +0000 |
commit | 8f8c9a3c07340e6078dd443f615b55a7f397fe2b (patch) | |
tree | 6183c9366395626d9c043b48dae7b83d9325c49d | |
parent | 076bca74bc87a189fe2fa3fa8d3e74438c2b7eac (diff) | |
download | chromium_src-8f8c9a3c07340e6078dd443f615b55a7f397fe2b.zip chromium_src-8f8c9a3c07340e6078dd443f615b55a7f397fe2b.tar.gz chromium_src-8f8c9a3c07340e6078dd443f615b55a7f397fe2b.tar.bz2 |
Change some uses of old callback types to new ones.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8055022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103028 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/autocomplete/history_url_provider.cc | 5 | ||||
-rw-r--r-- | chrome/browser/google/google_url_tracker.cc | 12 | ||||
-rw-r--r-- | chrome/browser/google/google_url_tracker.h | 3 |
4 files changed, 14 insertions, 11 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index f56067d..8e683af 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" @@ -71,8 +72,8 @@ void TestProvider::Start(const AutocompleteInput& input, if (input.matches_requested() == AutocompleteInput::ALL_MATCHES) { done_ = false; - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &TestProvider::Run)); + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&TestProvider::Run, + this)); } } diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 2af39bc..1851456 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -7,6 +7,7 @@ #include <algorithm> #include "base/basictypes.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/string_util.h" @@ -355,8 +356,8 @@ void HistoryURLProvider::ExecuteWithDB(history::HistoryBackend* backend, } // Return the results (if any) to the main thread. - params->message_loop->PostTask(FROM_HERE, NewRunnableMethod( - this, &HistoryURLProvider::QueryComplete, params)); + params->message_loop->PostTask(FROM_HERE, base::Bind( + &HistoryURLProvider::QueryComplete, this, params)); } // Used by both autocomplete passes, and therefore called on multiple different diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index 8c0bf46..8feabab 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -6,6 +6,7 @@ #include <vector> +#include "base/bind.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/string_util.h" @@ -113,7 +114,7 @@ GoogleURLTracker::GoogleURLTracker() : infobar_creator_(&CreateInfobar), google_url_(g_browser_process->local_state()->GetString( prefs::kLastKnownGoogleURL)), - ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)), + ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), fetcher_id_(0), queue_wakeup_task_(true), in_startup_sleep_(true), @@ -125,12 +126,11 @@ GoogleURLTracker::GoogleURLTracker() net::NetworkChangeNotifier::AddIPAddressObserver(this); MessageLoop::current()->PostTask(FROM_HERE, - runnable_method_factory_.NewRunnableMethod( - &GoogleURLTracker::QueueWakeupTask)); + base::Bind(&GoogleURLTracker::QueueWakeupTask, + weak_ptr_factory_.GetWeakPtr())); } GoogleURLTracker::~GoogleURLTracker() { - runnable_method_factory_.RevokeAll(); net::NetworkChangeNotifier::RemoveIPAddressObserver(this); } @@ -181,8 +181,8 @@ void GoogleURLTracker::QueueWakeupTask() { // no function to do this. static const int kStartFetchDelayMS = 5000; MessageLoop::current()->PostDelayedTask(FROM_HERE, - runnable_method_factory_.NewRunnableMethod( - &GoogleURLTracker::FinishSleep), + base::Bind(&GoogleURLTracker::FinishSleep, + weak_ptr_factory_.GetWeakPtr()), kStartFetchDelayMS); } diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h index d770065..5fd97ce 100644 --- a/chrome/browser/google/google_url_tracker.h +++ b/chrome/browser/google/google_url_tracker.h @@ -10,6 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "content/common/net/url_fetcher.h" #include "content/common/notification_observer.h" @@ -135,7 +136,7 @@ class GoogleURLTracker : public URLFetcher::Delegate, // configure to use https in search engine templates. GURL google_url_; GURL fetched_google_url_; - ScopedRunnableMethodFactory<GoogleURLTracker> runnable_method_factory_; + base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; scoped_ptr<URLFetcher> fetcher_; int fetcher_id_; bool queue_wakeup_task_; |