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_ |
11 | 11 |
12 #include <atlbase.h> | 12 #include <atlbase.h> |
13 #include <atlcom.h> | 13 #include <atlcom.h> |
14 #include <map> | 14 #include <map> |
15 #include <list> | 15 #include <list> |
16 | 16 |
17 #include "base/lock.h" | 17 #include "base/lock.h" |
18 #include "base/singleton.h" | 18 #include "base/singleton.h" |
| 19 #include "base/task.h" |
19 #include "ceee/common/window_utils.h" | 20 #include "ceee/common/window_utils.h" |
20 #include "ceee/ie/broker/window_events_funnel.h" | 21 #include "ceee/ie/broker/window_events_funnel.h" |
21 | 22 |
22 #include "toolband.h" // NOLINT | 23 #include "toolband.h" // NOLINT |
23 | 24 |
24 // This class is to be used as a single instance for the broker module to | 25 // This class is to be used as a single instance for the broker module to |
25 // hold on a map of executor objects per thread that won't go away when | 26 // hold on a map of executor objects per thread that won't go away when |
26 // the instance of the Broker object does. | 27 // the instance of the Broker object does. |
27 // | 28 // |
28 // See the @ref ExecutorsManagerDoc page for more details. | 29 // See the @ref ExecutorsManagerDoc page for more details. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // @return The corresponding HWND (or INVALID_HANDLE_VALUE if tool_band_id | 114 // @return The corresponding HWND (or INVALID_HANDLE_VALUE if tool_band_id |
114 // isn't found). | 115 // isn't found). |
115 virtual HWND GetTabHandleFromToolBandId(int tool_band_id); | 116 virtual HWND GetTabHandleFromToolBandId(int tool_band_id); |
116 | 117 |
117 // Register the relation between a tool band tab ID and an HWND. | 118 // Register the relation between a tool band tab ID and an HWND. |
118 virtual void SetTabToolBandIdForHandle(int tool_band_id, HWND tab_handle); | 119 virtual void SetTabToolBandIdForHandle(int tool_band_id, HWND tab_handle); |
119 | 120 |
120 // Unregister the HWND and its corresponding tab ID and tool band tab ID. | 121 // Unregister the HWND and its corresponding tab ID and tool band tab ID. |
121 virtual void DeleteTabHandle(HWND handle); | 122 virtual void DeleteTabHandle(HWND handle); |
122 | 123 |
| 124 // Cleans up the maps from all handles that would be associated to the given |
| 125 // thread id. |
| 126 virtual void CleanupMapsForThread(DWORD thread_id); |
| 127 |
123 // Traits for Singleton<ExecutorsManager> so that we can pass an argument | 128 // Traits for Singleton<ExecutorsManager> so that we can pass an argument |
124 // to the constructor. | 129 // to the constructor. |
125 struct SingletonTraits : public DefaultSingletonTraits<ExecutorsManager> { | 130 struct SingletonTraits : public DefaultSingletonTraits<ExecutorsManager> { |
126 static ExecutorsManager* New() { | 131 static ExecutorsManager* New() { |
127 if (test_instance_) | 132 if (test_instance_) |
128 return test_instance_; | 133 return test_instance_; |
129 else | 134 else |
130 return new ExecutorsManager(false); // By default, we want a thread. | 135 return new ExecutorsManager(false); // By default, we want a thread. |
131 } | 136 } |
132 }; | 137 }; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return windows_events_funnel_; | 257 return windows_events_funnel_; |
253 } | 258 } |
254 | 259 |
255 // Test seam too. | 260 // Test seam too. |
256 static ExecutorsManager* test_instance_; | 261 static ExecutorsManager* test_instance_; |
257 | 262 |
258 DISALLOW_COPY_AND_ASSIGN(ExecutorsManager); | 263 DISALLOW_COPY_AND_ASSIGN(ExecutorsManager); |
259 }; | 264 }; |
260 | 265 |
261 #endif // CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ | 266 #endif // CEEE_IE_BROKER_EXECUTORS_MANAGER_H_ |
OLD | NEW |