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

Side by Side Diff: content/renderer/renderer_webstoragearea_impl.cc

Issue 10005049: DomStorage house cleaning (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
OLDNEW
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/renderer_webstoragearea_impl.h" 5 #include "content/renderer/renderer_webstoragearea_impl.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "content/common/dom_storage_messages.h" 9 #include "content/common/dom_storage_messages.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h "
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
12 #include "webkit/dom_storage/dom_storage_types.h"
13 13
14 using WebKit::WebStorageNamespace;
15 using WebKit::WebString; 14 using WebKit::WebString;
16 using WebKit::WebURL; 15 using WebKit::WebURL;
17 16
18 RendererWebStorageAreaImpl::RendererWebStorageAreaImpl( 17 RendererWebStorageAreaImpl::RendererWebStorageAreaImpl(
19 int64 namespace_id, const WebString& origin) { 18 int64 namespace_id, const WebString& origin) {
20 RenderThreadImpl::current()->Send( 19 RenderThreadImpl::current()->Send(
21 new DOMStorageHostMsg_OpenStorageArea(namespace_id, origin, 20 new DOMStorageHostMsg_OpenStorageArea(namespace_id, origin,
22 &storage_area_id_)); 21 &storage_area_id_));
23 } 22 }
24 23
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WebString RendererWebStorageAreaImpl::getItem(const WebString& key) { 57 WebString RendererWebStorageAreaImpl::getItem(const WebString& key) {
59 NullableString16 value; 58 NullableString16 value;
60 RenderThreadImpl::current()->Send( 59 RenderThreadImpl::current()->Send(
61 new DOMStorageHostMsg_GetItem(storage_area_id_, key, &value)); 60 new DOMStorageHostMsg_GetItem(storage_area_id_, key, &value));
62 return value; 61 return value;
63 } 62 }
64 63
65 void RendererWebStorageAreaImpl::setItem( 64 void RendererWebStorageAreaImpl::setItem(
66 const WebString& key, const WebString& value, const WebURL& url, 65 const WebString& key, const WebString& value, const WebURL& url,
67 WebStorageArea::Result& result, WebString& old_value_webkit) { 66 WebStorageArea::Result& result, WebString& old_value_webkit) {
68 const size_t kMaxKeyValueLength = WebStorageNamespace::m_localStorageQuota; 67 if (key.length() + value.length() > dom_storage::kPerAreaQuota) {
69 if (key.length() + value.length() > kMaxKeyValueLength) {
70 result = ResultBlockedByQuota; 68 result = ResultBlockedByQuota;
71 return; 69 return;
72 } 70 }
73 NullableString16 old_value; 71 NullableString16 old_value;
74 RenderThreadImpl::current()->Send(new DOMStorageHostMsg_SetItem( 72 RenderThreadImpl::current()->Send(new DOMStorageHostMsg_SetItem(
75 storage_area_id_, key, value, url, &result, &old_value)); 73 storage_area_id_, key, value, url, &result, &old_value));
76 old_value_webkit = old_value; 74 old_value_webkit = old_value;
77 } 75 }
78 76
79 void RendererWebStorageAreaImpl::removeItem( 77 void RendererWebStorageAreaImpl::removeItem(
80 const WebString& key, const WebURL& url, WebString& old_value_webkit) { 78 const WebString& key, const WebURL& url, WebString& old_value_webkit) {
81 NullableString16 old_value; 79 NullableString16 old_value;
82 RenderThreadImpl::current()->Send( 80 RenderThreadImpl::current()->Send(
83 new DOMStorageHostMsg_RemoveItem(storage_area_id_, key, url, &old_value)); 81 new DOMStorageHostMsg_RemoveItem(storage_area_id_, key, url, &old_value));
84 old_value_webkit = old_value; 82 old_value_webkit = old_value;
85 } 83 }
86 84
87 void RendererWebStorageAreaImpl::clear( 85 void RendererWebStorageAreaImpl::clear(
88 const WebURL& url, bool& cleared_something) { 86 const WebURL& url, bool& cleared_something) {
89 RenderThreadImpl::current()->Send( 87 RenderThreadImpl::current()->Send(
90 new DOMStorageHostMsg_Clear(storage_area_id_, url, &cleared_something)); 88 new DOMStorageHostMsg_Clear(storage_area_id_, url, &cleared_something));
91 } 89 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | content/renderer/renderer_webstoragenamespace_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698