diff options
Diffstat (limited to 'chrome/test/automation/automation_handle_tracker.h')
-rw-r--r-- | chrome/test/automation/automation_handle_tracker.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/chrome/test/automation/automation_handle_tracker.h b/chrome/test/automation/automation_handle_tracker.h index 1117710..fc33600 100644 --- a/chrome/test/automation/automation_handle_tracker.h +++ b/chrome/test/automation/automation_handle_tracker.h @@ -13,6 +13,7 @@ #include "base/basictypes.h" #include "base/lock.h" #include "base/ref_counted.h" +#include "ipc/ipc_channel.h" // This represents a value that the app's AutomationProvider returns // when asked for a resource (like a window or tab). @@ -30,7 +31,11 @@ class AutomationResourceProxy // Marks this proxy object as no longer valid; this generally means // that the corresponding resource on the app side is gone. - void Invalidate() { is_valid_ = false; } + void Invalidate() { + is_valid_ = false; + tracker_ = NULL; + } + bool is_valid() const { return is_valid_; } // Returns the handle that the app has generated to refer to this resource. @@ -44,12 +49,6 @@ class AutomationResourceProxy AutomationHandle handle_; - // Called by the tracker when it is being destroyed so we know not to call - // it back. - void TrackerGone() { - tracker_ = NULL; - } - // Not owned by us, owned by the AutomationProxy object. May be NULL if the // tracker has been destroyed (and hence the object is invalid). AutomationHandleTracker* tracker_; @@ -74,8 +73,7 @@ class AutomationResourceProxy // discard the handle. class AutomationHandleTracker { public: - explicit AutomationHandleTracker(AutomationMessageSender* sender) - : sender_(sender) {} + explicit AutomationHandleTracker() : channel_(NULL) {} ~AutomationHandleTracker(); // Adds the specified proxy object to the tracker. @@ -94,6 +92,11 @@ class AutomationHandleTracker { void InvalidateHandle(AutomationHandle handle); AutomationResourceProxy* GetResource(AutomationHandle handle); + + void put_channel(IPC::Channel* channel) { + channel_ = channel; + } + private: typedef std::map<AutomationHandle, scoped_refptr<AutomationResourceProxy> > @@ -102,8 +105,8 @@ class AutomationHandleTracker { HandleToObjectMap handle_to_object_; - AutomationMessageSender* sender_; Lock map_lock_; + IPC::Channel* channel_; DISALLOW_EVIL_CONSTRUCTORS(AutomationHandleTracker); }; |