summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/boot_times_loader.cc12
-rw-r--r--chrome/browser/chromeos/boot_times_loader.h4
-rw-r--r--chrome/browser/download/download_prefs.cc1
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc1
-rw-r--r--chrome/browser/history/history_backend.cc2
-rw-r--r--chrome/browser/omnibox_search_hint.cc1
-rw-r--r--chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc125
-rw-r--r--chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc3
-rw-r--r--chrome/browser/ui/webui/options2/certificate_manager_handler2.cc30
-rw-r--r--chrome/test/base/view_event_test_base.h2
-rw-r--r--chrome/utility/chrome_content_utility_client.cc8
-rw-r--r--content/browser/browser_main_loop.cc5
-rw-r--r--content/public/common/main_function_params.h3
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc27
-rw-r--r--content/renderer/renderer_accessibility.cc10
-rw-r--r--content/renderer/renderer_accessibility.h4
-rw-r--r--content/test/browser_test_base.cc5
17 files changed, 133 insertions, 110 deletions
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index ca821444..f601332 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -212,7 +212,7 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) {
}
void BootTimesLoader::Backend::GetBootTimes(
- scoped_refptr<GetBootTimesRequest> request) {
+ const scoped_refptr<GetBootTimesRequest>& request) {
const FilePath::CharType kFirmwareBootTime[] = FPL("firmware-boot-time");
const FilePath::CharType kPreStartup[] = FPL("pre-startup");
const FilePath::CharType kChromeExec[] = FPL("chrome-exec");
@@ -356,13 +356,7 @@ void BootTimesLoader::LoginDone() {
// Don't swamp the FILE thread right away.
BrowserThread::PostDelayedTask(
BrowserThread::FILE, FROM_HERE,
- // This doesn't compile without std::string(...), as base::Bind doesn't
- // accept arrays.
- // TODO(jhawkins): Verify this is true for base::Bind.
- base::Bind(WriteTimes,
- std::string(kLoginTimes),
- std::string(kUmaLogin),
- std::string(kUmaLoginPrefix),
+ base::Bind(&WriteTimes, kLoginTimes, kUmaLogin, kUmaLoginPrefix,
login_time_markers_),
kLoginTimeWriteDelayMs);
}
@@ -377,7 +371,7 @@ void BootTimesLoader::WriteLogoutTimes() {
void BootTimesLoader::RecordStats(const std::string& name, const Stats& stats) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- base::Bind(RecordStatsDelayed, name, stats.uptime, stats.disk));
+ base::Bind(&RecordStatsDelayed, name, stats.uptime, stats.disk));
}
BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() {
diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h
index 0e56fdd..0cae34f 100644
--- a/chrome/browser/chromeos/boot_times_loader.h
+++ b/chrome/browser/chromeos/boot_times_loader.h
@@ -10,7 +10,7 @@
#include <string>
#include "base/atomic_sequence_num.h"
-#include "base/callback_old.h"
+#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/time.h"
#include "chrome/browser/cancelable_request.h"
@@ -120,7 +120,7 @@ class BootTimesLoader
public:
Backend() {}
- void GetBootTimes(scoped_refptr<GetBootTimesRequest> request);
+ void GetBootTimes(const scoped_refptr<GetBootTimesRequest>& request);
private:
friend class base::RefCountedThreadSafe<Backend>;
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc
index 6096ac5..e6e127b 100644
--- a/chrome/browser/download/download_prefs.cc
+++ b/chrome/browser/download/download_prefs.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/download/download_prefs.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/string_split.h"
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 094088e..5877b2a 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -15,6 +15,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_value_serializer.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 1d86061..3e44f24 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -9,7 +9,7 @@
#include <set>
#include <vector>
-#include "base/callback.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc
index 92532a1..8762d61 100644
--- a/chrome/browser/omnibox_search_hint.cc
+++ b/chrome/browser/omnibox_search_hint.cc
@@ -9,7 +9,6 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/task.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
diff --git a/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc b/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc
index 10026d3..da93e54 100644
--- a/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc
+++ b/chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc
@@ -58,6 +58,29 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl {
private:
virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
+ struct KDialogParams {
+ KDialogParams(const std::string& type, const std::string& title,
+ const FilePath& default_path, gfx::NativeWindow parent,
+ bool file_operation, bool multiple_selection,
+ void* kdialog_params,
+ void (SelectFileDialogImplKDE::*callback)(const std::string&,
+ int, void*))
+ : type(type), title(title), default_path(default_path), parent(parent),
+ file_operation(file_operation),
+ multiple_selection(multiple_selection),
+ kdialog_params(kdialog_params), callback(callback) {
+ }
+
+ std::string type;
+ std::string title;
+ FilePath default_path;
+ gfx::NativeWindow parent;
+ bool file_operation;
+ bool multiple_selection;
+ void* kdialog_params;
+ void (SelectFileDialogImplKDE::*callback)(const std::string&, int, void*);
+ };
+
// Get the filters from |file_types_| and concatenate them into
// |filter_string|.
std::string GetMimeTypeFilterString();
@@ -68,11 +91,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl {
bool file_operation, bool multiple_selection, CommandLine* command_line);
// Call KDialog on the FILE thread and post results back to the UI thread.
- void CallKDialogOutput(const std::string& type, const std::string& title,
- const FilePath& default_path, gfx::NativeWindow parent,
- bool file_operation, bool multiple_selection, void* params,
- void (SelectFileDialogImplKDE::*callback)(const std::string&,
- int, void*));
+ void CallKDialogOutput(const KDialogParams& params);
// Notifies the listener that a single file was chosen.
void FileSelected(const FilePath& path, void* params);
@@ -216,15 +235,12 @@ std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() {
return filter_string;
}
-void SelectFileDialogImplKDE::CallKDialogOutput(
- const std::string& type, const std::string& title,
- const FilePath& default_path, gfx::NativeWindow parent,
- bool file_operation, bool multiple_selection, void* params,
- void (SelectFileDialogImplKDE::*callback)(const std::string&, int, void*)) {
+void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
CommandLine command_line(FilePath("kdialog"));
- GetKDialogCommandLine(type, title, default_path, parent, file_operation,
- multiple_selection, &command_line);
+ GetKDialogCommandLine(params.type, params.title, params.default_path,
+ params.parent, params.file_operation,
+ params.multiple_selection, &command_line);
std::string output;
int exit_code;
// Get output from KDialog
@@ -233,12 +249,13 @@ void SelectFileDialogImplKDE::CallKDialogOutput(
output.erase(output.size() - 1);
// Now the dialog is no longer showing. We can erase its parent from the
// parent set.
- std::set<GtkWindow*>::iterator iter = parents_.find(parent);
+ std::set<GtkWindow*>::iterator iter = parents_.find(params.parent);
if (iter != parents_.end())
parents_.erase(iter);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(callback, this, output, exit_code, params));
+ base::Bind(params.callback, this, output, exit_code,
+ params.kdialog_params));
}
void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type,
@@ -307,57 +324,65 @@ void SelectFileDialogImplKDE::FileNotSelected(void* params) {
void SelectFileDialogImplKDE::CreateSelectFolderDialog(
const std::string& title, const FilePath& default_path,
gfx::NativeWindow parent, void *params) {
- Task* dialog_task =
- NewRunnableMethod(
- this, &SelectFileDialogImplKDE::CallKDialogOutput,
- std::string("--getexistingdirectory"),
- GetTitle(title, IDS_SELECT_FOLDER_DIALOG_TITLE),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, false, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse);
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task);
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(
+ &SelectFileDialogImplKDE::CallKDialogOutput,
+ this,
+ KDialogParams(
+ "--getexistingdirectory",
+ GetTitle(title, IDS_SELECT_FOLDER_DIALOG_TITLE),
+ default_path.empty() ? *last_opened_path_ : default_path,
+ parent, false, false, params,
+ &SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse)));
}
void SelectFileDialogImplKDE::CreateFileOpenDialog(
const std::string& title, const FilePath& default_path,
gfx::NativeWindow parent, void* params) {
- Task* dialog_task =
- NewRunnableMethod(
- this, &SelectFileDialogImplKDE::CallKDialogOutput,
- std::string("--getopenfilename"),
- GetTitle(title, IDS_OPEN_FILE_DIALOG_TITLE),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, true, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse);
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task);
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(
+ &SelectFileDialogImplKDE::CallKDialogOutput,
+ this,
+ KDialogParams(
+ "--getopenfilename",
+ GetTitle(title, IDS_OPEN_FILE_DIALOG_TITLE),
+ default_path.empty() ? *last_opened_path_ : default_path,
+ parent, true, false, params,
+ &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse)));
}
void SelectFileDialogImplKDE::CreateMultiFileOpenDialog(
const std::string& title, const FilePath& default_path,
gfx::NativeWindow parent, void* params) {
- Task* dialog_task =
- NewRunnableMethod(
- this, &SelectFileDialogImplKDE::CallKDialogOutput,
- std::string("--getopenfilename"),
- GetTitle(title, IDS_OPEN_FILES_DIALOG_TITLE),
- default_path.empty() ? *last_opened_path_ : default_path,
- parent, true, true, params,
- &SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse);
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task);
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(
+ &SelectFileDialogImplKDE::CallKDialogOutput,
+ this,
+ KDialogParams(
+ "--getopenfilename",
+ GetTitle(title, IDS_OPEN_FILES_DIALOG_TITLE),
+ default_path.empty() ? *last_opened_path_ : default_path,
+ parent, true, true, params,
+ &SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse)));
}
void SelectFileDialogImplKDE::CreateSaveAsDialog(
const std::string& title, const FilePath& default_path,
gfx::NativeWindow parent, void* params) {
- Task* dialog_task =
- NewRunnableMethod(
- this, &SelectFileDialogImplKDE::CallKDialogOutput,
- std::string("--getsavefilename"),
- GetTitle(title, IDS_SAVE_AS_DIALOG_TITLE),
- default_path.empty() ? *last_saved_path_ : default_path,
- parent, true, false, params,
- &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse);
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, dialog_task);
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(
+ &SelectFileDialogImplKDE::CallKDialogOutput,
+ this,
+ KDialogParams(
+ "--getsavefilename",
+ GetTitle(title, IDS_SAVE_AS_DIALOG_TITLE),
+ default_path.empty() ? *last_saved_path_ : default_path,
+ parent, true, false, params,
+ &SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse)));
}
void SelectFileDialogImplKDE::SelectSingleFileHelper(const std::string& output,
diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc
index 8801370..c17b283 100644
--- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc
+++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc
@@ -466,5 +466,4 @@ void Downloader::DownloadStarted(bool success, const GURL& url) {
listeners_.erase(listener_range.first, listener_range.second);
}
-} // namespace imageburner.
-
+} // namespace imageburner
diff --git a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
index 1bf972d..960e7fe 100644
--- a/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
+++ b/chrome/browser/ui/webui/options2/certificate_manager_handler2.cc
@@ -155,19 +155,19 @@ class FileAccessProvider
// TODO(mattm): don't pass std::string by value.. could use RefCountedBytes
// but it's a vector. Maybe do the derive from CancelableRequest thing
// described in cancelable_request.h?
- typedef Callback2<int, std::string>::Type ReadCallback;
+ typedef base::Callback<void(int, std::string)> ReadCallback;
// Reports 0 on success or errno on failure, and the number of bytes written,
// on success.
- typedef Callback2<int, int>::Type WriteCallback;
+ typedef base::Callback<void(int, int)> WriteCallback;
Handle StartRead(const FilePath& path,
CancelableRequestConsumerBase* consumer,
- ReadCallback* callback);
+ const ReadCallback& callback);
Handle StartWrite(const FilePath& path,
const std::string& data,
CancelableRequestConsumerBase* consumer,
- WriteCallback* callback);
+ const WriteCallback& callback);
private:
void DoRead(scoped_refptr<CancelableRequest<ReadCallback> > request,
@@ -180,7 +180,7 @@ class FileAccessProvider
CancelableRequestProvider::Handle FileAccessProvider::StartRead(
const FilePath& path,
CancelableRequestConsumerBase* consumer,
- FileAccessProvider::ReadCallback* callback) {
+ const FileAccessProvider::ReadCallback& callback) {
scoped_refptr<CancelableRequest<ReadCallback> > request(
new CancelableRequest<ReadCallback>(callback));
AddRequest(request, consumer);
@@ -198,7 +198,7 @@ CancelableRequestProvider::Handle FileAccessProvider::StartWrite(
const FilePath& path,
const std::string& data,
CancelableRequestConsumerBase* consumer,
- WriteCallback* callback) {
+ const WriteCallback& callback) {
scoped_refptr<CancelableRequest<WriteCallback> > request(
new CancelableRequest<WriteCallback>(callback));
AddRequest(request, consumer);
@@ -223,7 +223,7 @@ void FileAccessProvider::DoRead(
bool success = file_util::ReadFileToString(path, &data);
int saved_errno = success ? 0 : errno;
VLOG(1) << "DoRead done read: " << success << " " << data.size();
- request->ForwardResult(ReadCallback::TupleType(saved_errno, data));
+ request->ForwardResult(saved_errno, data);
}
void FileAccessProvider::DoWrite(
@@ -238,14 +238,14 @@ void FileAccessProvider::DoWrite(
if (request->canceled())
return;
- request->ForwardResult(WriteCallback::TupleType(saved_errno, bytes_written));
+ request->ForwardResult(saved_errno, bytes_written);
}
///////////////////////////////////////////////////////////////////////////////
// CertificateManagerHandler
CertificateManagerHandler::CertificateManagerHandler()
- : file_access_provider_(new FileAccessProvider) {
+ : file_access_provider_(new FileAccessProvider()) {
certificate_manager_model_.reset(new CertificateManagerModel(this));
}
@@ -623,7 +623,8 @@ void CertificateManagerHandler::ExportPersonalSlotsUnlocked() {
file_path_,
output,
&consumer_,
- NewCallback(this, &CertificateManagerHandler::ExportPersonalFileWritten));
+ base::Bind(&CertificateManagerHandler::ExportPersonalFileWritten,
+ base::Unretained(this)));
}
void CertificateManagerHandler::ExportPersonalFileWritten(int write_errno,
@@ -677,7 +678,8 @@ void CertificateManagerHandler::ImportPersonalPasswordSelected(
file_access_provider_->StartRead(
file_path_,
&consumer_,
- NewCallback(this, &CertificateManagerHandler::ImportPersonalFileRead));
+ base::Bind(&CertificateManagerHandler::ImportPersonalFileRead,
+ base::Unretained(this)));
}
void CertificateManagerHandler::ImportPersonalFileRead(
@@ -783,7 +785,8 @@ void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) {
file_access_provider_->StartRead(
file_path_,
&consumer_,
- NewCallback(this, &CertificateManagerHandler::ImportServerFileRead));
+ base::Bind(&CertificateManagerHandler::ImportServerFileRead,
+ base::Unretained(this)));
}
void CertificateManagerHandler::ImportServerFileRead(int read_errno,
@@ -838,7 +841,8 @@ void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) {
file_access_provider_->StartRead(
file_path_,
&consumer_,
- NewCallback(this, &CertificateManagerHandler::ImportCAFileRead));
+ base::Bind(&CertificateManagerHandler::ImportCAFileRead,
+ base::Unretained(this)));
}
void CertificateManagerHandler::ImportCAFileRead(int read_errno,
diff --git a/chrome/test/base/view_event_test_base.h b/chrome/test/base/view_event_test_base.h
index b4eda60..e0bc18b 100644
--- a/chrome/test/base/view_event_test_base.h
+++ b/chrome/test/base/view_event_test_base.h
@@ -57,7 +57,7 @@ class Size;
// // Schedule the mouse move at a location slightly different from where
// // you really want to move to.
// ui_controls::SendMouseMoveNotifyWhenDone(loc.x + 10, loc.y,
-// NewRunnableMethod(this, YYY));
+// base::Bind(&YYY, this));
// // Then use this to schedule another mouse move.
// ScheduleMouseMoveInBackground(loc.x, loc.y);
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index e5962d5..4211de7 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -4,6 +4,7 @@
#include "chrome/utility/chrome_content_utility_client.h"
+#include "base/bind.h"
#include "base/base64.h"
#include "base/command_line.h"
#include "base/json/json_reader.h"
@@ -394,11 +395,8 @@ void ChromeContentUtilityClient::OnImportStart(
ImporterCleanup();
}
import_thread_->message_loop()->PostTask(
- FROM_HERE, NewRunnableMethod(importer_.get(),
- &Importer::StartImport,
- source_profile,
- items,
- bridge_));
+ FROM_HERE, base::Bind(&Importer::StartImport, importer_.get(),
+ source_profile, items, bridge_));
}
void ChromeContentUtilityClient::OnImportCancel() {
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 4826be7..e040597 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -410,7 +410,8 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true));
+ base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
+ true));
if (parts_.get())
parts_->PostMainMessageLoopRun();
@@ -556,7 +557,7 @@ void BrowserMainLoop::InitializeToolkit() {
void BrowserMainLoop::MainMessageLoopRun() {
if (parameters_.ui_task)
- MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task);
+ MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
#if defined(OS_MACOSX)
MessageLoopForUI::current()->Run();
diff --git a/content/public/common/main_function_params.h b/content/public/common/main_function_params.h
index 2a8a16d..36995e3 100644
--- a/content/public/common/main_function_params.h
+++ b/content/public/common/main_function_params.h
@@ -11,6 +11,7 @@
#pragma once
#include "base/command_line.h"
+#include "base/callback_forward.h"
#if defined(OS_WIN)
namespace sandbox {
@@ -45,7 +46,7 @@ struct MainFunctionParams {
#endif
// Used by InProcessBrowserTest. If non-null BrowserMain schedules this
// task to run on the MessageLoop and BrowserInit is not invoked.
- Task* ui_task;
+ base::Closure* ui_task;
};
} // namespace content
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index 26a150c..bd5b7f5 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -248,8 +248,7 @@ bool PlatformAudioImpl::Initialize(
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioImpl::InitializeOnIOThread,
- params));
+ base::Bind(&PlatformAudioImpl::InitializeOnIOThread, this, params));
return true;
}
@@ -257,7 +256,7 @@ bool PlatformAudioImpl::StartPlayback() {
if (filter_) {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioImpl::StartPlaybackOnIOThread));
+ base::Bind(&PlatformAudioImpl::StartPlaybackOnIOThread, this));
return true;
}
return false;
@@ -267,7 +266,7 @@ bool PlatformAudioImpl::StopPlayback() {
if (filter_) {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioImpl::StopPlaybackOnIOThread));
+ base::Bind(&PlatformAudioImpl::StopPlaybackOnIOThread, this));
return true;
}
return false;
@@ -329,8 +328,8 @@ void PlatformAudioImpl::OnLowLatencyCreated(
client_->StreamCreated(handle, length, socket_handle);
} else {
main_message_loop_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioImpl::OnLowLatencyCreated,
- handle, socket_handle, length));
+ base::Bind(&PlatformAudioImpl::OnLowLatencyCreated, this, handle,
+ socket_handle, length));
}
}
@@ -415,24 +414,21 @@ bool PlatformAudioInputImpl::Initialize(
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioInputImpl::InitializeOnIOThread,
- params));
+ base::Bind(&PlatformAudioInputImpl::InitializeOnIOThread, this, params));
return true;
}
bool PlatformAudioInputImpl::StartCapture() {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this,
- &PlatformAudioInputImpl::StartCaptureOnIOThread));
+ base::Bind(&PlatformAudioInputImpl::StartCaptureOnIOThread, this));
return true;
}
bool PlatformAudioInputImpl::StopCapture() {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(this,
- &PlatformAudioInputImpl::StopCaptureOnIOThread));
+ base::Bind(&PlatformAudioInputImpl::StopCaptureOnIOThread, this));
return true;
}
@@ -495,9 +491,10 @@ void PlatformAudioInputImpl::OnLowLatencyCreated(
if (client_)
client_->StreamCreated(handle, length, socket_handle);
} else {
- main_message_loop_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &PlatformAudioInputImpl::OnLowLatencyCreated,
- handle, socket_handle, length));
+ main_message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&PlatformAudioInputImpl::OnLowLatencyCreated, this,
+ handle, socket_handle, length));
}
}
diff --git a/content/renderer/renderer_accessibility.cc b/content/renderer/renderer_accessibility.cc
index 43e8f5b..078a3a6 100644
--- a/content/renderer/renderer_accessibility.cc
+++ b/content/renderer/renderer_accessibility.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/command_line.h"
#include "content/common/view_messages.h"
#include "content/public/common/content_switches.h"
@@ -82,7 +83,7 @@ bool WebAccessibilityNotificationToViewHostMsg(
RendererAccessibility::RendererAccessibility(RenderViewImpl* render_view)
: content::RenderViewObserver(render_view),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
browser_root_(NULL),
last_scroll_offset_(gfx::Size()),
ack_pending_(false),
@@ -195,14 +196,15 @@ void RendererAccessibility::PostAccessibilityNotification(
}
pending_notifications_.push_back(acc_notification);
- if (!ack_pending_ && method_factory_.empty()) {
+ if (!ack_pending_ && !weak_factory_.HasWeakPtrs()) {
// When no accessibility notifications are in-flight post a task to send
// the notifications to the browser. We use PostTask so that we can queue
// up additional notifications.
MessageLoop::current()->PostTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(
- &RendererAccessibility::SendPendingAccessibilityNotifications));
+ base::Bind(
+ &RendererAccessibility::SendPendingAccessibilityNotifications,
+ weak_factory_.GetWeakPtr()));
}
}
diff --git a/content/renderer/renderer_accessibility.h b/content/renderer/renderer_accessibility.h
index 43f3048..374ab16 100644
--- a/content/renderer/renderer_accessibility.h
+++ b/content/renderer/renderer_accessibility.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/hash_tables.h"
-#include "base/task.h"
+#include "base/memory/weak_ptr.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotification.h"
@@ -97,7 +97,7 @@ class RendererAccessibility : public content::RenderViewObserver {
WebKit::WebDocument GetMainDocument();
// So we can queue up tasks to be executed later.
- ScopedRunnableMethodFactory<RendererAccessibility> method_factory_;
+ base::WeakPtrFactory<RendererAccessibility> weak_factory_;
// Notifications from WebKit are collected until they are ready to be
// sent to the browser.
diff --git a/content/test/browser_test_base.cc b/content/test/browser_test_base.cc
index a6a3092..8383be9 100644
--- a/content/test/browser_test_base.cc
+++ b/content/test/browser_test_base.cc
@@ -4,8 +4,8 @@
#include "content/test/browser_test_base.h"
+#include "base/bind.h"
#include "base/command_line.h"
-#include "base/task.h"
#include "content/public/common/main_function_params.h"
#include "sandbox/src/dep.h"
@@ -29,7 +29,8 @@ BrowserTestBase::~BrowserTestBase() {
void BrowserTestBase::SetUp() {
content::MainFunctionParams params(*CommandLine::ForCurrentProcess());
params.ui_task =
- NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop);
+ new base::Closure(
+ base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
SetUpInProcessBrowserTestFixture();
BrowserMain(params);