Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: content/browser/browser_thread_impl.cc

Issue 9086002: base::Bind: Remove Task. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/browser_thread_impl.h ('k') | content/browser/browser_thread_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_impl.cc
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index 94ef3f1e135ccd4c096fad1524f1b78982ffe5ee..7778a584bad1a35f5419e99d10985a3c0e47ee0e 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -116,47 +116,6 @@ BrowserThreadImpl::~BrowserThreadImpl() {
bool BrowserThreadImpl::PostTaskHelper(
BrowserThread::ID identifier,
const tracked_objects::Location& from_here,
- Task* task,
- int64 delay_ms,
- bool nestable) {
- DCHECK(identifier >= 0 && identifier < ID_COUNT);
- // Optimization: to avoid unnecessary locks, we listed the ID enumeration in
- // order of lifetime. So no need to lock if we know that the other thread
- // outlives this one.
- // Note: since the array is so small, ok to loop instead of creating a map,
- // which would require a lock because std::map isn't thread safe, defeating
- // the whole purpose of this optimization.
- BrowserThread::ID current_thread;
- bool guaranteed_to_outlive_target_thread =
- GetCurrentThreadIdentifier(&current_thread) &&
- current_thread <= identifier;
-
- if (!guaranteed_to_outlive_target_thread)
- g_lock.Get().Acquire();
-
- MessageLoop* message_loop = g_browser_threads[identifier] ?
- g_browser_threads[identifier]->message_loop() : NULL;
- if (message_loop) {
- if (nestable) {
- message_loop->PostDelayedTask(from_here, task, delay_ms);
- } else {
- message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms);
- }
- }
-
- if (!guaranteed_to_outlive_target_thread)
- g_lock.Get().Release();
-
- if (!message_loop)
- delete task;
-
- return !!message_loop;
-}
-
-// static
-bool BrowserThreadImpl::PostTaskHelper(
- BrowserThread::ID identifier,
- const tracked_objects::Location& from_here,
const base::Closure& task,
int64 delay_ms,
bool nestable) {
@@ -201,29 +160,6 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy {
// MessageLoopProxy implementation.
virtual bool PostTask(const tracked_objects::Location& from_here,
- Task* task) {
- return BrowserThread::PostTask(id_, from_here, task);
- }
-
- virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
- Task* task, int64 delay_ms) {
- return BrowserThread::PostDelayedTask(id_, from_here, task, delay_ms);
- }
-
- virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
- Task* task) {
- return BrowserThread::PostNonNestableTask(id_, from_here, task);
- }
-
- virtual bool PostNonNestableDelayedTask(
- const tracked_objects::Location& from_here,
- Task* task,
- int64 delay_ms) {
- return BrowserThread::PostNonNestableDelayedTask(id_, from_here, task,
- delay_ms);
- }
-
- virtual bool PostTask(const tracked_objects::Location& from_here,
const base::Closure& task) {
return BrowserThread::PostTask(id_, from_here, task);
}
@@ -321,42 +257,6 @@ bool BrowserThread::PostNonNestableDelayedTask(
}
// static
-bool BrowserThread::PostTask(ID identifier,
- const tracked_objects::Location& from_here,
- Task* task) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, 0, true);
-}
-
-// static
-bool BrowserThread::PostDelayedTask(ID identifier,
- const tracked_objects::Location& from_here,
- Task* task,
- int64 delay_ms) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay_ms, true);
-}
-
-// static
-bool BrowserThread::PostNonNestableTask(
- ID identifier,
- const tracked_objects::Location& from_here,
- Task* task) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, 0, false);
-}
-
-// static
-bool BrowserThread::PostNonNestableDelayedTask(
- ID identifier,
- const tracked_objects::Location& from_here,
- Task* task,
- int64 delay_ms) {
- return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay_ms, false);
-}
-
-// static
bool BrowserThread::PostTaskAndReply(
ID identifier,
const tracked_objects::Location& from_here,
« no previous file with comments | « content/browser/browser_thread_impl.h ('k') | content/browser/browser_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698