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 // @file | 5 // @file |
6 // ExecutorsManager implementation, an object to keep track of the | 6 // ExecutorsManager implementation, an object to keep track of the |
7 // CeeeExecutor objects that were instantiated in destination threads. | 7 // CeeeExecutor objects that were instantiated in destination threads. |
8 | 8 |
9 #ifndef CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ | 9 #ifndef CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ |
10 #define CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ | 10 #define CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 virtual int GetTabIdFromHandle(HWND tab_handle); | 83 virtual int GetTabIdFromHandle(HWND tab_handle); |
84 | 84 |
85 // Register the relation between a tab_id and a HWND. | 85 // Register the relation between a tab_id and a HWND. |
86 virtual void SetTabIdForHandle(long tab_id, HWND tab_handle); | 86 virtual void SetTabIdForHandle(long tab_id, HWND tab_handle); |
87 | 87 |
88 // Unregister the HWND and its corresponding tab_id. | 88 // Unregister the HWND and its corresponding tab_id. |
89 virtual void DeleteTabHandle(HWND handle); | 89 virtual void DeleteTabHandle(HWND handle); |
90 | 90 |
91 // Traits for Singleton<ExecutorsManager> so that we can pass an argument | 91 // Traits for Singleton<ExecutorsManager> so that we can pass an argument |
92 // to the constructor. | 92 // to the constructor. |
93 struct SingletonTraits { | 93 struct SingletonTraits : public DefaultSingletonTraits<ExecutorsManager> { |
94 static ExecutorsManager* New() { | 94 static ExecutorsManager* New() { |
95 return new ExecutorsManager(false); // By default, we want a thread. | 95 return new ExecutorsManager(false); // By default, we want a thread. |
96 } | 96 } |
97 static void Delete(ExecutorsManager* x) { | |
98 delete x; | |
99 } | |
100 static const bool kRegisterAtExit = true; | |
101 }; | 97 }; |
102 | 98 |
103 protected: | 99 protected: |
104 // The data we pass to start our worker thread. | 100 // The data we pass to start our worker thread. |
105 // THERE IS A COPY OF THIS CLASS IN THE UNITTEST WHICH YOU NEED TO UPDATE IF | 101 // THERE IS A COPY OF THIS CLASS IN THE UNITTEST WHICH YOU NEED TO UPDATE IF |
106 // you change this one... | 102 // you change this one... |
107 struct ThreadStartData { | 103 struct ThreadStartData { |
108 ExecutorsManager* me; | 104 ExecutorsManager* me; |
109 CHandle thread_started_gate; | 105 CHandle thread_started_gate; |
110 }; | 106 }; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 CHandle termination_gate_; | 197 CHandle termination_gate_; |
202 | 198 |
203 // To protect the access to the maps (ExecutorsManager::executors_ & | 199 // To protect the access to the maps (ExecutorsManager::executors_ & |
204 // ExecutorsManager::pending_registrations_ & tab_id_map_/handle_map_). | 200 // ExecutorsManager::pending_registrations_ & tab_id_map_/handle_map_). |
205 Lock lock_; | 201 Lock lock_; |
206 | 202 |
207 DISALLOW_EVIL_CONSTRUCTORS(ExecutorsManager); | 203 DISALLOW_EVIL_CONSTRUCTORS(ExecutorsManager); |
208 }; | 204 }; |
209 | 205 |
210 #endif // CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ | 206 #endif // CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ |
OLD | NEW |