| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_H_ | 5 #ifndef BASE_MESSAGE_LOOP_PROXY_H_ |
| 6 #define BASE_MESSAGE_LOOP_PROXY_H_ | 6 #define BASE_MESSAGE_LOOP_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 virtual bool PostTask(const tracked_objects::Location& from_here, | 21 virtual bool PostTask(const tracked_objects::Location& from_here, |
| 22 Task* task) = 0; | 22 Task* task) = 0; |
| 23 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, | 23 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 24 Task* task, int64 delay_ms) = 0; | 24 Task* task, int64 delay_ms) = 0; |
| 25 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, | 25 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, |
| 26 Task* task) = 0; | 26 Task* task) = 0; |
| 27 virtual bool PostNonNestableDelayedTask( | 27 virtual bool PostNonNestableDelayedTask( |
| 28 const tracked_objects::Location& from_here, | 28 const tracked_objects::Location& from_here, |
| 29 Task* task, | 29 Task* task, |
| 30 int64 delay_ms) = 0; | 30 int64 delay_ms) = 0; |
| 31 // A method which checks if the caller is currently running in the thread that |
| 32 // this proxy represents. |
| 33 virtual bool BelongsToCurrentThread() = 0; |
| 31 | 34 |
| 32 template <class T> | 35 template <class T> |
| 33 bool DeleteSoon(const tracked_objects::Location& from_here, | 36 bool DeleteSoon(const tracked_objects::Location& from_here, |
| 34 T* object) { | 37 T* object) { |
| 35 return PostNonNestableTask(from_here, new DeleteTask<T>(object)); | 38 return PostNonNestableTask(from_here, new DeleteTask<T>(object)); |
| 36 } | 39 } |
| 37 template <class T> | 40 template <class T> |
| 38 bool ReleaseSoon(const tracked_objects::Location& from_here, | 41 bool ReleaseSoon(const tracked_objects::Location& from_here, |
| 39 T* object) { | 42 T* object) { |
| 40 return PostNonNestableTask(from_here, new ReleaseTask<T>(object)); | 43 return PostNonNestableTask(from_here, new ReleaseTask<T>(object)); |
| 41 } | 44 } |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 #endif // BASE_MESSAGE_LOOP_PROXY_H_ | 47 #endif // BASE_MESSAGE_LOOP_PROXY_H_ |
| 45 | 48 |
| OLD | NEW |