| 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 "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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 bool guaranteed_to_outlive_target_thread = | 127 bool guaranteed_to_outlive_target_thread = |
| 128 GetCurrentThreadIdentifier(¤t_thread) && | 128 GetCurrentThreadIdentifier(¤t_thread) && |
| 129 current_thread <= identifier; | 129 current_thread <= identifier; |
| 130 | 130 |
| 131 if (!guaranteed_to_outlive_target_thread) | 131 if (!guaranteed_to_outlive_target_thread) |
| 132 g_lock.Get().Acquire(); | 132 g_lock.Get().Acquire(); |
| 133 | 133 |
| 134 MessageLoop* message_loop = g_browser_threads[identifier] ? | 134 MessageLoop* message_loop = g_browser_threads[identifier] ? |
| 135 g_browser_threads[identifier]->message_loop() : NULL; | 135 g_browser_threads[identifier]->message_loop() : NULL; |
| 136 if (message_loop) { | 136 if (message_loop) { |
| 137 base::TimeDelta delay = base::TimeDelta::FromMilliseconds(delay_ms); |
| 137 if (nestable) { | 138 if (nestable) { |
| 138 message_loop->PostDelayedTask(from_here, task, delay_ms); | 139 message_loop->PostDelayedTask(from_here, task, delay); |
| 139 } else { | 140 } else { |
| 140 message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); | 141 message_loop->PostNonNestableDelayedTask(from_here, task, delay); |
| 141 } | 142 } |
| 142 } | 143 } |
| 143 | 144 |
| 144 if (!guaranteed_to_outlive_target_thread) | 145 if (!guaranteed_to_outlive_target_thread) |
| 145 g_lock.Get().Release(); | 146 g_lock.Get().Release(); |
| 146 | 147 |
| 147 return !!message_loop; | 148 return !!message_loop; |
| 148 } | 149 } |
| 149 | 150 |
| 150 // An implementation of MessageLoopProxy to be used in conjunction | 151 // An implementation of MessageLoopProxy to be used in conjunction |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 AtomicWord* storage = reinterpret_cast<AtomicWord*>( | 309 AtomicWord* storage = reinterpret_cast<AtomicWord*>( |
| 309 &g_browser_thread_delegates[identifier]); | 310 &g_browser_thread_delegates[identifier]); |
| 310 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 311 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
| 311 storage, reinterpret_cast<AtomicWord>(delegate)); | 312 storage, reinterpret_cast<AtomicWord>(delegate)); |
| 312 | 313 |
| 313 // This catches registration when previously registered. | 314 // This catches registration when previously registered. |
| 314 DCHECK(!delegate || !old_pointer); | 315 DCHECK(!delegate || !old_pointer); |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace content | 318 } // namespace content |
| OLD | NEW |