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

Side by Side Diff: base/message_loop.h

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 public: 249 public:
250 AutoRunState(MessageLoop* loop); 250 AutoRunState(MessageLoop* loop);
251 ~AutoRunState(); 251 ~AutoRunState();
252 private: 252 private:
253 MessageLoop* loop_; 253 MessageLoop* loop_;
254 RunState* previous_state_; 254 RunState* previous_state_;
255 }; 255 };
256 256
257 // This structure is copied around by value. 257 // This structure is copied around by value.
258 struct PendingTask { 258 struct PendingTask {
259 Task* task; // The task to run. 259 Task* task; // The task to run.
260 Time delayed_run_time; // The time when the task should be run. 260 base::Time delayed_run_time; // The time when the task should be run.
261 int sequence_num; // Used to facilitate sorting by run time. 261 int sequence_num; // Used to facilitate sorting by run time.
262 bool nestable; // True if OK to dispatch from a nested loop. 262 bool nestable; // True if OK to dispatch from a nested loop.
263 263
264 PendingTask(Task* task, bool nestable) 264 PendingTask(Task* task, bool nestable)
265 : task(task), sequence_num(0), nestable(nestable) { 265 : task(task), sequence_num(0), nestable(nestable) {
266 } 266 }
267 267
268 // Used to support sorting. 268 // Used to support sorting.
269 bool operator<(const PendingTask& other) const; 269 bool operator<(const PendingTask& other) const;
270 }; 270 };
271 271
272 typedef std::queue<PendingTask> TaskQueue; 272 typedef std::queue<PendingTask> TaskQueue;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // destructor to make sure all the task's destructors get called. Returns 327 // destructor to make sure all the task's destructors get called. Returns
328 // true if some work was done. 328 // true if some work was done.
329 bool DeletePendingTasks(); 329 bool DeletePendingTasks();
330 330
331 // Post a task to our incomming queue. 331 // Post a task to our incomming queue.
332 void PostTask_Helper(const tracked_objects::Location& from_here, Task* task, 332 void PostTask_Helper(const tracked_objects::Location& from_here, Task* task,
333 int delay_ms, bool nestable); 333 int delay_ms, bool nestable);
334 334
335 // base::MessagePump::Delegate methods: 335 // base::MessagePump::Delegate methods:
336 virtual bool DoWork(); 336 virtual bool DoWork();
337 virtual bool DoDelayedWork(Time* next_delayed_work_time); 337 virtual bool DoDelayedWork(base::Time* next_delayed_work_time);
338 virtual bool DoIdleWork(); 338 virtual bool DoIdleWork();
339 339
340 // Start recording histogram info about events and action IF it was enabled 340 // Start recording histogram info about events and action IF it was enabled
341 // and IF the statistics recorder can accept a registration of our histogram. 341 // and IF the statistics recorder can accept a registration of our histogram.
342 void StartHistogrammer(); 342 void StartHistogrammer();
343 343
344 // Add occurence of event to our histogram, so that we can see what is being 344 // Add occurence of event to our histogram, so that we can see what is being
345 // done in a specific MessageLoop instance (i.e., specific thread). 345 // done in a specific MessageLoop instance (i.e., specific thread).
346 // If message_histogram_ is NULL, this is a no-op. 346 // If message_histogram_ is NULL, this is a no-op.
347 void HistogramEvent(int event); 347 void HistogramEvent(int event);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 #endif // defined(OS_POSIX) 482 #endif // defined(OS_POSIX)
483 }; 483 };
484 484
485 // Do not add any member variables to MessageLoopForIO! This is important b/c 485 // Do not add any member variables to MessageLoopForIO! This is important b/c
486 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 486 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
487 // data that you need should be stored on the MessageLoop's pump_ instance. 487 // data that you need should be stored on the MessageLoop's pump_ instance.
488 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 488 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
489 MessageLoopForIO_should_not_have_extra_member_variables); 489 MessageLoopForIO_should_not_have_extra_member_variables);
490 490
491 #endif // BASE_MESSAGE_LOOP_H_ 491 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/idletimer_unittest.cc ('k') | base/message_loop.cc » ('j') | base/time_format.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698