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

Side by Side Diff: base/message_loop.h

Issue 1664: Put back r1891 with some task deletion disabled to maintain backwards compat... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef BASE_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // the context of a task. 309 // the context of a task.
310 bool QueueOrRunTask(Task* new_task); 310 bool QueueOrRunTask(Task* new_task);
311 311
312 // Runs the specified task and deletes it. 312 // Runs the specified task and deletes it.
313 void RunTask(Task* task); 313 void RunTask(Task* task);
314 314
315 // Calls RunTask or queues the pending_task on the deferred task list if it 315 // Calls RunTask or queues the pending_task on the deferred task list if it
316 // cannot be run right now. Returns true if the task was run. 316 // cannot be run right now. Returns true if the task was run.
317 bool DeferOrRunPendingTask(const PendingTask& pending_task); 317 bool DeferOrRunPendingTask(const PendingTask& pending_task);
318 318
319 // Adds the pending task to delayed_work_queue_.
320 void AddToDelayedWorkQueue(const PendingTask& pending_task);
321
319 // Load tasks from the incoming_queue_ into work_queue_ if the latter is 322 // Load tasks from the incoming_queue_ into work_queue_ if the latter is
320 // empty. The former requires a lock to access, while the latter is directly 323 // empty. The former requires a lock to access, while the latter is directly
321 // accessible on this thread. 324 // accessible on this thread.
322 void ReloadWorkQueue(); 325 void ReloadWorkQueue();
323 326
324 // Delete tasks that haven't run yet without running them. Used in the 327 // Delete tasks that haven't run yet without running them. Used in the
325 // destructor to make sure all the task's destructors get called. 328 // destructor to make sure all the task's destructors get called. Returns
326 void DeletePendingTasks(); 329 // true if some work was done.
330 bool DeletePendingTasks();
327 331
328 // Post a task to our incomming queue. 332 // Post a task to our incomming queue.
329 void PostTask_Helper(const tracked_objects::Location& from_here, Task* task, 333 void PostTask_Helper(const tracked_objects::Location& from_here, Task* task,
330 int delay_ms, bool nestable); 334 int delay_ms, bool nestable);
331 335
332 // base::MessagePump::Delegate methods: 336 // base::MessagePump::Delegate methods:
333 virtual bool DoWork(); 337 virtual bool DoWork();
334 virtual bool DoDelayedWork(Time* next_delayed_work_time); 338 virtual bool DoDelayedWork(Time* next_delayed_work_time);
335 virtual bool DoIdleWork(); 339 virtual bool DoIdleWork();
336 340
(...skipping 20 matching lines...) Expand all
357 DelayedTaskQueue delayed_work_queue_; 361 DelayedTaskQueue delayed_work_queue_;
358 362
359 // A queue of non-nestable tasks that we had to defer because when it came 363 // A queue of non-nestable tasks that we had to defer because when it came
360 // time to execute them we were in a nested message loop. They will execute 364 // time to execute them we were in a nested message loop. They will execute
361 // once we're out of nested message loops. 365 // once we're out of nested message loops.
362 TaskQueue deferred_non_nestable_work_queue_; 366 TaskQueue deferred_non_nestable_work_queue_;
363 367
364 scoped_refptr<base::MessagePump> pump_; 368 scoped_refptr<base::MessagePump> pump_;
365 369
366 ObserverList<DestructionObserver> destruction_observers_; 370 ObserverList<DestructionObserver> destruction_observers_;
371
367 // A recursion block that prevents accidentally running additonal tasks when 372 // A recursion block that prevents accidentally running additonal tasks when
368 // insider a (accidentally induced?) nested message pump. 373 // insider a (accidentally induced?) nested message pump.
369 bool nestable_tasks_allowed_; 374 bool nestable_tasks_allowed_;
370 375
371 bool exception_restoration_; 376 bool exception_restoration_;
372 377
373 std::string thread_name_; 378 std::string thread_name_;
374 // A profiling histogram showing the counts of various messages and events. 379 // A profiling histogram showing the counts of various messages and events.
375 scoped_ptr<LinearHistogram> message_histogram_; 380 scoped_ptr<LinearHistogram> message_histogram_;
376 381
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 #endif // defined(OS_WIN) 461 #endif // defined(OS_WIN)
457 }; 462 };
458 463
459 // Do not add any member variables to MessageLoopForIO! This is important b/c 464 // Do not add any member variables to MessageLoopForIO! This is important b/c
460 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 465 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
461 // data that you need should be stored on the MessageLoop's pump_ instance. 466 // data that you need should be stored on the MessageLoop's pump_ instance.
462 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 467 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
463 MessageLoopForIO_should_not_have_extra_member_variables); 468 MessageLoopForIO_should_not_have_extra_member_variables);
464 469
465 #endif // BASE_MESSAGE_LOOP_H_ 470 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698