OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" | |
6 | |
7 #include "chrome/common/render_messages.h" | |
8 #include "chrome/renderer/render_thread.h" | |
9 #include "chrome/renderer/renderer_webstoragearea_impl.h" | |
10 | |
11 using WebKit::WebStorageArea; | |
12 using WebKit::WebStorageNamespace; | |
13 using WebKit::WebString; | |
14 | |
15 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( | |
16 DOMStorageType storage_type) | |
17 : storage_type_(storage_type), | |
18 namespace_id_(kLocalStorageNamespaceId) { | |
19 DCHECK(storage_type == DOM_STORAGE_LOCAL); | |
20 } | |
21 | |
22 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( | |
23 DOMStorageType storage_type, int64 namespace_id) | |
24 : storage_type_(storage_type), | |
25 namespace_id_(namespace_id) { | |
26 DCHECK(storage_type == DOM_STORAGE_SESSION); | |
27 } | |
28 | |
29 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { | |
30 } | |
31 | |
32 WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea( | |
33 const WebString& origin) { | |
34 // Ideally, we'd keep a hash map of origin to these objects. Unfortunately | |
35 // this doesn't seem practical because there's no good way to ref-count these | |
36 // objects, and it'd be unclear who owned them. So, instead, we'll pay the | |
37 // price in terms of wasted memory. | |
38 return new RendererWebStorageAreaImpl(namespace_id_, origin); | |
39 } | |
40 | |
41 WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { | |
42 // By returning NULL, we're telling WebKit to lazily fetch it the next time | |
43 // session storage is used. In the WebViewClient::createView, we do the | |
44 // book-keeping necessary to make it a true copy-on-write despite not doing | |
45 // anything here, now. | |
46 return NULL; | |
47 } | |
48 | |
49 void RendererWebStorageNamespaceImpl::close() { | |
50 // This is called only on LocalStorage namespaces when WebKit thinks its | |
51 // shutting down. This has no impact on Chromium. | |
52 } | |
OLD | NEW |