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

Unified Diff: WebKit/chromium/src/StorageAreaProxy.cpp

Issue 10539097: WebKit-side: Implement StorageArea::containsItem(...) for the chromium port too. Cleanup some depre… Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebKit/chromium/src/StorageAreaProxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebKit/chromium/src/StorageAreaProxy.cpp
===================================================================
--- WebKit/chromium/src/StorageAreaProxy.cpp (revision 119965)
+++ WebKit/chromium/src/StorageAreaProxy.cpp (working copy)
@@ -53,6 +53,8 @@
StorageAreaProxy::StorageAreaProxy(WebKit::WebStorageArea* storageArea, StorageType storageType)
: m_storageArea(adoptPtr(storageArea))
, m_storageType(storageType)
+ , m_cachedCanAccessSetting(false)
+ , m_cachedCanAccessSettingForFrame(0)
{
}
@@ -108,16 +110,23 @@
bool StorageAreaProxy::contains(const String& key, Frame* frame) const
{
- return !getItem(key, frame).isNull();
+ if (!canAccessStorage(frame))
+ return false;
+ return m_storageArea->containsItem(key);
}
bool StorageAreaProxy::canAccessStorage(Frame* frame) const
{
if (!frame->page())
return false;
+ if (m_cachedCanAccessSettingForFrame == reinterpret_cast<void*>(frame))
+ return m_cachedCanAccessSetting;
+
WebKit::WebFrameImpl* webFrame = WebKit::WebFrameImpl::fromFrame(frame);
WebKit::WebViewImpl* webView = webFrame->viewImpl();
- return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage);
+ m_cachedCanAccessSetting = !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage);
+ m_cachedCanAccessSettingForFrame = reinterpret_cast<void*>(frame);
+ return m_cachedCanAccessSetting;
}
void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue,
« no previous file with comments | « WebKit/chromium/src/StorageAreaProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698