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 // This file defines a mapping between Automation Proxy objects and | 5 // This file defines a mapping between Automation Proxy objects and |
6 // their associated app-side handles. | 6 // their associated app-side handles. |
7 | 7 |
8 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ | 8 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ |
9 #define CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ | 9 #define CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ |
10 #pragma once | 10 #pragma once |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // This class keeps track of the mapping between AutomationHandles and | 68 // This class keeps track of the mapping between AutomationHandles and |
69 // AutomationResourceProxy objects. This is important because (1) multiple | 69 // AutomationResourceProxy objects. This is important because (1) multiple |
70 // AutomationResourceProxy objects can be generated for the same handle | 70 // AutomationResourceProxy objects can be generated for the same handle |
71 // (2) handles can be invalidated by the app, and all the associated | 71 // (2) handles can be invalidated by the app, and all the associated |
72 // proxy objects then need to be invalidated, and (3) when a handle is no | 72 // proxy objects then need to be invalidated, and (3) when a handle is no |
73 // longer being used on this end, we need to tell the app that it can | 73 // longer being used on this end, we need to tell the app that it can |
74 // discard the handle. | 74 // discard the handle. |
75 class AutomationHandleTracker { | 75 class AutomationHandleTracker { |
76 public: | 76 public: |
77 explicit AutomationHandleTracker() : channel_(NULL) {} | 77 explicit AutomationHandleTracker(); |
78 ~AutomationHandleTracker(); | 78 ~AutomationHandleTracker(); |
79 | 79 |
80 // Adds the specified proxy object to the tracker. | 80 // Adds the specified proxy object to the tracker. |
81 void Add(AutomationResourceProxy* proxy); | 81 void Add(AutomationResourceProxy* proxy); |
82 | 82 |
83 // Removes a given proxy object from the mapping, and unregisters the | 83 // Removes a given proxy object from the mapping, and unregisters the |
84 // handle on the app side if this was the last proxy object that was using | 84 // handle on the app side if this was the last proxy object that was using |
85 // that handle. This is a no-op if the proxy object is not currently | 85 // that handle. This is a no-op if the proxy object is not currently |
86 // in the tracker. | 86 // in the tracker. |
87 void Remove(AutomationResourceProxy* proxy); | 87 void Remove(AutomationResourceProxy* proxy); |
(...skipping 17 matching lines...) Expand all Loading... |
105 typedef std::pair<AutomationHandle, AutomationResourceProxy*> MapEntry; | 105 typedef std::pair<AutomationHandle, AutomationResourceProxy*> MapEntry; |
106 | 106 |
107 HandleToObjectMap handle_to_object_; | 107 HandleToObjectMap handle_to_object_; |
108 | 108 |
109 Lock map_lock_; | 109 Lock map_lock_; |
110 IPC::Channel* channel_; | 110 IPC::Channel* channel_; |
111 DISALLOW_COPY_AND_ASSIGN(AutomationHandleTracker); | 111 DISALLOW_COPY_AND_ASSIGN(AutomationHandleTracker); |
112 }; | 112 }; |
113 | 113 |
114 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ | 114 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_HANDLE_TRACKER_H__ |
OLD | NEW |