Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: chrome/renderer/renderer_webstoragenamespace_impl.cc

Issue 258010: Reverting 27759. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | webkit/api/public/WebKitClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" 5 #include "chrome/renderer/renderer_webstoragenamespace_impl.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/renderer/render_thread.h" 8 #include "chrome/renderer/render_thread.h"
9 #include "chrome/renderer/renderer_webstoragearea_impl.h" 9 #include "chrome/renderer/renderer_webstoragearea_impl.h"
10 10
11 using WebKit::WebStorageArea;
12 using WebKit::WebStorageNamespace;
13 using WebKit::WebString;
14
11 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( 15 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl(
12 DOMStorageType storage_type) 16 DOMStorageType storage_type)
13 : storage_type_(storage_type), 17 : storage_type_(storage_type),
14 namespace_id_(kUninitializedNamespaceId) { 18 namespace_id_(kUninitializedNamespaceId) {
15 } 19 }
16 20
17 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( 21 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl(
18 DOMStorageType storage_type, int64 namespace_id) 22 DOMStorageType storage_type, int64 namespace_id)
19 : storage_type_(storage_type), 23 : storage_type_(storage_type),
20 namespace_id_(namespace_id) { 24 namespace_id_(namespace_id) {
21 DCHECK(namespace_id_ != kUninitializedNamespaceId); 25 DCHECK(namespace_id_ != kUninitializedNamespaceId);
22 } 26 }
23 27
24 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { 28 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() {
25 } 29 }
26 30
27 WebKit::WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea( 31 WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea(
28 const WebKit::WebString& origin) { 32 const WebString& origin) {
29 // This could be done async in the background (started when this class is 33 // This could be done async in the background (started when this class is
30 // first instantiated) rather than lazily on first use, but it's unclear 34 // first instantiated) rather than lazily on first use, but it's unclear
31 // whether it's worth the complexity. 35 // whether it's worth the complexity.
32 if (namespace_id_ == kUninitializedNamespaceId) { 36 if (namespace_id_ == kUninitializedNamespaceId) {
33 RenderThread::current()->Send( 37 RenderThread::current()->Send(
34 new ViewHostMsg_DOMStorageNamespaceId(storage_type_, 38 new ViewHostMsg_DOMStorageNamespaceId(storage_type_,
35 &namespace_id_)); 39 &namespace_id_));
36 DCHECK(namespace_id_ != kUninitializedNamespaceId); 40 DCHECK(namespace_id_ != kUninitializedNamespaceId);
37 } 41 }
38 // Ideally, we'd keep a hash map of origin to these objects. Unfortunately 42 // Ideally, we'd keep a hash map of origin to these objects. Unfortunately
39 // this doesn't seem practical because there's no good way to ref-count these 43 // this doesn't seem practical because there's no good way to ref-count these
40 // objects, and it'd be unclear who owned them. So, instead, we'll pay a 44 // objects, and it'd be unclear who owned them. So, instead, we'll pay a
41 // price for an allocaiton and IPC for each. 45 // price for an allocaiton and IPC for each.
42 return new RendererWebStorageAreaImpl(namespace_id_, origin); 46 return new RendererWebStorageAreaImpl(namespace_id_, origin);
43 } 47 }
44 48
45 WebKit::WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { 49 WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() {
46 // If we haven't been used yet, we might as well start out fresh (and lazy). 50 // If we haven't been used yet, we might as well start out fresh (and lazy).
47 if (namespace_id_ == kUninitializedNamespaceId) 51 if (namespace_id_ == kUninitializedNamespaceId)
48 return new RendererWebStorageNamespaceImpl(storage_type_); 52 return new RendererWebStorageNamespaceImpl(storage_type_);
49 53
50 // This cannot easily be differed because we need a snapshot in time. 54 // This cannot easily be deferred because we need a snapshot in time.
51 int64 new_namespace_id; 55 int64 new_namespace_id;
52 RenderThread::current()->Send( 56 RenderThread::current()->Send(
53 new ViewHostMsg_DOMStorageCloneNamespaceId(namespace_id_, 57 new ViewHostMsg_DOMStorageCloneNamespaceId(namespace_id_,
54 &new_namespace_id)); 58 &new_namespace_id));
55 return new RendererWebStorageNamespaceImpl(storage_type_, 59 return new RendererWebStorageNamespaceImpl(storage_type_,
56 new_namespace_id); 60 new_namespace_id);
57 } 61 }
58 62
59 void RendererWebStorageNamespaceImpl::close() { 63 void RendererWebStorageNamespaceImpl::close() {
60 // This is called only on LocalStorage namespaces when WebKit thinks its 64 // This is called only on LocalStorage namespaces when WebKit thinks its
61 // shutting down. This has no impact on Chromium. 65 // shutting down. This has no impact on Chromium.
62 } 66 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | webkit/api/public/WebKitClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698