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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 *storage_area_id = result[1]; | 51 *storage_area_id = result[1]; |
52 } | 52 } |
53 | 53 |
54 LocalStorageCachedArea::LocalStorageCachedArea( | 54 LocalStorageCachedArea::LocalStorageCachedArea( |
55 const url::Origin& origin, | 55 const url::Origin& origin, |
56 mojom::StoragePartitionService* storage_partition_service, | 56 mojom::StoragePartitionService* storage_partition_service, |
57 LocalStorageCachedAreas* cached_areas) | 57 LocalStorageCachedAreas* cached_areas) |
58 : origin_(origin), binding_(this), | 58 : origin_(origin), binding_(this), |
59 cached_areas_(cached_areas), weak_factory_(this) { | 59 cached_areas_(cached_areas), weak_factory_(this) { |
60 storage_partition_service->OpenLocalStorage( | 60 storage_partition_service->OpenLocalStorage( |
61 origin_, binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&leveldb_)); | 61 origin_, binding_.CreateInterfacePtrAndBind(), |
| 62 mojo::MakeRequest(&leveldb_)); |
62 } | 63 } |
63 | 64 |
64 LocalStorageCachedArea::~LocalStorageCachedArea() { | 65 LocalStorageCachedArea::~LocalStorageCachedArea() { |
65 cached_areas_->CacheAreaClosed(this); | 66 cached_areas_->CacheAreaClosed(this); |
66 } | 67 } |
67 | 68 |
68 unsigned LocalStorageCachedArea::GetLength() { | 69 unsigned LocalStorageCachedArea::GetLength() { |
69 EnsureLoaded(); | 70 EnsureLoaded(); |
70 return map_->Length(); | 71 return map_->Length(); |
71 } | 72 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 335 } |
335 | 336 |
336 void LocalStorageCachedArea::Reset() { | 337 void LocalStorageCachedArea::Reset() { |
337 map_ = NULL; | 338 map_ = NULL; |
338 ignore_key_mutations_.clear(); | 339 ignore_key_mutations_.clear(); |
339 ignore_all_mutations_ = false; | 340 ignore_all_mutations_ = false; |
340 weak_factory_.InvalidateWeakPtrs(); | 341 weak_factory_.InvalidateWeakPtrs(); |
341 } | 342 } |
342 | 343 |
343 } // namespace content | 344 } // namespace content |
OLD | NEW |