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_BROWSER_BROWSER_THREAD_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ |
6 #define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ | 6 #define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ |
7 | 7 |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 BrowserThreadImpl(BrowserThread::ID identifier, | 24 BrowserThreadImpl(BrowserThread::ID identifier, |
25 base::MessageLoop* message_loop); | 25 base::MessageLoop* message_loop); |
26 ~BrowserThreadImpl() override; | 26 ~BrowserThreadImpl() override; |
27 | 27 |
28 bool StartWithOptions(const Options& options); | 28 bool StartWithOptions(const Options& options); |
29 | 29 |
30 static void ShutdownThreadPool(); | 30 static void ShutdownThreadPool(); |
31 | 31 |
32 protected: | 32 protected: |
33 void Init() override; | 33 void Init() override; |
34 void Run(base::MessageLoop* message_loop) override; | 34 void Run(base::RunLoop* run_loop) override; |
35 void CleanUp() override; | 35 void CleanUp() override; |
36 | 36 |
37 private: | 37 private: |
38 // We implement all the functionality of the public BrowserThread | 38 // We implement all the functionality of the public BrowserThread |
39 // functions, but state is stored in the BrowserThreadImpl to keep | 39 // functions, but state is stored in the BrowserThreadImpl to keep |
40 // the API cleaner. Therefore make BrowserThread a friend class. | 40 // the API cleaner. Therefore make BrowserThread a friend class. |
41 friend class BrowserThread; | 41 friend class BrowserThread; |
42 | 42 |
43 // The following are unique function names that makes it possible to tell | 43 // The following are unique function names that makes it possible to tell |
44 // the thread id from the callstack alone in crash dumps. | 44 // the thread id from the callstack alone in crash dumps. |
45 void UIThreadRun(base::MessageLoop* message_loop); | 45 void UIThreadRun(base::RunLoop* run_loop); |
46 void DBThreadRun(base::MessageLoop* message_loop); | 46 void DBThreadRun(base::RunLoop* run_loop); |
47 void FileThreadRun(base::MessageLoop* message_loop); | 47 void FileThreadRun(base::RunLoop* run_loop); |
48 void FileUserBlockingThreadRun(base::MessageLoop* message_loop); | 48 void FileUserBlockingThreadRun(base::RunLoop* run_loop); |
49 void ProcessLauncherThreadRun(base::MessageLoop* message_loop); | 49 void ProcessLauncherThreadRun(base::RunLoop* run_loop); |
50 void CacheThreadRun(base::MessageLoop* message_loop); | 50 void CacheThreadRun(base::RunLoop* run_loop); |
51 void IOThreadRun(base::MessageLoop* message_loop); | 51 void IOThreadRun(base::RunLoop* run_loop); |
52 | 52 |
53 static bool PostTaskHelper( | 53 static bool PostTaskHelper( |
54 BrowserThread::ID identifier, | 54 BrowserThread::ID identifier, |
55 const tracked_objects::Location& from_here, | 55 const tracked_objects::Location& from_here, |
56 const base::Closure& task, | 56 const base::Closure& task, |
57 base::TimeDelta delay, | 57 base::TimeDelta delay, |
58 bool nestable); | 58 bool nestable); |
59 | 59 |
60 // Common initialization code for the constructors. | 60 // Common initialization code for the constructors. |
61 void Initialize(); | 61 void Initialize(); |
62 | 62 |
63 // For testing. | 63 // For testing. |
64 friend class ContentTestSuiteBaseListener; | 64 friend class ContentTestSuiteBaseListener; |
65 friend class TestBrowserThreadBundle; | 65 friend class TestBrowserThreadBundle; |
66 static void FlushThreadPoolHelperForTesting(); | 66 static void FlushThreadPoolHelperForTesting(); |
67 | 67 |
68 // The identifier of this thread. Only one thread can exist with a given | 68 // The identifier of this thread. Only one thread can exist with a given |
69 // identifier at a given time. | 69 // identifier at a given time. |
70 ID identifier_; | 70 ID identifier_; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace content | 73 } // namespace content |
74 | 74 |
75 #endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ | 75 #endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ |
OLD | NEW |