| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/renderer/dom_storage/local_storage_cached_areas.h" | 5 #include "content/renderer/dom_storage/local_storage_cached_areas.h" |
| 6 | 6 |
| 7 #include "content/renderer/dom_storage/local_storage_cached_area.h" | 7 #include "content/renderer/dom_storage/local_storage_cached_area.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 LocalStorageCachedAreas::LocalStorageCachedAreas( | 11 LocalStorageCachedAreas::LocalStorageCachedAreas( |
| 12 StoragePartitionService* storage_partition_service) | 12 mojom::StoragePartitionService* storage_partition_service) |
| 13 : storage_partition_service_(storage_partition_service) { | 13 : storage_partition_service_(storage_partition_service) {} |
| 14 } | |
| 15 | 14 |
| 16 LocalStorageCachedAreas::~LocalStorageCachedAreas() { | 15 LocalStorageCachedAreas::~LocalStorageCachedAreas() { |
| 17 } | 16 } |
| 18 | 17 |
| 19 scoped_refptr<LocalStorageCachedArea> LocalStorageCachedAreas::GetCachedArea( | 18 scoped_refptr<LocalStorageCachedArea> LocalStorageCachedAreas::GetCachedArea( |
| 20 const url::Origin& origin) { | 19 const url::Origin& origin) { |
| 21 if (cached_areas_.find(origin) == cached_areas_.end()) { | 20 if (cached_areas_.find(origin) == cached_areas_.end()) { |
| 22 cached_areas_[origin] = new LocalStorageCachedArea( | 21 cached_areas_[origin] = new LocalStorageCachedArea( |
| 23 origin, storage_partition_service_, this); | 22 origin, storage_partition_service_, this); |
| 24 } | 23 } |
| 25 | 24 |
| 26 return make_scoped_refptr(cached_areas_[origin]); | 25 return make_scoped_refptr(cached_areas_[origin]); |
| 27 } | 26 } |
| 28 | 27 |
| 29 void LocalStorageCachedAreas::CacheAreaClosed( | 28 void LocalStorageCachedAreas::CacheAreaClosed( |
| 30 LocalStorageCachedArea* cached_area) { | 29 LocalStorageCachedArea* cached_area) { |
| 31 DCHECK(cached_areas_.find(cached_area->origin()) != cached_areas_.end()); | 30 DCHECK(cached_areas_.find(cached_area->origin()) != cached_areas_.end()); |
| 32 cached_areas_.erase(cached_area->origin()); | 31 cached_areas_.erase(cached_area->origin()); |
| 33 } | 32 } |
| 34 | 33 |
| 35 } // namespace content | 34 } // namespace content |
| OLD | NEW |