OLD | NEW |
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 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 // A TaskObserver is an object that receives task notifications from the | 333 // A TaskObserver is an object that receives task notifications from the |
334 // MessageLoop. | 334 // MessageLoop. |
335 // | 335 // |
336 // NOTE: A TaskObserver implementation should be extremely fast! | 336 // NOTE: A TaskObserver implementation should be extremely fast! |
337 class BASE_EXPORT TaskObserver { | 337 class BASE_EXPORT TaskObserver { |
338 public: | 338 public: |
339 TaskObserver(); | 339 TaskObserver(); |
340 | 340 |
341 // This method is called before processing a task. | 341 // This method is called before processing a task. |
342 virtual void WillProcessTask(base::TimeTicks time_posted) = 0; | 342 virtual void WillProcessTask(const base::PendingTask& pending_task) = 0; |
343 | 343 |
344 // This method is called after processing a task. | 344 // This method is called after processing a task. |
345 virtual void DidProcessTask(base::TimeTicks time_posted) = 0; | 345 virtual void DidProcessTask(const base::PendingTask& pending_task) = 0; |
346 | 346 |
347 protected: | 347 protected: |
348 virtual ~TaskObserver(); | 348 virtual ~TaskObserver(); |
349 }; | 349 }; |
350 | 350 |
351 // These functions can only be called on the same thread that |this| is | 351 // These functions can only be called on the same thread that |this| is |
352 // running on. | 352 // running on. |
353 void AddTaskObserver(TaskObserver* task_observer); | 353 void AddTaskObserver(TaskObserver* task_observer); |
354 void RemoveTaskObserver(TaskObserver* task_observer); | 354 void RemoveTaskObserver(TaskObserver* task_observer); |
355 | 355 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 #endif // defined(OS_POSIX) | 699 #endif // defined(OS_POSIX) |
700 }; | 700 }; |
701 | 701 |
702 // Do not add any member variables to MessageLoopForIO! This is important b/c | 702 // Do not add any member variables to MessageLoopForIO! This is important b/c |
703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
704 // data that you need should be stored on the MessageLoop's pump_ instance. | 704 // data that you need should be stored on the MessageLoop's pump_ instance. |
705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
706 MessageLoopForIO_should_not_have_extra_member_variables); | 706 MessageLoopForIO_should_not_have_extra_member_variables); |
707 | 707 |
708 #endif // BASE_MESSAGE_LOOP_H_ | 708 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |