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

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

Issue 14299011: Remove all but one use of WeakPtrFactory::DetachFromThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove checks for death with correct error, which seem to fail on iOS 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/memory/weak_ptr_unittest.cc ('k') | chrome/browser/io_thread.cc » ('j') | 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_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
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 base::Passed(&value))); 395 base::Passed(&value)));
399 396
400 waiting_for_extensions_.erase(extension_id); 397 waiting_for_extensions_.erase(extension_id);
401 398
402 if (waiting_for_extensions_.empty()) 399 if (waiting_for_extensions_.empty())
403 ExtensionSystem::Get(profile_)->ready().Post( 400 ExtensionSystem::Get(profile_)->ready().Post(
404 FROM_HERE, base::Bind(&RuleStorageOnUI::CheckIfReady, GetWeakPtr())); 401 FROM_HERE, base::Bind(&RuleStorageOnUI::CheckIfReady, GetWeakPtr()));
405 } 402 }
406 403
407 } // namespace extensions 404 } // namespace extensions
OLDNEW
« no previous file with comments | « base/memory/weak_ptr_unittest.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698