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

Unified Diff: chrome/common/extensions/value_counter.h

Issue 237723004: Move EventBindings to //extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/chrome_renderer.gypi ('k') | chrome/common/extensions/value_counter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/value_counter.h
diff --git a/chrome/common/extensions/value_counter.h b/chrome/common/extensions/value_counter.h
deleted file mode 100644
index 84fe06c91c3bfc7d46b653f56522179af54fc808..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/value_counter.h
+++ /dev/null
@@ -1,71 +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_COMMON_EXTENSIONS_VALUE_COUNTER_H_
-#define CHROME_COMMON_EXTENSIONS_VALUE_COUNTER_H_
-
-#include "base/memory/linked_ptr.h"
-
-#include <vector>
-
-namespace base {
-class Value;
-}
-
-namespace extensions {
-
-// Keeps a running count of Values, like map<Value, int>. Adding / removing
-// values increments / decrements the count associated with a given Value.
-//
-// Add() and Remove() are linear in the number of Values in the ValueCounter,
-// because there is no operator<() defined on Value, so we must iterate to find
-// whether a Value is equal to an existing one.
-class ValueCounter {
- public:
- ValueCounter();
- ~ValueCounter();
-
- // Adds |value| to the set and returns how many equal values are in the set
- // after. Does not take ownership of |value|. In the case where a Value equal
- // to |value| doesn't already exist in this map, this function makes a
- // DeepCopy() of |value|.
- int Add(const base::Value& value);
-
- // Removes |value| from the set and returns how many equal values are in
- // the set after.
- int Remove(const base::Value& value);
-
- // Same as Add() but only performs the add if the value isn't present.
- int AddIfMissing(const base::Value& value);
-
- private:
- class Entry {
- public:
- explicit Entry(const base::Value& value);
- ~Entry();
-
- int Increment();
- int Decrement();
-
- const base::Value* value() const { return value_.get(); }
- int count() const { return count_; }
-
- private:
- linked_ptr<base::Value> value_;
- int count_;
-
- DISALLOW_COPY_AND_ASSIGN(Entry);
- };
- typedef std::vector<linked_ptr<Entry> > EntryList;
-
- int AddImpl(const base::Value& value, bool increment);
-
- EntryList entries_;
-
- DISALLOW_COPY_AND_ASSIGN(ValueCounter);
-};
-
-} // namespace extensions
-
-#endif // CHROME_COMMON_EXTENSIONS_VALUE_COUNTER_H_
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/extensions/value_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698