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

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

Issue 16007009: Remove all but one use of WeakPtrFactory::DetachFromThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify SGIVideoSyncProviderThreadShim ownership, removing unnecessary use of SupportsWeakPtr. Created 7 years, 6 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 log_storage_init_delay)) 91 log_storage_init_delay))
92 ->GetWeakPtr() 92 ->GetWeakPtr()
93 : base::WeakPtr<RuleStorageOnUI>())) { 93 : base::WeakPtr<RuleStorageOnUI>())) {
94 if (!profile) { 94 if (!profile) {
95 CHECK(!ui_part); 95 CHECK(!ui_part);
96 return; 96 return;
97 } 97 }
98 98
99 ui_part->reset(storage_on_ui_.get()); 99 ui_part->reset(storage_on_ui_.get());
100 100
101 // After construction, |this| continues to live only on |owner_thread|.
102 weak_ptr_factory_.DetachFromThread();
103
104 storage_on_ui_->Init(); 101 storage_on_ui_->Init();
105 } 102 }
106 103
107 std::string RulesRegistryWithCache::AddRules( 104 std::string RulesRegistryWithCache::AddRules(
108 const std::string& extension_id, 105 const std::string& extension_id,
109 const std::vector<linked_ptr<Rule> >& rules) { 106 const std::vector<linked_ptr<Rule> >& rules) {
110 DCHECK(content::BrowserThread::CurrentlyOn(owner_thread())); 107 DCHECK(content::BrowserThread::CurrentlyOn(owner_thread()));
111 108
112 // Verify that all rule IDs are new. 109 // Verify that all rule IDs are new.
113 for (std::vector<linked_ptr<Rule> >::const_iterator i = 110 for (std::vector<linked_ptr<Rule> >::const_iterator i =
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 void RulesRegistryWithCache::RuleStorageOnUI::SetDeclarativeRulesStored( 428 void RulesRegistryWithCache::RuleStorageOnUI::SetDeclarativeRulesStored(
432 const std::string& extension_id, 429 const std::string& extension_id,
433 bool rules_stored) { 430 bool rules_stored) {
434 CHECK(profile_); 431 CHECK(profile_);
435 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_); 432 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_);
436 extension_prefs->UpdateExtensionPref( 433 extension_prefs->UpdateExtensionPref(
437 extension_id, kRulesStoredKey, new base::FundamentalValue(rules_stored)); 434 extension_id, kRulesStoredKey, new base::FundamentalValue(rules_stored));
438 } 435 }
439 436
440 } // namespace extensions 437 } // 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