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

Unified Diff: trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc

Issue 15647003: Revert 202152 "RulesRegistryWithCache::ProcessChangedRules speed-up" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc
===================================================================
--- trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc (revision 202340)
+++ trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc (working copy)
@@ -44,7 +44,6 @@
if (!value || !value->GetAsList(&list))
return rules;
- rules.reserve(list->GetSize());
for (size_t i = 0; i < list->GetSize(); ++i) {
const base::DictionaryValue* dict = NULL;
if (!list->GetDictionary(i, &dict))
@@ -81,7 +80,7 @@
bool log_storage_init_delay,
scoped_ptr<RuleStorageOnUI>* ui_part)
: RulesRegistry(owner_thread, event_name),
- weak_ptr_factory_(this),
+ weak_ptr_factory_((profile) ? this : NULL),
storage_on_ui_((profile
? (new RuleStorageOnUI(profile,
GetDeclarativeRuleStorageKey(
@@ -91,8 +90,7 @@
weak_ptr_factory_.GetWeakPtr(),
log_storage_init_delay))
->GetWeakPtr()
- : base::WeakPtr<RuleStorageOnUI>())),
- process_changed_rules_requested_(false) {
+ : base::WeakPtr<RuleStorageOnUI>())) {
if (!profile) {
CHECK(!ui_part);
return;
@@ -133,13 +131,7 @@
rules_[key] = *i;
}
- if (!process_changed_rules_requested_) {
- process_changed_rules_requested_ = true;
- ready_.Post(FROM_HERE,
- base::Bind(&RulesRegistryWithCache::ProcessChangedRules,
- weak_ptr_factory_.GetWeakPtr(),
- extension_id));
- }
+ ProcessChangedRules(extension_id);
return kSuccess;
}
@@ -160,13 +152,7 @@
rules_.erase(lookup_key);
}
- if (!process_changed_rules_requested_) {
- process_changed_rules_requested_ = true;
- ready_.Post(FROM_HERE,
- base::Bind(&RulesRegistryWithCache::ProcessChangedRules,
- weak_ptr_factory_.GetWeakPtr(),
- extension_id));
- }
+ ProcessChangedRules(extension_id);
return kSuccess;
}
@@ -188,13 +174,7 @@
rules_.erase(key);
}
- if (!process_changed_rules_requested_) {
- process_changed_rules_requested_ = true;
- ready_.Post(FROM_HERE,
- base::Bind(&RulesRegistryWithCache::ProcessChangedRules,
- weak_ptr_factory_.GetWeakPtr(),
- extension_id));
- }
+ ProcessChangedRules(extension_id);
return kSuccess;
}
@@ -262,8 +242,6 @@
const std::string& extension_id) {
DCHECK(content::BrowserThread::CurrentlyOn(owner_thread()));
- process_changed_rules_requested_ = false;
-
std::vector<linked_ptr<RulesRegistry::Rule> > new_rules;
std::string error = GetAllRules(extension_id, &new_rules);
DCHECK_EQ(std::string(), error);
« no previous file with comments | « trunk/src/chrome/browser/extensions/api/declarative/rules_registry_with_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698