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

Side by Side Diff: content/browser/browser_thread_impl.cc

Issue 9185026: Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove static class initializations. Created 8 years, 11 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 unified diff | Download patch
OLDNEW
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
127 bool guaranteed_to_outlive_target_thread = 127 bool guaranteed_to_outlive_target_thread =
128 GetCurrentThreadIdentifier(&current_thread) && 128 GetCurrentThreadIdentifier(&current_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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698