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

Side by Side Diff: extensions/common/value_counter.h

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 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 unified diff | Download patch
« no previous file with comments | « extensions/common/value_builder_unittest.cc ('k') | extensions/common/value_counter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_COMMON_VALUE_COUNTER_H_ 5 #ifndef EXTENSIONS_COMMON_VALUE_COUNTER_H_
6 #define EXTENSIONS_COMMON_VALUE_COUNTER_H_ 6 #define EXTENSIONS_COMMON_VALUE_COUNTER_H_
7 7
8 #include <memory>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 12
13 namespace base { 13 namespace base {
14 class Value; 14 class Value;
15 } 15 }
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 // Keeps a running count of Values, like map<Value, int>. Adding/removing 19 // Keeps a running count of Values, like map<Value, int>. Adding/removing
20 // values increments/decrements the count associated with a given Value. 20 // values increments/decrements the count associated with a given Value.
21 // 21 //
(...skipping 13 matching lines...) Expand all
35 // Removes |value| from the set, and returns true if it removed the last 35 // Removes |value| from the set, and returns true if it removed the last
36 // value equal to |value|. If there are more equal values, or if there 36 // value equal to |value|. If there are more equal values, or if there
37 // weren't any in the first place, returns false. 37 // weren't any in the first place, returns false.
38 bool Remove(const base::Value& value); 38 bool Remove(const base::Value& value);
39 39
40 // Returns true if there are no values of any type being counted. 40 // Returns true if there are no values of any type being counted.
41 bool is_empty() const { return entries_.empty(); } 41 bool is_empty() const { return entries_.empty(); }
42 42
43 private: 43 private:
44 struct Entry; 44 struct Entry;
45 std::vector<scoped_ptr<Entry>> entries_; 45 std::vector<std::unique_ptr<Entry>> entries_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(ValueCounter); 47 DISALLOW_COPY_AND_ASSIGN(ValueCounter);
48 }; 48 };
49 49
50 } // namespace extensions 50 } // namespace extensions
51 51
52 #endif // EXTENSIONS_COMMON_VALUE_COUNTER_H_ 52 #endif // EXTENSIONS_COMMON_VALUE_COUNTER_H_
OLDNEW
« no previous file with comments | « extensions/common/value_builder_unittest.cc ('k') | extensions/common/value_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698