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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc

Issue 10824339: Attempt to fix a crash in RulesRegistryStorageDelegate on shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc b/chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc
index 41e51a191375ad319258cf57c5fe32b625d9982a..f256a9cf03008a3e34c18d5ba6d316cfea0a0343 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc
@@ -141,6 +141,7 @@ void RulesRegistryStorageDelegate::InitOnUIThread(
void RulesRegistryStorageDelegate::CleanupOnUIThread() {
// The registrar must be deleted on the UI thread.
inner_->registrar_.reset();
+ inner_->profile_ = NULL; // no longer safe to use.
}
bool RulesRegistryStorageDelegate::IsReady() {
@@ -229,6 +230,9 @@ void RulesRegistryStorageDelegate::Inner::Observe(
void RulesRegistryStorageDelegate::Inner::ReadFromStorage(
const std::string& extension_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ if (!profile_)
+ return;
+
extensions::StateStore* store = ExtensionSystem::Get(profile_)->state_store();
if (store) {
waiting_for_extensions_.insert(extension_id);
@@ -252,6 +256,9 @@ void RulesRegistryStorageDelegate::Inner::ReadFromStorageCallback(
void RulesRegistryStorageDelegate::Inner::WriteToStorage(
const std::string& extension_id, scoped_ptr<base::Value> value) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ if (!profile_)
+ return;
+
StateStore* store = ExtensionSystem::Get(profile_)->state_store();
if (store)
store->SetExtensionValue(extension_id, storage_key_, value.Pass());
« 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