Chromium Code Reviews| Index: content/browser/dom_storage/dom_storage_context_wrapper.cc |
| diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc |
| index 1a18095a5c5e08ee83efddfdefa2667a023070a6..7d0607d6fd9c1ff8f6c5fbbdcfa831af66e8db03 100644 |
| --- a/content/browser/dom_storage/dom_storage_context_wrapper.cc |
| +++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc |
| @@ -104,8 +104,8 @@ DOMStorageContextWrapper::DOMStorageContextWrapper( |
| new DOMStorageWorkerPoolTaskRunner(std::move(primary_sequence), |
| std::move(commit_sequence))); |
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kMojoLocalStorage)) { |
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kDisableMojoLocalStorage)) { |
| base::FilePath storage_dir; |
| if (!profile_path.empty()) |
| storage_dir = local_partition_path.AppendASCII(kLocalStorageDirectory); |
| @@ -271,7 +271,7 @@ void DOMStorageContextWrapper::Shutdown() { |
| if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); |
| } |
| - |
| + context_ = nullptr; |
|
michaeln
2017/05/26 19:12:44
this might turn up some crashes in odd cases where
Marijn Kruisselbrink
2017/05/26 23:43:02
attempting to post tasks to the TaskScheduler (as
michaeln
2017/05/27 01:59:03
calling contextwrapper methods after shutdown used
|
| } |
| void DOMStorageContextWrapper::Flush() { |
| @@ -306,6 +306,13 @@ void DOMStorageContextWrapper::OpenLocalStorage( |
| std::move(request))); |
| } |
| +leveldb::mojom::LevelDBDatabaseAssociatedRequest |
| +DOMStorageContextWrapper::LocalStorageDatabaseRequestForTesting() { |
| + if (!mojo_state_) |
| + return nullptr; |
| + return mojo_state_->DatabaseRequestForTesting(); |
| +} |
| + |
| void DOMStorageContextWrapper::OnMemoryPressure( |
| base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
| DOMStorageContextImpl::PurgeOption purge_option = |
| @@ -341,6 +348,9 @@ void DOMStorageContextWrapper::GotMojoLocalStorageUsage( |
| GetLocalStorageUsageCallback callback, |
| base::SingleThreadTaskRunner* reply_task_runner, |
| std::vector<LocalStorageUsageInfo> usage) { |
| + // If we were shutdown in the meantime, just give up. |
| + if (!context_) |
|
michaeln
2017/05/26 19:12:44
we might need more early outs like this to protect
Marijn Kruisselbrink
2017/05/26 23:43:02
every other usage (other than the one in PurgeMemo
michaeln
2017/05/27 01:59:03
The dchecks were to document it's non-nullness and
Marijn Kruisselbrink
2017/05/30 20:53:55
I agree that the current CL is somewhat scare in t
|
| + return; |
| context_->task_runner()->PostShutdownBlockingTask( |
| FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE, |
| base::Bind(&GetLocalStorageUsageHelper, base::Passed(&usage), |