summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/enumerate_modules_model_win.cc11
-rw-r--r--chrome/browser/external_tab_container_win.cc21
-rw-r--r--chrome/browser/external_tab_container_win.h3
-rw-r--r--content/browser/idbbindingutilities_browsertest.cc13
4 files changed, 26 insertions, 22 deletions
diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc
index 9d9488a..375ba64 100644
--- a/chrome/browser/enumerate_modules_model_win.cc
+++ b/chrome/browser/enumerate_modules_model_win.cc
@@ -7,6 +7,7 @@
#include <Tlhelp32.h>
#include <wintrust.h>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/file_path.h"
@@ -399,9 +400,8 @@ void ModuleEnumerator::ScanNow(ModulesVector* list, bool limited_mode) {
if (!limited_mode_) {
CHECK(BrowserThread::GetCurrentThreadIdentifier(&callback_thread_id_));
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this, &ModuleEnumerator::ScanImpl));
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&ModuleEnumerator::ScanImpl, this));
} else {
// Run it synchronously.
ScanImpl();
@@ -443,9 +443,8 @@ void ModuleEnumerator::ScanImpl() {
if (!limited_mode_) {
// Send a reply back on the UI thread.
- BrowserThread::PostTask(
- callback_thread_id_, FROM_HERE,
- NewRunnableMethod(this, &ModuleEnumerator::ReportBack));
+ BrowserThread::PostTask(callback_thread_id_, FROM_HERE,
+ base::Bind(&ModuleEnumerator::ReportBack, this));
} else {
// We are on the main thread already.
ReportBack();
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 519a2ca..7dedb68b 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -6,6 +6,8 @@
#include <string>
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/debug/trace_event.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
@@ -102,7 +104,7 @@ ExternalTabContainer::ExternalTabContainer(
automation_resource_message_filter_(filter),
load_requests_via_automation_(false),
handle_top_level_requests_(false),
- external_method_factory_(this),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
pending_(false),
focus_manager_(NULL),
external_tab_view_(NULL),
@@ -198,8 +200,8 @@ bool ExternalTabContainer::Init(Profile* profile,
// Navigate out of context since we don't have a 'tab_handle_' yet.
MessageLoop::current()->PostTask(
FROM_HERE,
- external_method_factory_.NewRunnableMethod(
- &ExternalTabContainer::Navigate, initial_url, referrer));
+ base::Bind(&ExternalTabContainer::Navigate, weak_factory_.GetWeakPtr(),
+ initial_url, referrer));
}
// We need WS_POPUP to be on the window during initialization, but
@@ -262,9 +264,8 @@ bool ExternalTabContainer::Reinitialize(
// Wait for the automation channel to be initialized before resuming pending
// render views and sending in the navigation state.
MessageLoop::current()->PostTask(
- FROM_HERE,
- external_method_factory_.NewRunnableMethod(
- &ExternalTabContainer::OnReinitialize));
+ FROM_HERE, base::Bind(&ExternalTabContainer::OnReinitialize,
+ weak_factory_.GetWeakPtr()));
if (parent_window)
SetParent(GetNativeView(), parent_window);
@@ -542,10 +543,12 @@ bool ExternalTabContainer::CanDownload(TabContents* source, int request_id) {
// In case the host needs to show UI that needs to take the focus.
::AllowSetForegroundWindow(ASFW_ANY);
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(automation_resource_message_filter_.get(),
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::IgnoreReturn<bool>(base::Bind(
&AutomationResourceMessageFilter::SendDownloadRequestToHost,
- 0, tab_handle_, request_id));
+ automation_resource_message_filter_.get(), 0, tab_handle_,
+ request_id)));
}
} else {
DLOG(WARNING) << "Downloads are only supported with host browser network "
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 0f97973..4f97743 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/browser/infobars/infobar_container.h"
#include "chrome/browser/net/chrome_url_request_context.h"
@@ -303,7 +304,7 @@ class ExternalTabContainer : public TabContentsDelegate,
// Allows us to run tasks on the ExternalTabContainer instance which are
// bound by its lifetime.
- ScopedRunnableMethodFactory<ExternalTabContainer> external_method_factory_;
+ base::WeakPtrFactory<ExternalTabContainer> weak_factory_;
// The URL request context to be used for this tab. Can be NULL.
scoped_refptr<ChromeURLRequestContextGetter> request_context_;
diff --git a/content/browser/idbbindingutilities_browsertest.cc b/content/browser/idbbindingutilities_browsertest.cc
index ae7507c..6c1f562 100644
--- a/content/browser/idbbindingutilities_browsertest.cc
+++ b/content/browser/idbbindingutilities_browsertest.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/utf_string_conversions.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -92,7 +93,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &IDBKeyPathHelper::CreateUtilityProcess));
+ base::Bind(&IDBKeyPathHelper::CreateUtilityProcess, this));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -107,7 +108,7 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &IDBKeyPathHelper::DestroyUtilityProcess));
+ base::Bind(&IDBKeyPathHelper::DestroyUtilityProcess, this));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -136,8 +137,8 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &IDBKeyPathHelper::CheckValuesForKeyPath,
- id, serialized_values, key_path));
+ base::Bind(&IDBKeyPathHelper::CheckValuesForKeyPath, this, id,
+ serialized_values, key_path));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -153,8 +154,8 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &IDBKeyPathHelper::CheckInjectValue,
- key, value, key_path));
+ base::Bind(&IDBKeyPathHelper::CheckInjectValue, this, key, value,
+ key_path));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));