| 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 StoragePartitionService* storage_partition_service) |
| 13 : storage_partition_service_(storage_partition_service) { | 13 : storage_partition_service_(storage_partition_service) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 LocalStorageCachedAreas::~LocalStorageCachedAreas() { | 16 LocalStorageCachedAreas::~LocalStorageCachedAreas() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 scoped_refptr<LocalStorageCachedArea> | 19 scoped_refptr<LocalStorageCachedArea> LocalStorageCachedAreas::GetCachedArea( |
| 20 LocalStorageCachedAreas::GetLocalStorageCachedArea( | |
| 21 const url::Origin& origin) { | 20 const url::Origin& origin) { |
| 22 if (cached_areas_.find(origin) == cached_areas_.end()) { | 21 if (cached_areas_.find(origin) == cached_areas_.end()) { |
| 23 cached_areas_[origin] = new LocalStorageCachedArea( | 22 cached_areas_[origin] = new LocalStorageCachedArea( |
| 24 origin, storage_partition_service_, this); | 23 origin, storage_partition_service_, this); |
| 25 } | 24 } |
| 26 | 25 |
| 27 return make_scoped_refptr(cached_areas_[origin]); | 26 return make_scoped_refptr(cached_areas_[origin]); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void LocalStorageCachedAreas::LocalStorageCacheAreaClosed( | 29 void LocalStorageCachedAreas::CacheAreaClosed( |
| 31 LocalStorageCachedArea* cached_area) { | 30 LocalStorageCachedArea* cached_area) { |
| 32 DCHECK(cached_areas_.find(cached_area->origin()) != cached_areas_.end()); | 31 DCHECK(cached_areas_.find(cached_area->origin()) != cached_areas_.end()); |
| 33 cached_areas_.erase(cached_area->origin()); | 32 cached_areas_.erase(cached_area->origin()); |
| 34 } | 33 } |
| 35 | 34 |
| 36 } // namespace content | 35 } // namespace content |
| OLD | NEW |