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

Side by Side Diff: extensions/browser/api/declarative/rules_registry_service.h

Issue 1461163002: Use std::tie() for operator< in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | extensions/browser/event_router.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <tuple>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/scoped_observer.h" 16 #include "base/scoped_observer.h"
16 #include "extensions/browser/api/declarative/rules_registry.h" 17 #include "extensions/browser/api/declarative/rules_registry.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 18 #include "extensions/browser/browser_context_keyed_api_factory.h"
18 #include "extensions/browser/extension_registry_observer.h" 19 #include "extensions/browser/extension_registry_observer.h"
19 20
(...skipping 16 matching lines...) Expand all
36 public: 37 public:
37 static const int kDefaultRulesRegistryID; 38 static const int kDefaultRulesRegistryID;
38 static const int kInvalidRulesRegistryID; 39 static const int kInvalidRulesRegistryID;
39 40
40 struct RulesRegistryKey { 41 struct RulesRegistryKey {
41 std::string event_name; 42 std::string event_name;
42 int rules_registry_id; 43 int rules_registry_id;
43 RulesRegistryKey(const std::string& event_name, int rules_registry_id) 44 RulesRegistryKey(const std::string& event_name, int rules_registry_id)
44 : event_name(event_name), rules_registry_id(rules_registry_id) {} 45 : event_name(event_name), rules_registry_id(rules_registry_id) {}
45 bool operator<(const RulesRegistryKey& other) const { 46 bool operator<(const RulesRegistryKey& other) const {
46 return (event_name < other.event_name) || 47 return std::tie(event_name, rules_registry_id) <
47 ((event_name == other.event_name) && 48 std::tie(other.event_name, other.rules_registry_id);
48 (rules_registry_id < other.rules_registry_id));
49 } 49 }
50 }; 50 };
51 51
52 explicit RulesRegistryService(content::BrowserContext* context); 52 explicit RulesRegistryService(content::BrowserContext* context);
53 ~RulesRegistryService() override; 53 ~RulesRegistryService() override;
54 54
55 // Unregisters refptrs to concrete RulesRegistries at other objects that were 55 // Unregisters refptrs to concrete RulesRegistries at other objects that were
56 // created by us so that the RulesRegistries can be released. 56 // created by us so that the RulesRegistries can be released.
57 void Shutdown() override; 57 void Shutdown() override;
58 58
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 extension_registry_observer_; 144 extension_registry_observer_;
145 145
146 content::BrowserContext* browser_context_; 146 content::BrowserContext* browser_context_;
147 147
148 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); 148 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService);
149 }; 149 };
150 150
151 } // namespace extensions 151 } // namespace extensions
152 152
153 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 153 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698