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

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

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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 | « device/hid/hid_service_linux.h ('k') | extensions/browser/api/hid/hid_device_manager.h » ('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_H__ 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 // Same as RemoveUsedRuleIdentifiers but operates on all rules of 254 // Same as RemoveUsedRuleIdentifiers but operates on all rules of
255 // |extension_id|. 255 // |extension_id|.
256 void RemoveAllUsedRuleIdentifiers(const std::string& extension_id); 256 void RemoveAllUsedRuleIdentifiers(const std::string& extension_id);
257 257
258 typedef std::string RuleIdentifier; 258 typedef std::string RuleIdentifier;
259 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; 259 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap;
260 RuleIdentifiersMap used_rule_identifiers_; 260 RuleIdentifiersMap used_rule_identifiers_;
261 int last_generated_rule_identifier_id_; 261 int last_generated_rule_identifier_id_;
262 262
263 // The factory needs to be declared before |cache_delegate_|, so that it can
264 // produce a pointer as a construction argument for |cache_delegate_|.
265 base::WeakPtrFactory<RulesRegistry> weak_ptr_factory_;
266
267 // |cache_delegate_| is owned by the registry service. If |cache_delegate_| is 263 // |cache_delegate_| is owned by the registry service. If |cache_delegate_| is
268 // NULL, then the storage functionality is disabled (this is used in tests). 264 // NULL, then the storage functionality is disabled (this is used in tests).
269 // This registry cannot own |cache_delegate_| because during the time after 265 // This registry cannot own |cache_delegate_| because during the time after
270 // rules registry service shuts down on UI thread, and the registry is 266 // rules registry service shuts down on UI thread, and the registry is
271 // destroyed on its thread, the use of the |cache_delegate_| would not be 267 // destroyed on its thread, the use of the |cache_delegate_| would not be
272 // safe. The registry only ever associates with one RulesCacheDelegate 268 // safe. The registry only ever associates with one RulesCacheDelegate
273 // instance. 269 // instance.
274 base::WeakPtr<RulesCacheDelegate> cache_delegate_; 270 base::WeakPtr<RulesCacheDelegate> cache_delegate_;
275 271
272 base::WeakPtrFactory<RulesRegistry> weak_ptr_factory_;
273
276 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); 274 DISALLOW_COPY_AND_ASSIGN(RulesRegistry);
277 }; 275 };
278 276
279 } // namespace extensions 277 } // namespace extensions
280 278
281 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ 279 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__
OLDNEW
« no previous file with comments | « device/hid/hid_service_linux.h ('k') | extensions/browser/api/hid/hid_device_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698