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

Unified Diff: chrome/test/chromedriver/synchronized_map.h

Issue 19616008: [chromedriver] Allow commands to be async. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 5 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/chromedriver/session_unittest.cc ('k') | chrome/test/chromedriver/synchronized_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/synchronized_map.h
diff --git a/chrome/test/chromedriver/synchronized_map.h b/chrome/test/chromedriver/synchronized_map.h
deleted file mode 100644
index a7bbb782df83c3fde43426fd2eef72f4666b8787..0000000000000000000000000000000000000000
--- a/chrome/test/chromedriver/synchronized_map.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef CHROME_TEST_CHROMEDRIVER_SYNCHRONIZED_MAP_H_
-#define CHROME_TEST_CHROMEDRIVER_SYNCHRONIZED_MAP_H_
-
-#include <map>
-#include <utility>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/synchronization/lock.h"
-
-template <typename K, typename V>
-class SynchronizedMap {
- public:
- SynchronizedMap();
- ~SynchronizedMap();
-
- void Set(const K& key, const V& value);
- bool Get(const K& key, V* value) const;
- bool Has(const K& key) const;
- bool Remove(const K& key);
-
- void GetKeys(std::vector<K>* keys) const;
-
- private:
- typedef std::map<K, V> Map;
- Map map_;
- mutable base::Lock map_lock_;
-
- DISALLOW_COPY_AND_ASSIGN(SynchronizedMap);
-};
-
-template <typename K, typename V>
-SynchronizedMap<K, V>::SynchronizedMap() {}
-
-template <typename K, typename V>
-SynchronizedMap<K, V>::~SynchronizedMap() {}
-
-template <typename K, typename V>
-void SynchronizedMap<K, V>::Set(const K& key, const V& value) {
- base::AutoLock lock(map_lock_);
- typename Map::iterator iter = map_.find(key);
- if (iter != map_.end())
- map_.erase(iter);
- map_.insert(std::make_pair(key, value));
-}
-
-template <typename K, typename V>
-bool SynchronizedMap<K, V>::Get(const K& key, V* value) const {
- base::AutoLock lock(map_lock_);
- typename Map::const_iterator iter = map_.find(key);
- if (iter == map_.end())
- return false;
- *value = iter->second;
- return true;
-}
-
-template <typename K, typename V>
-bool SynchronizedMap<K, V>::Has(const K& key) const {
- base::AutoLock lock(map_lock_);
- return map_.find(key) != map_.end();
-}
-
-template <typename K, typename V>
-bool SynchronizedMap<K, V>::Remove(const K& key) {
- base::AutoLock lock(map_lock_);
- typename Map::iterator iter = map_.find(key);
- if (iter == map_.end())
- return false;
- map_.erase(iter);
- return true;
-}
-
-template <typename K, typename V>
-void SynchronizedMap<K, V>::GetKeys(std::vector<K>* keys) const {
- keys->clear();
- base::AutoLock lock(map_lock_);
- typename Map::const_iterator iter;
- for (iter = map_.begin(); iter != map_.end(); iter++)
- keys->push_back(iter->first);
-}
-
-#endif // CHROME_TEST_CHROMEDRIVER_SYNCHRONIZED_MAP_H_
« no previous file with comments | « chrome/test/chromedriver/session_unittest.cc ('k') | chrome/test/chromedriver/synchronized_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698