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

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

Issue 57933002: Declarative API: Signal RulesRegister ready on correct thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | 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 #include "chrome/browser/extensions/api/declarative/rules_registry.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry.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 "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 owner_thread_(owner_thread), 80 owner_thread_(owner_thread),
81 event_name_(event_name), 81 event_name_(event_name),
82 weak_ptr_factory_(profile ? this : NULL), 82 weak_ptr_factory_(profile ? this : NULL),
83 process_changed_rules_requested_(profile ? NOT_SCHEDULED_FOR_PROCESSING 83 process_changed_rules_requested_(profile ? NOT_SCHEDULED_FOR_PROCESSING
84 : NEVER_PROCESS), 84 : NEVER_PROCESS),
85 last_generated_rule_identifier_id_(0) { 85 last_generated_rule_identifier_id_(0) {
86 if (cache_delegate) { 86 if (cache_delegate) {
87 cache_delegate_ = cache_delegate->GetWeakPtr(); 87 cache_delegate_ = cache_delegate->GetWeakPtr();
88 cache_delegate->Init(this); 88 cache_delegate->Init(this);
89 } else { 89 } else {
90 ready_.Signal(); 90 content::BrowserThread::PostTask(
91 owner_thread,
92 FROM_HERE,
93 base::Bind(&RulesRegistry::MarkReady, this, base::Time::Now()));
91 } 94 }
92 } 95 }
93 96
94 std::string RulesRegistry::AddRules( 97 std::string RulesRegistry::AddRules(
95 const std::string& extension_id, 98 const std::string& extension_id,
96 const std::vector<linked_ptr<Rule> >& rules) { 99 const std::vector<linked_ptr<Rule> >& rules) {
97 DCHECK(content::BrowserThread::CurrentlyOn(owner_thread())); 100 DCHECK(content::BrowserThread::CurrentlyOn(owner_thread()));
98 101
99 std::string error = CheckAndFillInOptionalRules(extension_id, rules); 102 std::string error = CheckAndFillInOptionalRules(extension_id, rules);
100 if (!error.empty()) 103 if (!error.empty())
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 for (i = identifiers.begin(); i != identifiers.end(); ++i) 339 for (i = identifiers.begin(); i != identifiers.end(); ++i)
337 used_rule_identifiers_[extension_id].erase(*i); 340 used_rule_identifiers_[extension_id].erase(*i);
338 } 341 }
339 342
340 void RulesRegistry::RemoveAllUsedRuleIdentifiers( 343 void RulesRegistry::RemoveAllUsedRuleIdentifiers(
341 const std::string& extension_id) { 344 const std::string& extension_id) {
342 used_rule_identifiers_.erase(extension_id); 345 used_rule_identifiers_.erase(extension_id);
343 } 346 }
344 347
345 } // namespace extensions 348 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698