| OLD | NEW |
| 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> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 public: | 65 public: |
| 66 // A TaskObserver is an object that receives task notifications from the | 66 // A TaskObserver is an object that receives task notifications from the |
| 67 // MessageLoop. | 67 // MessageLoop. |
| 68 // | 68 // |
| 69 // NOTE: A TaskObserver implementation should be extremely fast! | 69 // NOTE: A TaskObserver implementation should be extremely fast! |
| 70 class TaskObserver { | 70 class TaskObserver { |
| 71 public: | 71 public: |
| 72 TaskObserver(); | 72 TaskObserver(); |
| 73 | 73 |
| 74 // This method is called before processing a task. | 74 // This method is called before processing a task. |
| 75 virtual void WillProcessTask(base::TimeTicks birth_time) = 0; | 75 virtual void WillProcessTask(const Task* task) = 0; |
| 76 | 76 |
| 77 // This method is called after processing a task. | 77 // This method is called after processing a task. |
| 78 virtual void DidProcessTask() = 0; | 78 virtual void DidProcessTask(const Task* task) = 0; |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 virtual ~TaskObserver(); | 81 virtual ~TaskObserver(); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 static void EnableHistogrammer(bool enable_histogrammer); | 84 static void EnableHistogrammer(bool enable_histogrammer); |
| 85 | 85 |
| 86 // A DestructionObserver is notified when the current MessageLoop is being | 86 // A DestructionObserver is notified when the current MessageLoop is being |
| 87 // destroyed. These obsevers are notified prior to MessageLoop::current() | 87 // destroyed. These obsevers are notified prior to MessageLoop::current() |
| 88 // being changed to return NULL. This gives interested parties the chance to | 88 // being changed to return NULL. This gives interested parties the chance to |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 #endif // defined(OS_POSIX) | 599 #endif // defined(OS_POSIX) |
| 600 }; | 600 }; |
| 601 | 601 |
| 602 // Do not add any member variables to MessageLoopForIO! This is important b/c | 602 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 603 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 603 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 604 // data that you need should be stored on the MessageLoop's pump_ instance. | 604 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 605 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 605 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 606 MessageLoopForIO_should_not_have_extra_member_variables); | 606 MessageLoopForIO_should_not_have_extra_member_variables); |
| 607 | 607 |
| 608 #endif // BASE_MESSAGE_LOOP_H_ | 608 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |