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

Side by Side Diff: base/message_loop.h

Issue 172101: Move MessageLoop TaskQueues to pointers.
Patch Set: scoped_ptr swap. Created 11 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
« 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 <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // If message_histogram_ is NULL, this is a no-op. 358 // If message_histogram_ is NULL, this is a no-op.
359 void HistogramEvent(int event); 359 void HistogramEvent(int event);
360 360
361 static const LinearHistogram::DescriptionPair event_descriptions_[]; 361 static const LinearHistogram::DescriptionPair event_descriptions_[];
362 static bool enable_histogrammer_; 362 static bool enable_histogrammer_;
363 363
364 Type type_; 364 Type type_;
365 365
366 // A list of tasks that need to be processed by this instance. Note that 366 // A list of tasks that need to be processed by this instance. Note that
367 // this queue is only accessed (push/pop) by our current thread. 367 // this queue is only accessed (push/pop) by our current thread.
368 TaskQueue work_queue_; 368 scoped_ptr<TaskQueue> work_queue_;
369 369
370 // Contains delayed tasks, sorted by their 'delayed_run_time' property. 370 // Contains delayed tasks, sorted by their 'delayed_run_time' property.
371 DelayedTaskQueue delayed_work_queue_; 371 DelayedTaskQueue delayed_work_queue_;
372 372
373 // A queue of non-nestable tasks that we had to defer because when it came 373 // A queue of non-nestable tasks that we had to defer because when it came
374 // time to execute them we were in a nested message loop. They will execute 374 // time to execute them we were in a nested message loop. They will execute
375 // once we're out of nested message loops. 375 // once we're out of nested message loops.
376 TaskQueue deferred_non_nestable_work_queue_; 376 TaskQueue deferred_non_nestable_work_queue_;
377 377
378 scoped_refptr<base::MessagePump> pump_; 378 scoped_refptr<base::MessagePump> pump_;
379 379
380 ObserverList<DestructionObserver> destruction_observers_; 380 ObserverList<DestructionObserver> destruction_observers_;
381 381
382 // A recursion block that prevents accidentally running additonal tasks when 382 // A recursion block that prevents accidentally running additonal tasks when
383 // insider a (accidentally induced?) nested message pump. 383 // insider a (accidentally induced?) nested message pump.
384 bool nestable_tasks_allowed_; 384 bool nestable_tasks_allowed_;
385 385
386 bool exception_restoration_; 386 bool exception_restoration_;
387 387
388 std::string thread_name_; 388 std::string thread_name_;
389 // A profiling histogram showing the counts of various messages and events. 389 // A profiling histogram showing the counts of various messages and events.
390 scoped_ptr<LinearHistogram> message_histogram_; 390 scoped_ptr<LinearHistogram> message_histogram_;
391 391
392 // A null terminated list which creates an incoming_queue of tasks that are 392 // A null terminated list which creates an incoming_queue of tasks that are
393 // aquired under a mutex for processing on this instance's thread. These tasks 393 // aquired under a mutex for processing on this instance's thread. These tasks
394 // have not yet been sorted out into items for our work_queue_ vs items that 394 // have not yet been sorted out into items for our work_queue_ vs items that
395 // will be handled by the TimerManager. 395 // will be handled by the TimerManager.
396 TaskQueue incoming_queue_; 396 scoped_ptr<TaskQueue> incoming_queue_;
397 // Protect access to incoming_queue_. 397 // Protect access to incoming_queue_.
398 Lock incoming_queue_lock_; 398 Lock incoming_queue_lock_;
399 399
400 RunState* state_; 400 RunState* state_;
401 401
402 // The next sequence number to use for delayed tasks. 402 // The next sequence number to use for delayed tasks.
403 int next_sequence_num_; 403 int next_sequence_num_;
404 404
405 DISALLOW_COPY_AND_ASSIGN(MessageLoop); 405 DISALLOW_COPY_AND_ASSIGN(MessageLoop);
406 }; 406 };
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 #endif // defined(OS_POSIX) 504 #endif // defined(OS_POSIX)
505 }; 505 };
506 506
507 // Do not add any member variables to MessageLoopForIO! This is important b/c 507 // Do not add any member variables to MessageLoopForIO! This is important b/c
508 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 508 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
509 // data that you need should be stored on the MessageLoop's pump_ instance. 509 // data that you need should be stored on the MessageLoop's pump_ instance.
510 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 510 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
511 MessageLoopForIO_should_not_have_extra_member_variables); 511 MessageLoopForIO_should_not_have_extra_member_variables);
512 512
513 #endif // BASE_MESSAGE_LOOP_H_ 513 #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