OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 | 268 |
269 void MessageLoop::RemoveDestructionObserver( | 269 void MessageLoop::RemoveDestructionObserver( |
270 DestructionObserver* destruction_observer) { | 270 DestructionObserver* destruction_observer) { |
271 DCHECK_EQ(this, current()); | 271 DCHECK_EQ(this, current()); |
272 destruction_observers_.RemoveObserver(destruction_observer); | 272 destruction_observers_.RemoveObserver(destruction_observer); |
273 } | 273 } |
274 | 274 |
275 void MessageLoop::PostTask( | 275 void MessageLoop::PostTask( |
276 const tracked_objects::Location& from_here, | 276 const tracked_objects::Location& from_here, |
277 const Closure& task) { | 277 const Closure& task) { |
278 DCHECK(!task.is_null()) << from_here.ToString(); | 278 DCHECK(!task.is_null()) << from_here.ToString(); |
Wez
2015/03/20 04:13:01
These DCHECKs should be in the TaskRunner impl now
Sami
2015/03/20 17:16:56
Good point, done. (I checked that the same DCHECKs
| |
279 incoming_task_queue_->AddToIncomingQueue(from_here, task, TimeDelta(), true); | 279 task_runner()->PostTask(from_here, task); |
danakj
2015/03/19 21:43:20
Note: This changes these into virtual function cal
Sami
2015/03/20 17:16:56
Good point. I checked this by hacking TaskPerfTest
| |
280 } | 280 } |
281 | 281 |
282 void MessageLoop::PostDelayedTask( | 282 void MessageLoop::PostDelayedTask( |
283 const tracked_objects::Location& from_here, | 283 const tracked_objects::Location& from_here, |
284 const Closure& task, | 284 const Closure& task, |
285 TimeDelta delay) { | 285 TimeDelta delay) { |
286 DCHECK(!task.is_null()) << from_here.ToString(); | 286 DCHECK(!task.is_null()) << from_here.ToString(); |
287 incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, true); | 287 task_runner()->PostDelayedTask(from_here, task, delay); |
288 } | 288 } |
289 | 289 |
290 void MessageLoop::PostNonNestableTask( | 290 void MessageLoop::PostNonNestableTask( |
291 const tracked_objects::Location& from_here, | 291 const tracked_objects::Location& from_here, |
292 const Closure& task) { | 292 const Closure& task) { |
293 DCHECK(!task.is_null()) << from_here.ToString(); | 293 DCHECK(!task.is_null()) << from_here.ToString(); |
294 incoming_task_queue_->AddToIncomingQueue(from_here, task, TimeDelta(), false); | 294 task_runner()->PostNonNestableTask(from_here, task); |
295 } | 295 } |
296 | 296 |
297 void MessageLoop::PostNonNestableDelayedTask( | 297 void MessageLoop::PostNonNestableDelayedTask( |
298 const tracked_objects::Location& from_here, | 298 const tracked_objects::Location& from_here, |
299 const Closure& task, | 299 const Closure& task, |
300 TimeDelta delay) { | 300 TimeDelta delay) { |
301 DCHECK(!task.is_null()) << from_here.ToString(); | 301 DCHECK(!task.is_null()) << from_here.ToString(); |
302 incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, false); | 302 task_runner()->PostNonNestableDelayedTask(from_here, task, delay); |
303 } | 303 } |
304 | 304 |
305 void MessageLoop::Run() { | 305 void MessageLoop::Run() { |
306 RunLoop run_loop; | 306 RunLoop run_loop; |
307 run_loop.Run(); | 307 run_loop.Run(); |
308 } | 308 } |
309 | 309 |
310 void MessageLoop::RunUntilIdle() { | 310 void MessageLoop::RunUntilIdle() { |
311 RunLoop run_loop; | 311 RunLoop run_loop; |
312 run_loop.RunUntilIdle(); | 312 run_loop.RunUntilIdle(); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 persistent, | 715 persistent, |
716 mode, | 716 mode, |
717 controller, | 717 controller, |
718 delegate); | 718 delegate); |
719 } | 719 } |
720 #endif | 720 #endif |
721 | 721 |
722 #endif // !defined(OS_NACL_SFI) | 722 #endif // !defined(OS_NACL_SFI) |
723 | 723 |
724 } // namespace base | 724 } // namespace base |
OLD | NEW |