summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/test/automation/automation_handle_tracker.cc7
-rw-r--r--chrome/test/automation/automation_handle_tracker.h3
2 files changed, 5 insertions, 5 deletions
diff --git a/chrome/test/automation/automation_handle_tracker.cc b/chrome/test/automation/automation_handle_tracker.cc
index 1cefc08..6ced518 100644
--- a/chrome/test/automation/automation_handle_tracker.cc
+++ b/chrome/test/automation/automation_handle_tracker.cc
@@ -18,8 +18,6 @@ AutomationResourceProxy::AutomationResourceProxy(
}
AutomationResourceProxy::~AutomationResourceProxy() {
- if (tracker_)
- tracker_->Remove(this);
}
AutomationHandleTracker::~AutomationHandleTracker() {
@@ -38,11 +36,11 @@ void AutomationHandleTracker::Add(AutomationResourceProxy* proxy) {
}
void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) {
- AutoLock lock(map_lock_);
HandleToObjectMap::iterator iter = handle_to_object_.find(proxy->handle());
if (iter != handle_to_object_.end()) {
+ AutomationHandle proxy_handle = proxy->handle();
handle_to_object_.erase(iter);
- sender_->Send(new AutomationMsg_HandleUnused(0, proxy->handle()));
+ sender_->Send(new AutomationMsg_HandleUnused(0, proxy_handle));
}
}
@@ -52,6 +50,7 @@ void AutomationHandleTracker::InvalidateHandle(AutomationHandle handle) {
HandleToObjectMap::iterator iter = handle_to_object_.find(handle);
if (iter != handle_to_object_.end()) {
iter->second->Invalidate();
+ Remove(iter->second);
}
}
diff --git a/chrome/test/automation/automation_handle_tracker.h b/chrome/test/automation/automation_handle_tracker.h
index 1db6015..1117710 100644
--- a/chrome/test/automation/automation_handle_tracker.h
+++ b/chrome/test/automation/automation_handle_tracker.h
@@ -96,7 +96,8 @@ class AutomationHandleTracker {
AutomationResourceProxy* GetResource(AutomationHandle handle);
private:
typedef
- std::map<AutomationHandle, AutomationResourceProxy*> HandleToObjectMap;
+ std::map<AutomationHandle, scoped_refptr<AutomationResourceProxy> >
+ HandleToObjectMap;
typedef std::pair<AutomationHandle, AutomationResourceProxy*> MapEntry;
HandleToObjectMap handle_to_object_;