| 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_area.h" | 5 #include "content/renderer/dom_storage/local_storage_cached_area.h" |
| 6 | 6 |
| 7 #include "content/common/storage_partition_service.mojom.h" | 7 #include "content/common/storage_partition_service.mojom.h" |
| 8 #include "content/renderer/dom_storage/local_storage_cached_areas.h" | 8 #include "content/renderer/dom_storage/local_storage_cached_areas.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 LocalStorageCachedArea::LocalStorageCachedArea( | 12 LocalStorageCachedArea::LocalStorageCachedArea( |
| 13 const url::Origin& origin, | 13 const url::Origin& origin, |
| 14 StoragePartitionService* storage_partition_service, | 14 StoragePartitionService* storage_partition_service, |
| 15 LocalStorageCachedAreas* cached_areas) | 15 LocalStorageCachedAreas* cached_areas) |
| 16 : loaded_(false), origin_(origin), binding_(this), | 16 : loaded_(false), origin_(origin), binding_(this), |
| 17 cached_areas_(cached_areas) { | 17 cached_areas_(cached_areas) { |
| 18 storage_partition_service->OpenLocalStorage( | 18 storage_partition_service->OpenLocalStorage( |
| 19 origin_.Serialize(), mojo::GetProxy(&leveldb_)); | 19 origin_, mojo::GetProxy(&leveldb_)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 LocalStorageCachedArea::~LocalStorageCachedArea() { | 22 LocalStorageCachedArea::~LocalStorageCachedArea() { |
| 23 cached_areas_->LocalStorageCacheAreaClosed(this); | 23 cached_areas_->LocalStorageCacheAreaClosed(this); |
| 24 } | 24 } |
| 25 | 25 |
| 26 unsigned LocalStorageCachedArea::GetLength() { | 26 unsigned LocalStorageCachedArea::GetLength() { |
| 27 EnsureLoaded(); | 27 EnsureLoaded(); |
| 28 return 0u; | 28 return 0u; |
| 29 } | 29 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (loaded_) | 76 if (loaded_) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 loaded_ = true; | 79 loaded_ = true; |
| 80 leveldb::DatabaseError status = leveldb::DatabaseError::OK; | 80 leveldb::DatabaseError status = leveldb::DatabaseError::OK; |
| 81 mojo::Array<content::KeyValuePtr> data; | 81 mojo::Array<content::KeyValuePtr> data; |
| 82 leveldb_->GetAll(binding_.CreateInterfacePtrAndBind(), &status, &data); | 82 leveldb_->GetAll(binding_.CreateInterfacePtrAndBind(), &status, &data); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace content | 85 } // namespace content |
| OLD | NEW |