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

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_service.cc

Issue 10076001: Fix memory leak caused by Rules Registries (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "chrome/browser/extensions/api/declarative/initializing_rules_registry. h" 10 #include "chrome/browser/extensions/api/declarative/initializing_rules_registry. h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry( 42 scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry(
43 new WebRequestRulesRegistry); 43 new WebRequestRulesRegistry);
44 RegisterRulesRegistry(declarative_webrequest_constants::kOnRequest, 44 RegisterRulesRegistry(declarative_webrequest_constants::kOnRequest,
45 web_request_rules_registry); 45 web_request_rules_registry);
46 content::BrowserThread::PostTask( 46 content::BrowserThread::PostTask(
47 content::BrowserThread::IO, FROM_HERE, 47 content::BrowserThread::IO, FROM_HERE,
48 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, 48 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
49 web_request_rules_registry)); 49 web_request_rules_registry));
50 } 50 }
51 51
52 void RulesRegistryService::Shutdown() {
53 content::BrowserThread::PostTask(
54 content::BrowserThread::IO, FROM_HERE,
55 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
56 scoped_refptr<WebRequestRulesRegistry>(NULL)));
57 }
58
52 void RulesRegistryService::RegisterRulesRegistry( 59 void RulesRegistryService::RegisterRulesRegistry(
53 const std::string& event_name, 60 const std::string& event_name,
54 scoped_refptr<RulesRegistry> rule_registry) { 61 scoped_refptr<RulesRegistry> rule_registry) {
55 DCHECK(rule_registries_.find(event_name) == rule_registries_.end()); 62 DCHECK(rule_registries_.find(event_name) == rule_registries_.end());
56 rule_registries_[event_name] = 63 rule_registries_[event_name] =
57 make_scoped_refptr(new InitializingRulesRegistry(rule_registry)); 64 make_scoped_refptr(new InitializingRulesRegistry(rule_registry));
58 } 65 }
59 66
60 scoped_refptr<RulesRegistry> RulesRegistryService::GetRulesRegistry( 67 scoped_refptr<RulesRegistry> RulesRegistryService::GetRulesRegistry(
61 const std::string& event_name) const { 68 const std::string& event_name) const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 OnExtensionUnloaded(extension->id()); 104 OnExtensionUnloaded(extension->id());
98 break; 105 break;
99 } 106 }
100 default: 107 default:
101 NOTREACHED(); 108 NOTREACHED();
102 break; 109 break;
103 } 110 }
104 } 111 }
105 112
106 } // namespace extensions 113 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698