OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer_webstoragenamespace_impl.h" | 5 #include "content/renderer/renderer_webstoragenamespace_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/renderer_webstoragearea_impl.h" | 8 #include "content/renderer/renderer_webstoragearea_impl.h" |
9 #include "webkit/dom_storage/dom_storage_types.h" | 9 #include "webkit/dom_storage/dom_storage_types.h" |
10 | 10 |
11 using WebKit::WebStorageArea; | 11 using WebKit::WebStorageArea; |
12 using WebKit::WebStorageNamespace; | 12 using WebKit::WebStorageNamespace; |
13 using WebKit::WebString; | 13 using WebKit::WebString; |
14 | 14 |
15 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl() | 15 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl() |
16 : namespace_id_(dom_storage::kLocalStorageNamespaceId) { | 16 : namespace_id_(dom_storage::kLocalStorageNamespaceId) { |
17 } | 17 } |
18 | 18 |
19 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( | 19 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( |
20 int64 namespace_id) | 20 int64 namespace_id) |
21 : namespace_id_(namespace_id) { | 21 : namespace_id_(namespace_id) { |
22 DCHECK_NE(dom_storage::kInvalidSessionStorageNamespaceId, namespace_id); | 22 DCHECK_NE(dom_storage::kInvalidSessionStorageNamespaceId, namespace_id); |
23 } | 23 } |
24 | 24 |
25 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { | 25 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { |
26 } | 26 } |
27 | 27 |
28 WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea( | 28 WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea( |
29 const WebString& origin) { | 29 const WebString& origin) { |
30 // Ideally, we'd keep a hash map of origin to these objects. Unfortunately | |
ericu
2012/04/25 19:40:35
Is this comment obsolete? Or is it just that it's
michaeln
2012/04/25 20:22:12
Yes and yes.
Obsolete. I think it would be counte
| |
31 // this doesn't seem practical because there's no good way to ref-count these | |
32 // objects, and it'd be unclear who owned them. So, instead, we'll pay the | |
33 // price in terms of wasted memory. | |
34 return new RendererWebStorageAreaImpl(namespace_id_, origin); | 30 return new RendererWebStorageAreaImpl(namespace_id_, origin); |
35 } | 31 } |
36 | 32 |
37 WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { | 33 WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { |
38 // By returning NULL, we're telling WebKit to lazily fetch it the next time | 34 // By returning NULL, we're telling WebKit to lazily fetch it the next time |
39 // session storage is used. In the WebViewClient::createView, we do the | 35 // session storage is used. In the WebViewClient::createView, we do the |
40 // book-keeping necessary to make it a true copy-on-write despite not doing | 36 // book-keeping necessary to make it a true copy-on-write despite not doing |
41 // anything here, now. | 37 // anything here, now. |
42 return NULL; | 38 return NULL; |
43 } | 39 } |
44 | 40 |
45 void RendererWebStorageNamespaceImpl::close() { | 41 bool RendererWebStorageNamespaceImpl::isSameNamespace( |
46 // TOOD(michaeln): remove this deprecated method. | 42 const WebStorageNamespace& other) const { |
47 } | 43 const RendererWebStorageNamespaceImpl* other_impl = |
44 static_cast<const RendererWebStorageNamespaceImpl*>(&other); | |
45 return namespace_id_ == other_impl->namespace_id_; | |
46 } | |
OLD | NEW |