Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: chrome/test/automation/automation_handle_tracker.cc

Issue 223163003: Remove the remaining automation-based tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/automation/automation_handle_tracker.h ('k') | chrome/test/automation/automation_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/automation/automation_handle_tracker.cc
===================================================================
--- chrome/test/automation/automation_handle_tracker.cc (revision 261647)
+++ chrome/test/automation/automation_handle_tracker.cc (working copy)
@@ -1,72 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/automation/automation_handle_tracker.h"
-
-#include "chrome/common/automation_messages.h"
-#include "chrome/test/automation/automation_proxy.h"
-
-AutomationResourceProxy::AutomationResourceProxy(
- AutomationHandleTracker* tracker, AutomationMessageSender* sender,
- AutomationHandle handle)
- : handle_(handle),
- tracker_(tracker),
- sender_(sender),
- is_valid_(true) {
- tracker_->Add(this);
-}
-
-AutomationResourceProxy::~AutomationResourceProxy() {
- if (tracker_)
- tracker_->Remove(this);
-}
-
-AutomationHandleTracker::AutomationHandleTracker() : channel_(NULL) {}
-
-AutomationHandleTracker::~AutomationHandleTracker() {
- // Tell any live objects that the tracker is going away so they don't try to
- // call us when they are being destroyed.
- for (HandleToObjectMap::iterator iter = handle_to_object_.begin();
- iter != handle_to_object_.end(); ++iter) {
- iter->second->Invalidate();
- }
-}
-
-void AutomationHandleTracker::Add(AutomationResourceProxy* proxy) {
- base::AutoLock lock(map_lock_);
- handle_to_object_.insert(MapEntry(proxy->handle(), proxy));
-}
-
-void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) {
- base::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);
- if (channel_)
- channel_->Send(new AutomationMsg_HandleUnused(proxy_handle));
- }
-}
-
-void AutomationHandleTracker::InvalidateHandle(AutomationHandle handle) {
- // Called in background thread.
- base::AutoLock lock(map_lock_);
- HandleToObjectMap::iterator iter = handle_to_object_.find(handle);
- if (iter != handle_to_object_.end()) {
- scoped_refptr<AutomationResourceProxy> proxy = iter->second;
- handle_to_object_.erase(iter);
- proxy->Invalidate();
- }
-}
-
-AutomationResourceProxy* AutomationHandleTracker::GetResource(
- AutomationHandle handle) {
- base::AutoLock lock(map_lock_);
- HandleToObjectMap::iterator iter = handle_to_object_.find(handle);
- if (iter == handle_to_object_.end())
- return NULL;
-
- iter->second->AddRef();
- return iter->second.get();
-}
« no previous file with comments | « chrome/test/automation/automation_handle_tracker.h ('k') | chrome/test/automation/automation_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698