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 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class MessageLoop; | 20 class MessageLoop; |
21 class SequencedWorkerPool; | 21 class SequencedWorkerPool; |
22 class Thread; | 22 class Thread; |
23 #if defined(OS_CHROMEOS) | |
24 class MemoryPressureObserverChromeOS; | |
25 #endif | |
23 } | 26 } |
24 | 27 |
25 namespace content { | 28 namespace content { |
26 | 29 |
27 class BrowserThreadDelegate; | 30 class BrowserThreadDelegate; |
28 class BrowserThreadImpl; | 31 class BrowserThreadImpl; |
29 | 32 |
30 // Use DCHECK_CURRENTLY_ON(BrowserThread::ID) to assert that a function can only | 33 // Use DCHECK_CURRENTLY_ON(BrowserThread::ID) to assert that a function can only |
31 // be called on the named BrowserThread. | 34 // be called on the named BrowserThread. |
32 #define DCHECK_CURRENTLY_ON(thread_identifier) \ | 35 #define DCHECK_CURRENTLY_ON(thread_identifier) \ |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 } | 148 } |
146 | 149 |
147 template <class T> | 150 template <class T> |
148 static bool ReleaseSoon(ID identifier, | 151 static bool ReleaseSoon(ID identifier, |
149 const tracked_objects::Location& from_here, | 152 const tracked_objects::Location& from_here, |
150 const T* object) { | 153 const T* object) { |
151 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( | 154 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( |
152 from_here, object); | 155 from_here, object); |
153 } | 156 } |
154 | 157 |
158 #if defined(OS_CHROMEOS) | |
159 static base::MemoryPressureObserverChromeOS* GetMemoryPressureObserver(); | |
160 #endif | |
piman
2014/12/20 02:53:15
This doesn't really look like it belongs to Browse
Mr4D (OOO till 08-26)
2014/12/20 03:01:05
Sure - we could also do it that way. Do you prefer
piman
2014/12/20 03:05:17
I think I would prefer top-level free.
This doesn'
Mr4D (OOO till 08-26)
2015/01/06 22:22:06
Done that way.
However - I still believe that thi
| |
161 | |
155 // Simplified wrappers for posting to the blocking thread pool. Use this | 162 // Simplified wrappers for posting to the blocking thread pool. Use this |
156 // for doing things like blocking I/O. | 163 // for doing things like blocking I/O. |
157 // | 164 // |
158 // The first variant will run the task in the pool with no sequencing | 165 // The first variant will run the task in the pool with no sequencing |
159 // semantics, so may get run in parallel with other posted tasks. The second | 166 // semantics, so may get run in parallel with other posted tasks. The second |
160 // variant will all post a task with no sequencing semantics, and will post a | 167 // variant will all post a task with no sequencing semantics, and will post a |
161 // reply task to the origin TaskRunner upon completion. The third variant | 168 // reply task to the origin TaskRunner upon completion. The third variant |
162 // provides sequencing between tasks with the same sequence token name. | 169 // provides sequencing between tasks with the same sequence token name. |
163 // | 170 // |
164 // These tasks are guaranteed to run before shutdown. | 171 // These tasks are guaranteed to run before shutdown. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 private: | 294 private: |
288 friend class BrowserThreadImpl; | 295 friend class BrowserThreadImpl; |
289 | 296 |
290 BrowserThread() {} | 297 BrowserThread() {} |
291 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 298 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
292 }; | 299 }; |
293 | 300 |
294 } // namespace content | 301 } // namespace content |
295 | 302 |
296 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 303 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
OLD | NEW |