| 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);
|
|
|