OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_thread_impl.h" | 5 #include "content/browser/browser_thread_impl.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 bool BrowserThread::PostNonNestableDelayedTask( | 314 bool BrowserThread::PostNonNestableDelayedTask( |
315 ID identifier, | 315 ID identifier, |
316 const tracked_objects::Location& from_here, | 316 const tracked_objects::Location& from_here, |
317 const base::Closure& task, | 317 const base::Closure& task, |
318 int64 delay_ms) { | 318 int64 delay_ms) { |
319 return BrowserThreadImpl::PostTaskHelper( | 319 return BrowserThreadImpl::PostTaskHelper( |
320 identifier, from_here, task, delay_ms, false); | 320 identifier, from_here, task, delay_ms, false); |
321 } | 321 } |
322 | 322 |
323 // static | 323 // static |
| 324 bool BrowserThread::PostTaskOnIOThread( |
| 325 const tracked_objects::Location& from_here, |
| 326 const base::Closure& task) { |
| 327 return PostTask(BrowserThread::IO, from_here, task); |
| 328 } |
| 329 |
| 330 // static |
324 bool BrowserThread::PostTask(ID identifier, | 331 bool BrowserThread::PostTask(ID identifier, |
325 const tracked_objects::Location& from_here, | 332 const tracked_objects::Location& from_here, |
326 Task* task) { | 333 Task* task) { |
327 return BrowserThreadImpl::PostTaskHelper( | 334 return BrowserThreadImpl::PostTaskHelper( |
328 identifier, from_here, task, 0, true); | 335 identifier, from_here, task, 0, true); |
329 } | 336 } |
330 | 337 |
331 // static | 338 // static |
332 bool BrowserThread::PostDelayedTask(ID identifier, | 339 bool BrowserThread::PostDelayedTask(ID identifier, |
333 const tracked_objects::Location& from_here, | 340 const tracked_objects::Location& from_here, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 AtomicWord* storage = reinterpret_cast<AtomicWord*>( | 418 AtomicWord* storage = reinterpret_cast<AtomicWord*>( |
412 &g_browser_thread_delegates[identifier]); | 419 &g_browser_thread_delegates[identifier]); |
413 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 420 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
414 storage, reinterpret_cast<AtomicWord>(delegate)); | 421 storage, reinterpret_cast<AtomicWord>(delegate)); |
415 | 422 |
416 // This catches registration when previously registered. | 423 // This catches registration when previously registered. |
417 DCHECK(!delegate || !old_pointer); | 424 DCHECK(!delegate || !old_pointer); |
418 } | 425 } |
419 | 426 |
420 } // namespace content | 427 } // namespace content |
OLD | NEW |