| 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 CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/message_loop_proxy.h" |
| 11 #include "base/task.h" | 12 #include "base/task.h" |
| 12 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/browser_thread_delegate.h" | 15 #include "content/public/browser/browser_thread_delegate.h" |
| 15 | 16 |
| 16 #if defined(UNIT_TEST) | 17 #if defined(UNIT_TEST) |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #endif // UNIT_TEST | 19 #endif // UNIT_TEST |
| 19 | 20 |
| 20 class MessageLoop; | 21 class MessageLoop; |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class MessageLoopProxy; | |
| 24 class Thread; | 24 class Thread; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class BrowserThreadImpl; | 29 class BrowserThreadImpl; |
| 30 | 30 |
| 31 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
| 32 // BrowserThread | 32 // BrowserThread |
| 33 // | 33 // |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const tracked_objects::Location& from_here, | 146 const tracked_objects::Location& from_here, |
| 147 const T* object) { | 147 const T* object) { |
| 148 return PostNonNestableTask( | 148 return PostNonNestableTask( |
| 149 identifier, from_here, new DeleteTask<T>(object)); | 149 identifier, from_here, new DeleteTask<T>(object)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 template <class T> | 152 template <class T> |
| 153 static bool ReleaseSoon(ID identifier, | 153 static bool ReleaseSoon(ID identifier, |
| 154 const tracked_objects::Location& from_here, | 154 const tracked_objects::Location& from_here, |
| 155 const T* object) { | 155 const T* object) { |
| 156 return PostNonNestableTask( | 156 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( |
| 157 identifier, from_here, new ReleaseTask<T>(object)); | 157 from_here, object); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Callable on any thread. Returns whether the given ID corresponds to a well | 160 // Callable on any thread. Returns whether the given ID corresponds to a well |
| 161 // known thread. | 161 // known thread. |
| 162 static bool IsWellKnownThread(ID identifier); | 162 static bool IsWellKnownThread(ID identifier); |
| 163 | 163 |
| 164 // Callable on any thread. Returns whether you're currently on a particular | 164 // Callable on any thread. Returns whether you're currently on a particular |
| 165 // thread. | 165 // thread. |
| 166 static bool CurrentlyOn(ID identifier); | 166 static bool CurrentlyOn(ID identifier); |
| 167 | 167 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 244 private: |
| 245 friend class BrowserThreadImpl; | 245 friend class BrowserThreadImpl; |
| 246 | 246 |
| 247 BrowserThread() {} | 247 BrowserThread() {} |
| 248 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 248 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace content | 251 } // namespace content |
| 252 | 252 |
| 253 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 253 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| OLD | NEW |