summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-29 00:07:03 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-29 00:07:03 +0000
commit716476cf40c8d367b1325c5a46f4e5e886965c28 (patch)
tree691686c712763e6f90ce2f1b9e2d2b022f6005dc /content
parent2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1 (diff)
downloadchromium_src-716476cf40c8d367b1325c5a46f4e5e886965c28.zip
chromium_src-716476cf40c8d367b1325c5a46f4e5e886965c28.tar.gz
chromium_src-716476cf40c8d367b1325c5a46f4e5e886965c28.tar.bz2
Revert 115929 - Convert stragglers not on spreadsheet to base::Bind()
BUG=none TEST=none Review URL: http://codereview.chromium.org/9035002 TBR=ajwong@chromium.org Review URL: http://codereview.chromium.org/9006057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_main_loop.cc9
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/public/common/main_function_params.cc24
-rw-r--r--content/public/common/main_function_params.h14
-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.cc4
8 files changed, 35 insertions, 58 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index f8741dc..4826be7 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -4,8 +4,6 @@
#include "content/browser/browser_main_loop.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -265,7 +263,7 @@ void BrowserMainLoop::MainMessageLoopStart() {
#if defined(OS_WIN)
// If we're running tests (ui_task is non-null), then the ResourceBundle
// has already been initialized.
- if (parameters_.ui_task.is_null()) {
+ if (!parameters_.ui_task) {
// Override the configured locale with the user's preferred UI language.
l10n_util::OverrideLocaleWithUILanguageList();
}
@@ -412,8 +410,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
- true));
+ NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true));
if (parts_.get())
parts_->PostMainMessageLoopRun();
@@ -558,7 +555,7 @@ void BrowserMainLoop::InitializeToolkit() {
}
void BrowserMainLoop::MainMessageLoopRun() {
- if (!parameters_.ui_task.is_null())
+ if (parameters_.ui_task)
MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task);
#if defined(OS_MACOSX)
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 6b7d0a9..0d9dcc6 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -46,7 +46,6 @@
'public/common/frame_navigate_params.h',
'public/common/gpu_info.cc',
'public/common/gpu_info.h',
- 'public/common/main_function_params.cc',
'public/common/main_function_params.h',
'public/common/page_transition_types.cc',
'public/common/page_transition_types.h',
diff --git a/content/public/common/main_function_params.cc b/content/public/common/main_function_params.cc
deleted file mode 100644
index b643f37..0000000
--- a/content/public/common/main_function_params.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-// Author: ajwong@google.com (Albert Wong)
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/public/common/main_function_params.h"
-
-namespace content {
-
-MainFunctionParams::MainFunctionParams(const CommandLine& cl)
- : command_line(cl),
-#if defined(OS_WIN)
- sandbox_info(NULL),
-#elif defined(OS_MACOSX)
- autorelease_pool(NULL),
-#endif
- ui_task() {
-}
-
-MainFunctionParams::~MainFunctionParams() {
-}
-
-} // namespace content
diff --git a/content/public/common/main_function_params.h b/content/public/common/main_function_params.h
index cbc8c11..2a8a16d 100644
--- a/content/public/common/main_function_params.h
+++ b/content/public/common/main_function_params.h
@@ -10,7 +10,6 @@
#define CONTENT_PUBLIC_COMMON_MAIN_FUNCTION_PARAMS_H_
#pragma once
-#include "base/callback.h"
#include "base/command_line.h"
#if defined(OS_WIN)
@@ -30,9 +29,14 @@ class Task;
namespace content {
struct MainFunctionParams {
- explicit MainFunctionParams(const CommandLine& cl);
- ~MainFunctionParams();
-
+ explicit MainFunctionParams(const CommandLine& cl)
+ : command_line(cl),
+#if defined(OS_WIN)
+ sandbox_info(NULL),
+#elif defined(OS_MACOSX)
+ autorelease_pool(NULL),
+#endif
+ ui_task(NULL) {}
const CommandLine& command_line;
#if defined(OS_WIN)
sandbox::SandboxInterfaceInfo* sandbox_info;
@@ -41,7 +45,7 @@ struct MainFunctionParams {
#endif
// Used by InProcessBrowserTest. If non-null BrowserMain schedules this
// task to run on the MessageLoop and BrowserInit is not invoked.
- base::Closure ui_task;
+ Task* ui_task;
};
} // namespace content
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index bd5b7f5..26a150c 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -248,7 +248,8 @@ bool PlatformAudioImpl::Initialize(
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioImpl::InitializeOnIOThread, this, params));
+ NewRunnableMethod(this, &PlatformAudioImpl::InitializeOnIOThread,
+ params));
return true;
}
@@ -256,7 +257,7 @@ bool PlatformAudioImpl::StartPlayback() {
if (filter_) {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioImpl::StartPlaybackOnIOThread, this));
+ NewRunnableMethod(this, &PlatformAudioImpl::StartPlaybackOnIOThread));
return true;
}
return false;
@@ -266,7 +267,7 @@ bool PlatformAudioImpl::StopPlayback() {
if (filter_) {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioImpl::StopPlaybackOnIOThread, this));
+ NewRunnableMethod(this, &PlatformAudioImpl::StopPlaybackOnIOThread));
return true;
}
return false;
@@ -328,8 +329,8 @@ void PlatformAudioImpl::OnLowLatencyCreated(
client_->StreamCreated(handle, length, socket_handle);
} else {
main_message_loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&PlatformAudioImpl::OnLowLatencyCreated, this, handle,
- socket_handle, length));
+ NewRunnableMethod(this, &PlatformAudioImpl::OnLowLatencyCreated,
+ handle, socket_handle, length));
}
}
@@ -414,21 +415,24 @@ bool PlatformAudioInputImpl::Initialize(
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioInputImpl::InitializeOnIOThread, this, params));
+ NewRunnableMethod(this, &PlatformAudioInputImpl::InitializeOnIOThread,
+ params));
return true;
}
bool PlatformAudioInputImpl::StartCapture() {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioInputImpl::StartCaptureOnIOThread, this));
+ NewRunnableMethod(this,
+ &PlatformAudioInputImpl::StartCaptureOnIOThread));
return true;
}
bool PlatformAudioInputImpl::StopCapture() {
ChildProcess::current()->io_message_loop()->PostTask(
FROM_HERE,
- base::Bind(&PlatformAudioInputImpl::StopCaptureOnIOThread, this));
+ NewRunnableMethod(this,
+ &PlatformAudioInputImpl::StopCaptureOnIOThread));
return true;
}
@@ -491,10 +495,9 @@ void PlatformAudioInputImpl::OnLowLatencyCreated(
if (client_)
client_->StreamCreated(handle, length, socket_handle);
} else {
- main_message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&PlatformAudioInputImpl::OnLowLatencyCreated, this,
- handle, socket_handle, length));
+ main_message_loop_proxy_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &PlatformAudioInputImpl::OnLowLatencyCreated,
+ handle, socket_handle, length));
}
}
diff --git a/content/renderer/renderer_accessibility.cc b/content/renderer/renderer_accessibility.cc
index 078a3a6..43e8f5b 100644
--- a/content/renderer/renderer_accessibility.cc
+++ b/content/renderer/renderer_accessibility.cc
@@ -2,7 +2,6 @@
// 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"
@@ -83,7 +82,7 @@ bool WebAccessibilityNotificationToViewHostMsg(
RendererAccessibility::RendererAccessibility(RenderViewImpl* render_view)
: content::RenderViewObserver(render_view),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
browser_root_(NULL),
last_scroll_offset_(gfx::Size()),
ack_pending_(false),
@@ -196,15 +195,14 @@ void RendererAccessibility::PostAccessibilityNotification(
}
pending_notifications_.push_back(acc_notification);
- if (!ack_pending_ && !weak_factory_.HasWeakPtrs()) {
+ if (!ack_pending_ && method_factory_.empty()) {
// 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,
- base::Bind(
- &RendererAccessibility::SendPendingAccessibilityNotifications,
- weak_factory_.GetWeakPtr()));
+ method_factory_.NewRunnableMethod(
+ &RendererAccessibility::SendPendingAccessibilityNotifications));
}
}
diff --git a/content/renderer/renderer_accessibility.h b/content/renderer/renderer_accessibility.h
index 374ab16..43f3048 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/memory/weak_ptr.h"
+#include "base/task.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.
- base::WeakPtrFactory<RendererAccessibility> weak_factory_;
+ ScopedRunnableMethodFactory<RendererAccessibility> method_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 042d39b..a6a3092 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,7 @@ BrowserTestBase::~BrowserTestBase() {
void BrowserTestBase::SetUp() {
content::MainFunctionParams params(*CommandLine::ForCurrentProcess());
params.ui_task =
- base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this);
+ NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop);
SetUpInProcessBrowserTestFixture();
BrowserMain(params);