OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "content/browser/after_startup_task_poster_impl.h" |
17 #include "content/public/browser/browser_thread_delegate.h" | 18 #include "content/public/browser/browser_thread_delegate.h" |
18 #include "net/disk_cache/simple/simple_backend_impl.h" | 19 #include "net/disk_cache/simple/simple_backend_impl.h" |
19 | 20 |
20 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
21 #include "base/android/jni_android.h" | 22 #include "base/android/jni_android.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 namespace { | 27 namespace { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // static | 359 // static |
359 bool BrowserThread::PostBlockingPoolSequencedTask( | 360 bool BrowserThread::PostBlockingPoolSequencedTask( |
360 const std::string& sequence_token_name, | 361 const std::string& sequence_token_name, |
361 const tracked_objects::Location& from_here, | 362 const tracked_objects::Location& from_here, |
362 const base::Closure& task) { | 363 const base::Closure& task) { |
363 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask( | 364 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask( |
364 sequence_token_name, from_here, task); | 365 sequence_token_name, from_here, task); |
365 } | 366 } |
366 | 367 |
367 // static | 368 // static |
| 369 bool BrowserThread::PostAfterStartupTask( |
| 370 const tracked_objects::Location& from_here, |
| 371 const scoped_refptr<base::TaskRunner>& task_runner, |
| 372 const base::Closure& task) { |
| 373 GetAfterStartupTaskPoster().PostAfterStartup( |
| 374 from_here, task_runner, task); |
| 375 return true; |
| 376 } |
| 377 |
| 378 // static |
| 379 bool BrowserThread::PostAfterStartupTaskAndReply( |
| 380 const tracked_objects::Location& from_here, |
| 381 const scoped_refptr<base::TaskRunner>& task_runner, |
| 382 const base::Closure& task, |
| 383 const base::Closure& reply) { |
| 384 GetAfterStartupTaskPoster().PostAfterStartupAndReply( |
| 385 from_here, task_runner, task, reply); |
| 386 return true; |
| 387 } |
| 388 |
| 389 // static |
368 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() { | 390 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() { |
369 return g_globals.Get().blocking_pool.get(); | 391 return g_globals.Get().blocking_pool.get(); |
370 } | 392 } |
371 | 393 |
372 // static | 394 // static |
373 bool BrowserThread::IsThreadInitialized(ID identifier) { | 395 bool BrowserThread::IsThreadInitialized(ID identifier) { |
374 if (g_globals == NULL) | 396 if (g_globals == NULL) |
375 return false; | 397 return false; |
376 | 398 |
377 BrowserThreadGlobals& globals = g_globals.Get(); | 399 BrowserThreadGlobals& globals = g_globals.Get(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 AtomicWord* storage = reinterpret_cast<AtomicWord*>( | 552 AtomicWord* storage = reinterpret_cast<AtomicWord*>( |
531 &globals.thread_delegates[identifier]); | 553 &globals.thread_delegates[identifier]); |
532 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 554 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
533 storage, reinterpret_cast<AtomicWord>(delegate)); | 555 storage, reinterpret_cast<AtomicWord>(delegate)); |
534 | 556 |
535 // This catches registration when previously registered. | 557 // This catches registration when previously registered. |
536 DCHECK(!delegate || !old_pointer); | 558 DCHECK(!delegate || !old_pointer); |
537 } | 559 } |
538 | 560 |
539 } // namespace content | 561 } // namespace content |
OLD | NEW |