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 REMOTING_BASE_AUTO_THREAD_H_ | 5 #ifndef REMOTING_BASE_AUTO_THREAD_H_ |
6 #define REMOTING_BASE_AUTO_THREAD_H_ | 6 #define REMOTING_BASE_AUTO_THREAD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void SetComInitType(ComInitType com_init_type); | 76 void SetComInitType(ComInitType com_init_type); |
77 #endif | 77 #endif |
78 | 78 |
79 private: | 79 private: |
80 AutoThread(const char* name, AutoThreadTaskRunner* joiner); | 80 AutoThread(const char* name, AutoThreadTaskRunner* joiner); |
81 | 81 |
82 void QuitThread(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 82 void QuitThread(scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
83 void JoinAndDeleteThread(); | 83 void JoinAndDeleteThread(); |
84 | 84 |
85 // base::PlatformThread::Delegate methods: | 85 // base::PlatformThread::Delegate methods: |
86 virtual void ThreadMain() OVERRIDE; | 86 virtual void ThreadMain() override; |
87 | 87 |
88 // Used to pass data to ThreadMain. | 88 // Used to pass data to ThreadMain. |
89 struct StartupData; | 89 struct StartupData; |
90 StartupData* startup_data_; | 90 StartupData* startup_data_; |
91 | 91 |
92 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
93 // Specifies which kind of COM apartment to initialize, if any. | 93 // Specifies which kind of COM apartment to initialize, if any. |
94 ComInitType com_init_type_; | 94 ComInitType com_init_type_; |
95 #endif | 95 #endif |
96 | 96 |
97 // The thread's handle. | 97 // The thread's handle. |
98 base::PlatformThreadHandle thread_; | 98 base::PlatformThreadHandle thread_; |
99 | 99 |
100 // The name of the thread. Used for debugging purposes. | 100 // The name of the thread. Used for debugging purposes. |
101 std::string name_; | 101 std::string name_; |
102 | 102 |
103 // Flag used to indicate whether MessageLoop was quit properly. | 103 // Flag used to indicate whether MessageLoop was quit properly. |
104 // This allows us to detect premature exit via MessageLoop::Quit(). | 104 // This allows us to detect premature exit via MessageLoop::Quit(). |
105 bool was_quit_properly_; | 105 bool was_quit_properly_; |
106 | 106 |
107 // AutoThreadTaskRunner to post a task to to join & delete this thread. | 107 // AutoThreadTaskRunner to post a task to to join & delete this thread. |
108 scoped_refptr<AutoThreadTaskRunner> joiner_; | 108 scoped_refptr<AutoThreadTaskRunner> joiner_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(AutoThread); | 110 DISALLOW_COPY_AND_ASSIGN(AutoThread); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace remoting | 113 } // namespace remoting |
114 | 114 |
115 #endif // REMOTING_AUTO_THREAD_H_ | 115 #endif // REMOTING_AUTO_THREAD_H_ |
OLD | NEW |