OLD | NEW |
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_with_cache.h" | 5 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.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.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 log_storage_init_delay)) | 90 log_storage_init_delay)) |
91 ->GetWeakPtr() | 91 ->GetWeakPtr() |
92 : base::WeakPtr<RuleStorageOnUI>())) { | 92 : base::WeakPtr<RuleStorageOnUI>())) { |
93 if (!profile) { | 93 if (!profile) { |
94 CHECK(!ui_part); | 94 CHECK(!ui_part); |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 ui_part->reset(storage_on_ui_.get()); | 98 ui_part->reset(storage_on_ui_.get()); |
99 | 99 |
100 // After construction, |this| continues to live only on |owner_thread|. | |
101 weak_ptr_factory_.DetachFromThread(); | |
102 | |
103 storage_on_ui_->Init(); | 100 storage_on_ui_->Init(); |
104 } | 101 } |
105 | 102 |
106 void RulesRegistryWithCache::AddReadyCallback(const base::Closure& callback) { | 103 void RulesRegistryWithCache::AddReadyCallback(const base::Closure& callback) { |
107 ready_callbacks_.push_back(callback); | 104 ready_callbacks_.push_back(callback); |
108 } | 105 } |
109 | 106 |
110 std::string RulesRegistryWithCache::AddRules( | 107 std::string RulesRegistryWithCache::AddRules( |
111 const std::string& extension_id, | 108 const std::string& extension_id, |
112 const std::vector<linked_ptr<Rule> >& rules) { | 109 const std::vector<linked_ptr<Rule> >& rules) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 registry_, | 404 registry_, |
408 extension_id, | 405 extension_id, |
409 base::Passed(&value))); | 406 base::Passed(&value))); |
410 | 407 |
411 waiting_for_extensions_.erase(extension_id); | 408 waiting_for_extensions_.erase(extension_id); |
412 | 409 |
413 CheckIfReady(); | 410 CheckIfReady(); |
414 } | 411 } |
415 | 412 |
416 } // namespace extensions | 413 } // namespace extensions |
OLD | NEW |