| 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/public/browser/browser_thread_delegate.h" | 17 #include "content/public/browser/browser_thread_delegate.h" |
| 18 #include "content/public/browser/content_browser_client.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 { |
| 27 | 28 |
| (...skipping 330 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 void BrowserThread::PostAfterStartupTask( |
| 370 const tracked_objects::Location& from_here, |
| 371 const scoped_refptr<base::TaskRunner>& task_runner, |
| 372 const base::Closure& task) { |
| 373 GetContentClient()->browser()->PostAfterStartupTask(from_here, task_runner, |
| 374 task); |
| 375 } |
| 376 |
| 377 // static |
| 368 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() { | 378 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() { |
| 369 return g_globals.Get().blocking_pool.get(); | 379 return g_globals.Get().blocking_pool.get(); |
| 370 } | 380 } |
| 371 | 381 |
| 372 // static | 382 // static |
| 373 bool BrowserThread::IsThreadInitialized(ID identifier) { | 383 bool BrowserThread::IsThreadInitialized(ID identifier) { |
| 374 if (g_globals == NULL) | 384 if (g_globals == NULL) |
| 375 return false; | 385 return false; |
| 376 | 386 |
| 377 BrowserThreadGlobals& globals = g_globals.Get(); | 387 BrowserThreadGlobals& globals = g_globals.Get(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 AtomicWord* storage = reinterpret_cast<AtomicWord*>( | 540 AtomicWord* storage = reinterpret_cast<AtomicWord*>( |
| 531 &globals.thread_delegates[identifier]); | 541 &globals.thread_delegates[identifier]); |
| 532 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 542 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
| 533 storage, reinterpret_cast<AtomicWord>(delegate)); | 543 storage, reinterpret_cast<AtomicWord>(delegate)); |
| 534 | 544 |
| 535 // This catches registration when previously registered. | 545 // This catches registration when previously registered. |
| 536 DCHECK(!delegate || !old_pointer); | 546 DCHECK(!delegate || !old_pointer); |
| 537 } | 547 } |
| 538 | 548 |
| 539 } // namespace content | 549 } // namespace content |
| OLD | NEW |