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

Side by Side Diff: base/message_loop.h

Issue 6094005: Create "Prebind" a wrapper to tr1::bind. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Remove closure.h and ThunkState Created 9 years, 11 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
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 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/lock.h" 13 #include "base/lock.h"
14 #include "base/message_pump.h" 14 #include "base/message_pump.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/ref_counted.h" 16 #include "base/ref_counted.h"
17 #include "base/task.h" 17 #include "base/task.h"
18 #include "base/prebind.h"
18 19
19 #if defined(OS_WIN) 20 #if defined(OS_WIN)
20 // We need this to declare base::MessagePumpWin::Dispatcher, which we should 21 // We need this to declare base::MessagePumpWin::Dispatcher, which we should
21 // really just eliminate. 22 // really just eliminate.
22 #include "base/message_pump_win.h" 23 #include "base/message_pump_win.h"
23 #elif defined(OS_POSIX) 24 #elif defined(OS_POSIX)
24 #include "base/message_pump_libevent.h" 25 #include "base/message_pump_libevent.h"
25 #if !defined(OS_MACOSX) 26 #if !defined(OS_MACOSX)
26 #include "base/message_pump_glib.h" 27 #include "base/message_pump_glib.h"
27 #endif 28 #endif
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // The NonNestable variants work similarly except that they promise never to 121 // The NonNestable variants work similarly except that they promise never to
121 // dispatch the task from a nested invocation of MessageLoop::Run. Instead, 122 // dispatch the task from a nested invocation of MessageLoop::Run. Instead,
122 // such tasks get deferred until the top-most MessageLoop::Run is executing. 123 // such tasks get deferred until the top-most MessageLoop::Run is executing.
123 // 124 //
124 // The MessageLoop takes ownership of the Task, and deletes it after it has 125 // The MessageLoop takes ownership of the Task, and deletes it after it has
125 // been Run(). 126 // been Run().
126 // 127 //
127 // NOTE: These methods may be called on any thread. The Task will be invoked 128 // NOTE: These methods may be called on any thread. The Task will be invoked
128 // on the thread that executes MessageLoop::Run(). 129 // on the thread that executes MessageLoop::Run().
129 130
131 void PostThunk(
132 const tracked_objects::Location& from_here,
133 base::Thunk<void(void)> thunk);
134
130 void PostTask( 135 void PostTask(
131 const tracked_objects::Location& from_here, Task* task); 136 const tracked_objects::Location& from_here, Task* task);
132 137
133 void PostDelayedTask( 138 void PostDelayedTask(
134 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); 139 const tracked_objects::Location& from_here, Task* task, int64 delay_ms);
135 140
141 void PostDelayedThunk(
142 const tracked_objects::Location& from_here,
143 base::Thunk<void(void)> thunk,
144 int64 delay_ms);
145
136 void PostNonNestableTask( 146 void PostNonNestableTask(
137 const tracked_objects::Location& from_here, Task* task); 147 const tracked_objects::Location& from_here, Task* task);
138 148
139 void PostNonNestableDelayedTask( 149 void PostNonNestableDelayedTask(
140 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); 150 const tracked_objects::Location& from_here, Task* task, int64 delay_ms);
141 151
142 // A variant on PostTask that deletes the given object. This is useful 152 // A variant on PostTask that deletes the given object. This is useful
143 // if the object needs to live until the next run of the MessageLoop (for 153 // if the object needs to live until the next run of the MessageLoop (for
144 // example, deleting a RenderProcessHost from within an IPC callback is not 154 // example, deleting a RenderProcessHost from within an IPC callback is not
145 // good). 155 // good).
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 #endif // defined(OS_POSIX) 619 #endif // defined(OS_POSIX)
610 }; 620 };
611 621
612 // Do not add any member variables to MessageLoopForIO! This is important b/c 622 // Do not add any member variables to MessageLoopForIO! This is important b/c
613 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 623 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
614 // data that you need should be stored on the MessageLoop's pump_ instance. 624 // data that you need should be stored on the MessageLoop's pump_ instance.
615 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 625 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
616 MessageLoopForIO_should_not_have_extra_member_variables); 626 MessageLoopForIO_should_not_have_extra_member_variables);
617 627
618 #endif // BASE_MESSAGE_LOOP_H_ 628 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/message_loop.cc » ('j') | base/prebind.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698