OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PROXY_IMPL_H_ | 5 #ifndef BASE_MESSAGE_LOOP_PROXY_IMPL_H_ |
6 #define BASE_MESSAGE_LOOP_PROXY_IMPL_H_ | 6 #define BASE_MESSAGE_LOOP_PROXY_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/base_api.h" | 9 #include "base/base_api.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual bool PostTask(const tracked_objects::Location& from_here, | 25 virtual bool PostTask(const tracked_objects::Location& from_here, |
26 Task* task); | 26 Task* task); |
27 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 27 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
28 Task* task, int64 delay_ms); | 28 Task* task, int64 delay_ms); |
29 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, | 29 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, |
30 Task* task); | 30 Task* task); |
31 virtual bool PostNonNestableDelayedTask( | 31 virtual bool PostNonNestableDelayedTask( |
32 const tracked_objects::Location& from_here, | 32 const tracked_objects::Location& from_here, |
33 Task* task, | 33 Task* task, |
34 int64 delay_ms); | 34 int64 delay_ms); |
| 35 virtual bool PostTask(const tracked_objects::Location& from_here, |
| 36 const base::Closure& task); |
| 37 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 38 const base::Closure& task, int64 delay_ms); |
| 39 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, |
| 40 const base::Closure& task); |
| 41 virtual bool PostNonNestableDelayedTask( |
| 42 const tracked_objects::Location& from_here, |
| 43 const base::Closure& task, |
| 44 int64 delay_ms); |
35 virtual bool BelongsToCurrentThread(); | 45 virtual bool BelongsToCurrentThread(); |
36 | 46 |
37 // MessageLoop::DestructionObserver implementation | 47 // MessageLoop::DestructionObserver implementation |
38 virtual void WillDestroyCurrentMessageLoop(); | 48 virtual void WillDestroyCurrentMessageLoop(); |
39 | 49 |
40 protected: | 50 protected: |
41 // Override OnDestruct so that we can delete the object on the target message | 51 // Override OnDestruct so that we can delete the object on the target message |
42 // loop if it still exists. | 52 // loop if it still exists. |
43 virtual void OnDestruct() const; | 53 virtual void OnDestruct() const; |
44 | 54 |
45 private: | 55 private: |
46 MessageLoopProxyImpl(); | 56 MessageLoopProxyImpl(); |
| 57 // TODO(ajwong): Remove this after we've fully migrated to base::Closure. |
47 bool PostTaskHelper(const tracked_objects::Location& from_here, | 58 bool PostTaskHelper(const tracked_objects::Location& from_here, |
48 Task* task, int64 delay_ms, bool nestable); | 59 Task* task, int64 delay_ms, bool nestable); |
| 60 bool PostTaskHelper(const tracked_objects::Location& from_here, |
| 61 const base::Closure& task, int64 delay_ms, |
| 62 bool nestable); |
49 | 63 |
50 // For the factory method to work | 64 // For the factory method to work |
51 friend class MessageLoopProxy; | 65 friend class MessageLoopProxy; |
52 | 66 |
53 // The lock that protects access to target_message_loop_. | 67 // The lock that protects access to target_message_loop_. |
54 mutable base::Lock message_loop_lock_; | 68 mutable base::Lock message_loop_lock_; |
55 MessageLoop* target_message_loop_; | 69 MessageLoop* target_message_loop_; |
56 | 70 |
57 DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl); | 71 DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl); |
58 }; | 72 }; |
59 | 73 |
60 } // namespace base | 74 } // namespace base |
61 | 75 |
62 #endif // BASE_MESSAGE_LOOP_PROXY_IMPL_H_ | 76 #endif // BASE_MESSAGE_LOOP_PROXY_IMPL_H_ |
63 | |
OLD | NEW |