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

Side by Side Diff: base/message_loop.h

Issue 10496002: Revert 140102 - Remove old PostDelayedTask interfaces that use int ms instead of TimeDelta. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // been Run(). 158 // been Run().
159 // 159 //
160 // NOTE: These methods may be called on any thread. The Task will be invoked 160 // NOTE: These methods may be called on any thread. The Task will be invoked
161 // on the thread that executes MessageLoop::Run(). 161 // on the thread that executes MessageLoop::Run().
162 void PostTask( 162 void PostTask(
163 const tracked_objects::Location& from_here, 163 const tracked_objects::Location& from_here,
164 const base::Closure& task); 164 const base::Closure& task);
165 165
166 void PostDelayedTask( 166 void PostDelayedTask(
167 const tracked_objects::Location& from_here, 167 const tracked_objects::Location& from_here,
168 const base::Closure& task, int64 delay_ms);
169
170 void PostDelayedTask(
171 const tracked_objects::Location& from_here,
168 const base::Closure& task, 172 const base::Closure& task,
169 base::TimeDelta delay); 173 base::TimeDelta delay);
170 174
171 void PostNonNestableTask( 175 void PostNonNestableTask(
172 const tracked_objects::Location& from_here, 176 const tracked_objects::Location& from_here,
173 const base::Closure& task); 177 const base::Closure& task);
174 178
175 void PostNonNestableDelayedTask( 179 void PostNonNestableDelayedTask(
176 const tracked_objects::Location& from_here, 180 const tracked_objects::Location& from_here,
181 const base::Closure& task, int64 delay_ms);
182
183 void PostNonNestableDelayedTask(
184 const tracked_objects::Location& from_here,
177 const base::Closure& task, 185 const base::Closure& task,
178 base::TimeDelta delay); 186 base::TimeDelta delay);
179 187
180 // A variant on PostTask that deletes the given object. This is useful 188 // A variant on PostTask that deletes the given object. This is useful
181 // if the object needs to live until the next run of the MessageLoop (for 189 // if the object needs to live until the next run of the MessageLoop (for
182 // example, deleting a RenderProcessHost from within an IPC callback is not 190 // example, deleting a RenderProcessHost from within an IPC callback is not
183 // good). 191 // good).
184 // 192 //
185 // NOTE: This method may be called on any thread. The object will be deleted 193 // NOTE: This method may be called on any thread. The object will be deleted
186 // on the thread that executes MessageLoop::Run(). If this is not the same 194 // on the thread that executes MessageLoop::Run(). If this is not the same
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // empty. The former requires a lock to access, while the latter is directly 442 // empty. The former requires a lock to access, while the latter is directly
435 // accessible on this thread. 443 // accessible on this thread.
436 void ReloadWorkQueue(); 444 void ReloadWorkQueue();
437 445
438 // Delete tasks that haven't run yet without running them. Used in the 446 // Delete tasks that haven't run yet without running them. Used in the
439 // destructor to make sure all the task's destructors get called. Returns 447 // destructor to make sure all the task's destructors get called. Returns
440 // true if some work was done. 448 // true if some work was done.
441 bool DeletePendingTasks(); 449 bool DeletePendingTasks();
442 450
443 // Calculates the time at which a PendingTask should run. 451 // Calculates the time at which a PendingTask should run.
444 base::TimeTicks CalculateDelayedRuntime(base::TimeDelta delay); 452 base::TimeTicks CalculateDelayedRuntime(int64 delay_ms);
445 453
446 // Start recording histogram info about events and action IF it was enabled 454 // Start recording histogram info about events and action IF it was enabled
447 // and IF the statistics recorder can accept a registration of our histogram. 455 // and IF the statistics recorder can accept a registration of our histogram.
448 void StartHistogrammer(); 456 void StartHistogrammer();
449 457
450 // Add occurrence of event to our histogram, so that we can see what is being 458 // Add occurrence of event to our histogram, so that we can see what is being
451 // done in a specific MessageLoop instance (i.e., specific thread). 459 // done in a specific MessageLoop instance (i.e., specific thread).
452 // If message_histogram_ is NULL, this is a no-op. 460 // If message_histogram_ is NULL, this is a no-op.
453 void HistogramEvent(int event); 461 void HistogramEvent(int event);
454 462
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 #endif // defined(OS_POSIX) 659 #endif // defined(OS_POSIX)
652 }; 660 };
653 661
654 // Do not add any member variables to MessageLoopForIO! This is important b/c 662 // Do not add any member variables to MessageLoopForIO! This is important b/c
655 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 663 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
656 // data that you need should be stored on the MessageLoop's pump_ instance. 664 // data that you need should be stored on the MessageLoop's pump_ instance.
657 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 665 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
658 MessageLoopForIO_should_not_have_extra_member_variables); 666 MessageLoopForIO_should_not_have_extra_member_variables);
659 667
660 #endif // BASE_MESSAGE_LOOP_H_ 668 #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