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

Side by Side Diff: base/message_loop.h

Issue 2982009: Revert everything related to the relanding. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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 | « app/slide_animation_unittest.cc ('k') | 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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/lock.h" 12 #include "base/histogram.h"
13 #include "base/message_pump.h" 13 #include "base/message_pump.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/ref_counted.h" 15 #include "base/ref_counted.h"
16 #include "base/scoped_ptr.h"
16 #include "base/task.h" 17 #include "base/task.h"
17 18
18 #if defined(OS_WIN) 19 #if defined(OS_WIN)
19 // We need this to declare base::MessagePumpWin::Dispatcher, which we should 20 // We need this to declare base::MessagePumpWin::Dispatcher, which we should
20 // really just eliminate. 21 // really just eliminate.
21 #include "base/message_pump_win.h" 22 #include "base/message_pump_win.h"
22 #elif defined(OS_POSIX) 23 #elif defined(OS_POSIX)
23 #include "base/message_pump_libevent.h" 24 #include "base/message_pump_libevent.h"
24 #if !defined(OS_MACOSX) 25 #if !defined(OS_MACOSX)
25 #include "base/message_pump_glib.h" 26 #include "base/message_pump_glib.h"
26 #endif 27 #endif
27 #endif 28 #endif
28 29
29 class Histogram;
30
31 // A MessageLoop is used to process events for a particular thread. There is 30 // A MessageLoop is used to process events for a particular thread. There is
32 // at most one MessageLoop instance per thread. 31 // at most one MessageLoop instance per thread.
33 // 32 //
34 // Events include at a minimum Task instances submitted to PostTask or those 33 // Events include at a minimum Task instances submitted to PostTask or those
35 // managed by TimerManager. Depending on the type of message pump used by the 34 // managed by TimerManager. Depending on the type of message pump used by the
36 // MessageLoop other events such as UI messages may be processed. On Windows 35 // MessageLoop other events such as UI messages may be processed. On Windows
37 // APC calls (as time permits) and signals sent to a registered set of HANDLEs 36 // APC calls (as time permits) and signals sent to a registered set of HANDLEs
38 // may also be processed. 37 // may also be processed.
39 // 38 //
40 // NOTE: Unless otherwise specified, a MessageLoop's methods may only be called 39 // NOTE: Unless otherwise specified, a MessageLoop's methods may only be called
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 420
422 // Start recording histogram info about events and action IF it was enabled 421 // Start recording histogram info about events and action IF it was enabled
423 // and IF the statistics recorder can accept a registration of our histogram. 422 // and IF the statistics recorder can accept a registration of our histogram.
424 void StartHistogrammer(); 423 void StartHistogrammer();
425 424
426 // Add occurence of event to our histogram, so that we can see what is being 425 // Add occurence of event to our histogram, so that we can see what is being
427 // done in a specific MessageLoop instance (i.e., specific thread). 426 // done in a specific MessageLoop instance (i.e., specific thread).
428 // If message_histogram_ is NULL, this is a no-op. 427 // If message_histogram_ is NULL, this is a no-op.
429 void HistogramEvent(int event); 428 void HistogramEvent(int event);
430 429
430 static const LinearHistogram::DescriptionPair event_descriptions_[];
431 static bool enable_histogrammer_;
432
431 Type type_; 433 Type type_;
432 434
433 // A list of tasks that need to be processed by this instance. Note that 435 // A list of tasks that need to be processed by this instance. Note that
434 // this queue is only accessed (push/pop) by our current thread. 436 // this queue is only accessed (push/pop) by our current thread.
435 TaskQueue work_queue_; 437 TaskQueue work_queue_;
436 438
437 // Contains delayed tasks, sorted by their 'delayed_run_time' property. 439 // Contains delayed tasks, sorted by their 'delayed_run_time' property.
438 DelayedTaskQueue delayed_work_queue_; 440 DelayedTaskQueue delayed_work_queue_;
439 441
440 // A queue of non-nestable tasks that we had to defer because when it came 442 // A queue of non-nestable tasks that we had to defer because when it came
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 #endif // defined(OS_POSIX) 595 #endif // defined(OS_POSIX)
594 }; 596 };
595 597
596 // Do not add any member variables to MessageLoopForIO! This is important b/c 598 // Do not add any member variables to MessageLoopForIO! This is important b/c
597 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 599 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
598 // data that you need should be stored on the MessageLoop's pump_ instance. 600 // data that you need should be stored on the MessageLoop's pump_ instance.
599 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 601 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
600 MessageLoopForIO_should_not_have_extra_member_variables); 602 MessageLoopForIO_should_not_have_extra_member_variables);
601 603
602 #endif // BASE_MESSAGE_LOOP_H_ 604 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « app/slide_animation_unittest.cc ('k') | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698