michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef BASE_MESSAGE_LOOP_H_ michael@0: #define BASE_MESSAGE_LOOP_H_ michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #include michael@0: #include "base/lock.h" michael@0: #include "base/message_pump.h" michael@0: #include "base/observer_list.h" michael@0: #include "base/ref_counted.h" michael@0: #include "base/scoped_ptr.h" michael@0: #include "base/task.h" michael@0: #include "base/timer.h" michael@0: michael@0: #if defined(OS_WIN) michael@0: // We need this to declare base::MessagePumpWin::Dispatcher, which we should michael@0: // really just eliminate. michael@0: #include "base/message_pump_win.h" michael@0: #elif defined(OS_POSIX) michael@0: #include "base/message_pump_libevent.h" michael@0: #endif michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: class DoWorkRunnable; michael@0: michael@0: } /* namespace ipc */ michael@0: } /* namespace mozilla */ michael@0: michael@0: // A MessageLoop is used to process events for a particular thread. There is michael@0: // at most one MessageLoop instance per thread. michael@0: // michael@0: // Events include at a minimum Task instances submitted to PostTask or those michael@0: // managed by TimerManager. Depending on the type of message pump used by the michael@0: // MessageLoop other events such as UI messages may be processed. On Windows michael@0: // APC calls (as time permits) and signals sent to a registered set of HANDLEs michael@0: // may also be processed. michael@0: // michael@0: // NOTE: Unless otherwise specified, a MessageLoop's methods may only be called michael@0: // on the thread where the MessageLoop's Run method executes. michael@0: // michael@0: // NOTE: MessageLoop has task reentrancy protection. This means that if a michael@0: // task is being processed, a second task cannot start until the first task is michael@0: // finished. Reentrancy can happen when processing a task, and an inner michael@0: // message pump is created. That inner pump then processes native messages michael@0: // which could implicitly start an inner task. Inner message pumps are created michael@0: // with dialogs (DialogBox), common dialogs (GetOpenFileName), OLE functions michael@0: // (DoDragDrop), printer functions (StartDoc) and *many* others. michael@0: // michael@0: // Sample workaround when inner task processing is needed: michael@0: // bool old_state = MessageLoop::current()->NestableTasksAllowed(); michael@0: // MessageLoop::current()->SetNestableTasksAllowed(true); michael@0: // HRESULT hr = DoDragDrop(...); // Implicitly runs a modal message loop here. michael@0: // MessageLoop::current()->SetNestableTasksAllowed(old_state); michael@0: // // Process hr (the result returned by DoDragDrop(). michael@0: // michael@0: // Please be SURE your task is reentrant (nestable) and all global variables michael@0: // are stable and accessible before calling SetNestableTasksAllowed(true). michael@0: // michael@0: class MessageLoop : public base::MessagePump::Delegate { michael@0: michael@0: friend class mozilla::ipc::DoWorkRunnable; michael@0: michael@0: public: michael@0: // A DestructionObserver is notified when the current MessageLoop is being michael@0: // destroyed. These obsevers are notified prior to MessageLoop::current() michael@0: // being changed to return NULL. This gives interested parties the chance to michael@0: // do final cleanup that depends on the MessageLoop. michael@0: // michael@0: // NOTE: Any tasks posted to the MessageLoop during this notification will michael@0: // not be run. Instead, they will be deleted. michael@0: // michael@0: class DestructionObserver { michael@0: public: michael@0: virtual ~DestructionObserver() {} michael@0: virtual void WillDestroyCurrentMessageLoop() = 0; michael@0: }; michael@0: michael@0: // Add a DestructionObserver, which will start receiving notifications michael@0: // immediately. michael@0: void AddDestructionObserver(DestructionObserver* destruction_observer); michael@0: michael@0: // Remove a DestructionObserver. It is safe to call this method while a michael@0: // DestructionObserver is receiving a notification callback. michael@0: void RemoveDestructionObserver(DestructionObserver* destruction_observer); michael@0: michael@0: // The "PostTask" family of methods call the task's Run method asynchronously michael@0: // from within a message loop at some point in the future. michael@0: // michael@0: // With the PostTask variant, tasks are invoked in FIFO order, inter-mixed michael@0: // with normal UI or IO event processing. With the PostDelayedTask variant, michael@0: // tasks are called after at least approximately 'delay_ms' have elapsed. michael@0: // michael@0: // The NonNestable variants work similarly except that they promise never to michael@0: // dispatch the task from a nested invocation of MessageLoop::Run. Instead, michael@0: // such tasks get deferred until the top-most MessageLoop::Run is executing. michael@0: // michael@0: // The MessageLoop takes ownership of the Task, and deletes it after it has michael@0: // been Run(). michael@0: // michael@0: // NOTE: These methods may be called on any thread. The Task will be invoked michael@0: // on the thread that executes MessageLoop::Run(). michael@0: michael@0: void PostTask( michael@0: const tracked_objects::Location& from_here, Task* task); michael@0: michael@0: void PostDelayedTask( michael@0: const tracked_objects::Location& from_here, Task* task, int delay_ms); michael@0: michael@0: void PostNonNestableTask( michael@0: const tracked_objects::Location& from_here, Task* task); michael@0: michael@0: void PostNonNestableDelayedTask( michael@0: const tracked_objects::Location& from_here, Task* task, int delay_ms); michael@0: michael@0: // PostIdleTask is not thread safe and should be called on this thread michael@0: void PostIdleTask( michael@0: const tracked_objects::Location& from_here, Task* task); michael@0: michael@0: // A variant on PostTask that deletes the given object. This is useful michael@0: // if the object needs to live until the next run of the MessageLoop (for michael@0: // example, deleting a RenderProcessHost from within an IPC callback is not michael@0: // good). michael@0: // michael@0: // NOTE: This method may be called on any thread. The object will be deleted michael@0: // on the thread that executes MessageLoop::Run(). If this is not the same michael@0: // as the thread that calls PostDelayedTask(FROM_HERE, ), then T MUST inherit michael@0: // from RefCountedThreadSafe! michael@0: template michael@0: void DeleteSoon(const tracked_objects::Location& from_here, T* object) { michael@0: PostNonNestableTask(from_here, new DeleteTask(object)); michael@0: } michael@0: michael@0: // A variant on PostTask that releases the given reference counted object michael@0: // (by calling its Release method). This is useful if the object needs to michael@0: // live until the next run of the MessageLoop, or if the object needs to be michael@0: // released on a particular thread. michael@0: // michael@0: // NOTE: This method may be called on any thread. The object will be michael@0: // released (and thus possibly deleted) on the thread that executes michael@0: // MessageLoop::Run(). If this is not the same as the thread that calls michael@0: // PostDelayedTask(FROM_HERE, ), then T MUST inherit from michael@0: // RefCountedThreadSafe! michael@0: template michael@0: void ReleaseSoon(const tracked_objects::Location& from_here, T* object) { michael@0: PostNonNestableTask(from_here, new ReleaseTask(object)); michael@0: } michael@0: michael@0: // Run the message loop. michael@0: void Run(); michael@0: michael@0: // Process all pending tasks, windows messages, etc., but don't wait/sleep. michael@0: // Return as soon as all items that can be run are taken care of. michael@0: void RunAllPending(); michael@0: michael@0: // Signals the Run method to return after it is done processing all pending michael@0: // messages. This method may only be called on the same thread that called michael@0: // Run, and Run must still be on the call stack. michael@0: // michael@0: // Use QuitTask if you need to Quit another thread's MessageLoop, but note michael@0: // that doing so is fairly dangerous if the target thread makes nested calls michael@0: // to MessageLoop::Run. The problem being that you won't know which nested michael@0: // run loop you are quiting, so be careful! michael@0: // michael@0: void Quit(); michael@0: michael@0: // Invokes Quit on the current MessageLoop when run. Useful to schedule an michael@0: // arbitrary MessageLoop to Quit. michael@0: class QuitTask : public Task { michael@0: public: michael@0: virtual void Run() { michael@0: MessageLoop::current()->Quit(); michael@0: } michael@0: }; michael@0: michael@0: // A MessageLoop has a particular type, which indicates the set of michael@0: // asynchronous events it may process in addition to tasks and timers. michael@0: // michael@0: // TYPE_DEFAULT michael@0: // This type of ML only supports tasks and timers. michael@0: // michael@0: // TYPE_UI michael@0: // This type of ML also supports native UI events (e.g., Windows messages). michael@0: // See also MessageLoopForUI. michael@0: // michael@0: // TYPE_IO michael@0: // This type of ML also supports asynchronous IO. See also michael@0: // MessageLoopForIO. michael@0: // michael@0: // TYPE_MOZILLA_CHILD michael@0: // This type of ML is used in Mozilla child processes which initialize michael@0: // XPCOM and use the gecko event loop. michael@0: // michael@0: // TYPE_MOZILLA_UI michael@0: // This type of ML is used in Mozilla parent processes which initialize michael@0: // XPCOM and use the gecko event loop. michael@0: // michael@0: // TYPE_MOZILLA_NONMAINTHREAD michael@0: // This type of ML is used in Mozilla parent processes which initialize michael@0: // XPCOM and use the nsThread event loop. michael@0: // michael@0: enum Type { michael@0: TYPE_DEFAULT, michael@0: TYPE_UI, michael@0: TYPE_IO, michael@0: TYPE_MOZILLA_CHILD, michael@0: TYPE_MOZILLA_UI, michael@0: TYPE_MOZILLA_NONMAINTHREAD michael@0: }; michael@0: michael@0: // Normally, it is not necessary to instantiate a MessageLoop. Instead, it michael@0: // is typical to make use of the current thread's MessageLoop instance. michael@0: explicit MessageLoop(Type type = TYPE_DEFAULT); michael@0: ~MessageLoop(); michael@0: michael@0: // Returns the type passed to the constructor. michael@0: Type type() const { return type_; } michael@0: michael@0: // Unique, non-repeating ID for this message loop. michael@0: int32_t id() const { return id_; } michael@0: michael@0: // Optional call to connect the thread name with this loop. michael@0: void set_thread_name(const std::string& thread_name) { michael@0: DCHECK(thread_name_.empty()) << "Should not rename this thread!"; michael@0: thread_name_ = thread_name; michael@0: } michael@0: const std::string& thread_name() const { return thread_name_; } michael@0: michael@0: // Returns the MessageLoop object for the current thread, or null if none. michael@0: static MessageLoop* current(); michael@0: michael@0: // Enables or disables the recursive task processing. This happens in the case michael@0: // of recursive message loops. Some unwanted message loop may occurs when michael@0: // using common controls or printer functions. By default, recursive task michael@0: // processing is disabled. michael@0: // michael@0: // The specific case where tasks get queued is: michael@0: // - The thread is running a message loop. michael@0: // - It receives a task #1 and execute it. michael@0: // - The task #1 implicitly start a message loop, like a MessageBox in the michael@0: // unit test. This can also be StartDoc or GetSaveFileName. michael@0: // - The thread receives a task #2 before or while in this second message michael@0: // loop. michael@0: // - With NestableTasksAllowed set to true, the task #2 will run right away. michael@0: // Otherwise, it will get executed right after task #1 completes at "thread michael@0: // message loop level". michael@0: void SetNestableTasksAllowed(bool allowed); michael@0: void ScheduleWork(); michael@0: bool NestableTasksAllowed() const; michael@0: michael@0: // Enables or disables the restoration during an exception of the unhandled michael@0: // exception filter that was active when Run() was called. This can happen michael@0: // if some third party code call SetUnhandledExceptionFilter() and never michael@0: // restores the previous filter. michael@0: void set_exception_restoration(bool restore) { michael@0: exception_restoration_ = restore; michael@0: } michael@0: michael@0: #if defined(OS_WIN) michael@0: void set_os_modal_loop(bool os_modal_loop) { michael@0: os_modal_loop_ = os_modal_loop; michael@0: } michael@0: michael@0: bool & os_modal_loop() { michael@0: return os_modal_loop_; michael@0: } michael@0: #endif // OS_WIN michael@0: michael@0: // Set the timeouts for background hang monitoring. michael@0: // A value of 0 indicates there is no timeout. michael@0: void set_hang_timeouts(uint32_t transient_timeout_ms, michael@0: uint32_t permanent_timeout_ms) { michael@0: transient_hang_timeout_ = transient_timeout_ms; michael@0: permanent_hang_timeout_ = permanent_timeout_ms; michael@0: } michael@0: uint32_t transient_hang_timeout() const { michael@0: return transient_hang_timeout_; michael@0: } michael@0: uint32_t permanent_hang_timeout() const { michael@0: return permanent_hang_timeout_; michael@0: } michael@0: michael@0: //---------------------------------------------------------------------------- michael@0: protected: michael@0: struct RunState { michael@0: // Used to count how many Run() invocations are on the stack. michael@0: int run_depth; michael@0: michael@0: // Used to record that Quit() was called, or that we should quit the pump michael@0: // once it becomes idle. michael@0: bool quit_received; michael@0: michael@0: #if defined(OS_WIN) michael@0: base::MessagePumpWin::Dispatcher* dispatcher; michael@0: #endif michael@0: }; michael@0: michael@0: class AutoRunState : RunState { michael@0: public: michael@0: explicit AutoRunState(MessageLoop* loop); michael@0: ~AutoRunState(); michael@0: private: michael@0: MessageLoop* loop_; michael@0: RunState* previous_state_; michael@0: }; michael@0: michael@0: // This structure is copied around by value. michael@0: struct PendingTask { michael@0: Task* task; // The task to run. michael@0: base::TimeTicks delayed_run_time; // The time when the task should be run. michael@0: int sequence_num; // Secondary sort key for run time. michael@0: bool nestable; // OK to dispatch from a nested loop. michael@0: michael@0: PendingTask(Task* task, bool nestable) michael@0: : task(task), sequence_num(0), nestable(nestable) { michael@0: } michael@0: michael@0: // Used to support sorting. michael@0: bool operator<(const PendingTask& other) const; michael@0: }; michael@0: michael@0: typedef std::queue TaskQueue; michael@0: typedef std::priority_queue DelayedTaskQueue; michael@0: michael@0: #if defined(OS_WIN) michael@0: base::MessagePumpWin* pump_win() { michael@0: return static_cast(pump_.get()); michael@0: } michael@0: #elif defined(OS_POSIX) michael@0: base::MessagePumpLibevent* pump_libevent() { michael@0: return static_cast(pump_.get()); michael@0: } michael@0: #endif michael@0: michael@0: // A function to encapsulate all the exception handling capability in the michael@0: // stacks around the running of a main message loop. It will run the message michael@0: // loop in a SEH try block or not depending on the set_SEH_restoration() michael@0: // flag. michael@0: void RunHandler(); michael@0: michael@0: // A surrounding stack frame around the running of the message loop that michael@0: // supports all saving and restoring of state, as is needed for any/all (ugly) michael@0: // recursive calls. michael@0: void RunInternal(); michael@0: michael@0: // Called to process any delayed non-nestable tasks. michael@0: bool ProcessNextDelayedNonNestableTask(); michael@0: michael@0: //---------------------------------------------------------------------------- michael@0: // Run a work_queue_ task or new_task, and delete it (if it was processed by michael@0: // PostTask). If there are queued tasks, the oldest one is executed and michael@0: // new_task is queued. new_task is optional and can be NULL. In this NULL michael@0: // case, the method will run one pending task (if any exist). Returns true if michael@0: // it executes a task. Queued tasks accumulate only when there is a michael@0: // non-nestable task currently processing, in which case the new_task is michael@0: // appended to the list work_queue_. Such re-entrancy generally happens when michael@0: // an unrequested message pump (typical of a native dialog) is executing in michael@0: // the context of a task. michael@0: bool QueueOrRunTask(Task* new_task); michael@0: michael@0: // Runs the specified task and deletes it. michael@0: void RunTask(Task* task); michael@0: michael@0: // Calls RunTask or queues the pending_task on the deferred task list if it michael@0: // cannot be run right now. Returns true if the task was run. michael@0: bool DeferOrRunPendingTask(const PendingTask& pending_task); michael@0: michael@0: // Adds the pending task to delayed_work_queue_. michael@0: void AddToDelayedWorkQueue(const PendingTask& pending_task); michael@0: michael@0: // Load tasks from the incoming_queue_ into work_queue_ if the latter is michael@0: // empty. The former requires a lock to access, while the latter is directly michael@0: // accessible on this thread. michael@0: void ReloadWorkQueue(); michael@0: michael@0: // Delete tasks that haven't run yet without running them. Used in the michael@0: // destructor to make sure all the task's destructors get called. Returns michael@0: // true if some work was done. michael@0: bool DeletePendingTasks(); michael@0: michael@0: // Post a task to our incomming queue. michael@0: void PostTask_Helper(const tracked_objects::Location& from_here, Task* task, michael@0: int delay_ms, bool nestable); michael@0: michael@0: // base::MessagePump::Delegate methods: michael@0: virtual bool DoWork(); michael@0: virtual bool DoDelayedWork(base::TimeTicks* next_delayed_work_time); michael@0: virtual bool DoIdleWork(); michael@0: michael@0: Type type_; michael@0: int32_t id_; michael@0: michael@0: // A list of tasks that need to be processed by this instance. Note that michael@0: // this queue is only accessed (push/pop) by our current thread. michael@0: TaskQueue work_queue_; michael@0: michael@0: // Contains delayed tasks, sorted by their 'delayed_run_time' property. michael@0: DelayedTaskQueue delayed_work_queue_; michael@0: michael@0: // A queue of non-nestable tasks that we had to defer because when it came michael@0: // time to execute them we were in a nested message loop. They will execute michael@0: // once we're out of nested message loops. michael@0: TaskQueue deferred_non_nestable_work_queue_; michael@0: michael@0: scoped_refptr pump_; michael@0: michael@0: base::ObserverList destruction_observers_; michael@0: michael@0: // A recursion block that prevents accidentally running additonal tasks when michael@0: // insider a (accidentally induced?) nested message pump. michael@0: bool nestable_tasks_allowed_; michael@0: michael@0: bool exception_restoration_; michael@0: michael@0: std::string thread_name_; michael@0: michael@0: // A null terminated list which creates an incoming_queue of tasks that are michael@0: // aquired under a mutex for processing on this instance's thread. These tasks michael@0: // have not yet been sorted out into items for our work_queue_ vs items that michael@0: // will be handled by the TimerManager. michael@0: TaskQueue incoming_queue_; michael@0: // Protect access to incoming_queue_. michael@0: Lock incoming_queue_lock_; michael@0: michael@0: RunState* state_; michael@0: int run_depth_base_; michael@0: michael@0: #if defined(OS_WIN) michael@0: // Should be set to true before calling Windows APIs like TrackPopupMenu, etc michael@0: // which enter a modal message loop. michael@0: bool os_modal_loop_; michael@0: #endif michael@0: michael@0: // Timeout values for hang monitoring michael@0: uint32_t transient_hang_timeout_; michael@0: uint32_t permanent_hang_timeout_; michael@0: michael@0: // The next sequence number to use for delayed tasks. michael@0: int next_sequence_num_; michael@0: michael@0: DISALLOW_COPY_AND_ASSIGN(MessageLoop); michael@0: }; michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // MessageLoopForUI extends MessageLoop with methods that are particular to a michael@0: // MessageLoop instantiated with TYPE_UI. michael@0: // michael@0: // This class is typically used like so: michael@0: // MessageLoopForUI::current()->...call some method... michael@0: // michael@0: class MessageLoopForUI : public MessageLoop { michael@0: public: michael@0: MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) { michael@0: } michael@0: michael@0: // Returns the MessageLoopForUI of the current thread. michael@0: static MessageLoopForUI* current() { michael@0: MessageLoop* loop = MessageLoop::current(); michael@0: if (!loop) michael@0: return NULL; michael@0: Type type = loop->type(); michael@0: DCHECK(type == MessageLoop::TYPE_UI || michael@0: type == MessageLoop::TYPE_MOZILLA_UI || michael@0: type == MessageLoop::TYPE_MOZILLA_CHILD); michael@0: return static_cast(loop); michael@0: } michael@0: michael@0: #if defined(OS_WIN) michael@0: typedef base::MessagePumpWin::Dispatcher Dispatcher; michael@0: typedef base::MessagePumpWin::Observer Observer; michael@0: michael@0: // Please see MessagePumpWin for definitions of these methods. michael@0: void Run(Dispatcher* dispatcher); michael@0: void AddObserver(Observer* observer); michael@0: void RemoveObserver(Observer* observer); michael@0: void WillProcessMessage(const MSG& message); michael@0: void DidProcessMessage(const MSG& message); michael@0: void PumpOutPendingPaintMessages(); michael@0: michael@0: protected: michael@0: // TODO(rvargas): Make this platform independent. michael@0: base::MessagePumpForUI* pump_ui() { michael@0: return static_cast(pump_.get()); michael@0: } michael@0: #endif // defined(OS_WIN) michael@0: }; michael@0: michael@0: // Do not add any member variables to MessageLoopForUI! This is important b/c michael@0: // MessageLoopForUI is often allocated via MessageLoop(TYPE_UI). Any extra michael@0: // data that you need should be stored on the MessageLoop's pump_ instance. michael@0: COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForUI), michael@0: MessageLoopForUI_should_not_have_extra_member_variables); michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // MessageLoopForIO extends MessageLoop with methods that are particular to a michael@0: // MessageLoop instantiated with TYPE_IO. michael@0: // michael@0: // This class is typically used like so: michael@0: // MessageLoopForIO::current()->...call some method... michael@0: // michael@0: class MessageLoopForIO : public MessageLoop { michael@0: public: michael@0: MessageLoopForIO() : MessageLoop(TYPE_IO) { michael@0: } michael@0: michael@0: // Returns the MessageLoopForIO of the current thread. michael@0: static MessageLoopForIO* current() { michael@0: MessageLoop* loop = MessageLoop::current(); michael@0: DCHECK_EQ(MessageLoop::TYPE_IO, loop->type()); michael@0: return static_cast(loop); michael@0: } michael@0: michael@0: #if defined(OS_WIN) michael@0: typedef base::MessagePumpForIO::IOHandler IOHandler; michael@0: typedef base::MessagePumpForIO::IOContext IOContext; michael@0: michael@0: // Please see MessagePumpWin for definitions of these methods. michael@0: void RegisterIOHandler(HANDLE file_handle, IOHandler* handler); michael@0: bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); michael@0: michael@0: protected: michael@0: // TODO(rvargas): Make this platform independent. michael@0: base::MessagePumpForIO* pump_io() { michael@0: return static_cast(pump_.get()); michael@0: } michael@0: michael@0: #elif defined(OS_POSIX) michael@0: typedef base::MessagePumpLibevent::Watcher Watcher; michael@0: typedef base::MessagePumpLibevent::FileDescriptorWatcher michael@0: FileDescriptorWatcher; michael@0: typedef base::LineWatcher LineWatcher; michael@0: michael@0: enum Mode { michael@0: WATCH_READ = base::MessagePumpLibevent::WATCH_READ, michael@0: WATCH_WRITE = base::MessagePumpLibevent::WATCH_WRITE, michael@0: WATCH_READ_WRITE = base::MessagePumpLibevent::WATCH_READ_WRITE michael@0: }; michael@0: michael@0: // Please see MessagePumpLibevent for definition. michael@0: bool WatchFileDescriptor(int fd, michael@0: bool persistent, michael@0: Mode mode, michael@0: FileDescriptorWatcher *controller, michael@0: Watcher *delegate); michael@0: michael@0: typedef base::MessagePumpLibevent::SignalEvent SignalEvent; michael@0: typedef base::MessagePumpLibevent::SignalWatcher SignalWatcher; michael@0: bool CatchSignal(int sig, michael@0: SignalEvent* sigevent, michael@0: SignalWatcher* delegate); michael@0: michael@0: #endif // defined(OS_POSIX) michael@0: }; michael@0: michael@0: // Do not add any member variables to MessageLoopForIO! This is important b/c michael@0: // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra michael@0: // data that you need should be stored on the MessageLoop's pump_ instance. michael@0: COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), michael@0: MessageLoopForIO_should_not_have_extra_member_variables); michael@0: michael@0: #endif // BASE_MESSAGE_LOOP_H_