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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_service.h

Issue 9422003: Migrate Declarative API bindings to new JSON objects generated by JSON compiler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leaks Created 8 years, 10 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
Index: chrome/browser/extensions/api/declarative/rules_registry_service.h
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.h b/chrome/browser/extensions/api/declarative/rules_registry_service.h
index e14904dded50619071a58d5682014f9445a63e8b..145f62d62fe3584c07edd97a4fa84c0012fbeaf6 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.h
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h
@@ -10,8 +10,7 @@
#include <string>
#include <vector>
-#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ref_counted.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -29,6 +28,7 @@ class RulesRegistry;
namespace extensions {
// This class owns all RulesRegistries implementations of an ExtensionService.
+// This class lives on the UI thread.
class RulesRegistryService : public content::NotificationObserver {
public:
explicit RulesRegistryService(Profile* profile);
@@ -36,17 +36,22 @@ class RulesRegistryService : public content::NotificationObserver {
// Registers a RulesRegistry and wraps it in an InitializingRulesRegistry.
void RegisterRulesRegistry(const std::string& event_name,
- scoped_ptr<RulesRegistry> rule_registry);
+ scoped_refptr<RulesRegistry> rule_registry);
// Returns the RulesRegistry for |event_name| or NULL if no such registry
// has been registered.
- RulesRegistry* GetRulesRegistry(const std::string& event_name) const;
+ scoped_refptr<RulesRegistry> GetRulesRegistry(
+ const std::string& event_name) const;
+ // For testing.
+ void SimulateExtensionUnloaded(const std::string& extension_id);
private:
// Maps event names to RuleRegistries that handle these events.
- typedef std::map<std::string, linked_ptr<RulesRegistry> > RulesRegistryMap;
+ typedef std::map<std::string, scoped_refptr<RulesRegistry> > RulesRegistryMap;
// Notifies all RulesRegistries that |extension_id| was unloaded.
+ // It is not guaranteed that this notification is processed synchronously.
+ // If extensions live on another thread, the notification is posted.
void OnExtensionUnloaded(const std::string& extension_id);
// Implementation of content::NotificationObserver.

Powered by Google App Engine
This is Rietveld 408576698