OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webstoragearea_impl.h" | 5 #include "content/renderer/dom_storage/webstoragearea_impl.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 WebStorageAreaImpl::WebStorageAreaImpl( | 38 WebStorageAreaImpl::WebStorageAreaImpl( |
39 int64 namespace_id, const GURL& origin) | 39 int64 namespace_id, const GURL& origin) |
40 : connection_id_(g_all_areas_map.Pointer()->Add(this)), | 40 : connection_id_(g_all_areas_map.Pointer()->Add(this)), |
41 cached_area_(dispatcher()-> | 41 cached_area_(dispatcher()-> |
42 OpenCachedArea(connection_id_, namespace_id, origin)) { | 42 OpenCachedArea(connection_id_, namespace_id, origin)) { |
43 } | 43 } |
44 | 44 |
45 WebStorageAreaImpl::~WebStorageAreaImpl() { | 45 WebStorageAreaImpl::~WebStorageAreaImpl() { |
46 g_all_areas_map.Pointer()->Remove(connection_id_); | 46 g_all_areas_map.Pointer()->Remove(connection_id_); |
47 if (dispatcher()) | 47 if (dispatcher()) |
48 dispatcher()->CloseCachedArea(connection_id_, cached_area_); | 48 dispatcher()->CloseCachedArea(connection_id_, cached_area_.get()); |
49 } | 49 } |
50 | 50 |
51 unsigned WebStorageAreaImpl::length() { | 51 unsigned WebStorageAreaImpl::length() { |
52 return cached_area_->GetLength(connection_id_); | 52 return cached_area_->GetLength(connection_id_); |
53 } | 53 } |
54 | 54 |
55 WebString WebStorageAreaImpl::key(unsigned index) { | 55 WebString WebStorageAreaImpl::key(unsigned index) { |
56 return cached_area_->GetKey(connection_id_, index); | 56 return cached_area_->GetKey(connection_id_, index); |
57 } | 57 } |
58 | 58 |
(...skipping 17 matching lines...) Expand all Loading... |
76 | 76 |
77 void WebStorageAreaImpl::clear(const WebURL& page_url) { | 77 void WebStorageAreaImpl::clear(const WebURL& page_url) { |
78 cached_area_->Clear(connection_id_, page_url); | 78 cached_area_->Clear(connection_id_, page_url); |
79 } | 79 } |
80 | 80 |
81 size_t WebStorageAreaImpl::memoryBytesUsedByCache() const { | 81 size_t WebStorageAreaImpl::memoryBytesUsedByCache() const { |
82 return cached_area_->MemoryBytesUsedByCache(); | 82 return cached_area_->MemoryBytesUsedByCache(); |
83 } | 83 } |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
OLD | NEW |