| Index: content/browser/service_worker/service_worker_internals_ui.cc
|
| diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc
|
| index f4b224985edcab3ec512477600e93983aef7d1b6..5ec763d2a6f4f5b468ca79df6ce0f3ab0053e162 100644
|
| --- a/content/browser/service_worker/service_worker_internals_ui.cc
|
| +++ b/content/browser/service_worker/service_worker_internals_ui.cc
|
| @@ -433,16 +433,16 @@ void ServiceWorkerInternalsUI::AddContextFromStoragePartition(
|
| scoped_refptr<ServiceWorkerContextWrapper> context =
|
| static_cast<ServiceWorkerContextWrapper*>(
|
| partition->GetServiceWorkerContext());
|
| - if (PartitionObserver* observer =
|
| - observers_.get(reinterpret_cast<uintptr_t>(partition))) {
|
| - partition_id = observer->partition_id();
|
| + auto it = observers_.find(reinterpret_cast<uintptr_t>(partition));
|
| + if (it != observers_.end()) {
|
| + partition_id = it->second->partition_id();
|
| } else {
|
| partition_id = next_partition_id_++;
|
| std::unique_ptr<PartitionObserver> new_observer(
|
| new PartitionObserver(partition_id, web_ui()));
|
| context->AddObserver(new_observer.get());
|
| - observers_.set(reinterpret_cast<uintptr_t>(partition),
|
| - std::move(new_observer));
|
| + observers_[reinterpret_cast<uintptr_t>(partition)] =
|
| + std::move(new_observer);
|
| }
|
|
|
| BrowserThread::PostTask(
|
| @@ -455,10 +455,11 @@ void ServiceWorkerInternalsUI::AddContextFromStoragePartition(
|
|
|
| void ServiceWorkerInternalsUI::RemoveObserverFromStoragePartition(
|
| StoragePartition* partition) {
|
| - std::unique_ptr<PartitionObserver> observer(
|
| - observers_.take_and_erase(reinterpret_cast<uintptr_t>(partition)));
|
| - if (!observer.get())
|
| + auto it = observers_.find(reinterpret_cast<uintptr_t>(partition));
|
| + if (it == observers_.end())
|
| return;
|
| + std::unique_ptr<PartitionObserver> observer = std::move(it->second);
|
| + observers_.erase(it);
|
| scoped_refptr<ServiceWorkerContextWrapper> context =
|
| static_cast<ServiceWorkerContextWrapper*>(
|
| partition->GetServiceWorkerContext());
|
| @@ -469,9 +470,8 @@ void ServiceWorkerInternalsUI::FindContext(
|
| int partition_id,
|
| StoragePartition** result_partition,
|
| StoragePartition* storage_partition) const {
|
| - PartitionObserver* observer =
|
| - observers_.get(reinterpret_cast<uintptr_t>(storage_partition));
|
| - if (observer && partition_id == observer->partition_id()) {
|
| + auto it = observers_.find(reinterpret_cast<uintptr_t>(storage_partition));
|
| + if (it != observers_.end() && partition_id == it->second->partition_id()) {
|
| *result_partition = storage_partition;
|
| }
|
| }
|
|
|