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

Unified Diff: Source/modules/storage/DOMWindowStorage.cpp

Issue 1055133003: Oilpan: have Storage objects reside on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: trivial cl footprint reduction Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/storage/DOMWindowStorage.cpp
diff --git a/Source/modules/storage/DOMWindowStorage.cpp b/Source/modules/storage/DOMWindowStorage.cpp
index 47b8f89fb519b8e0e850edd1e5c876697a6e5862..ce756a647180480c2de03b38c13982541c055ab6 100644
--- a/Source/modules/storage/DOMWindowStorage.cpp
+++ b/Source/modules/storage/DOMWindowStorage.cpp
@@ -20,7 +20,7 @@ namespace blink {
DOMWindowStorage::DOMWindowStorage(LocalDOMWindow& window)
: DOMWindowProperty(window.frame())
- , m_window(window)
+ , m_window(&window)
{
}
@@ -28,6 +28,7 @@ DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowStorage);
DEFINE_TRACE(DOMWindowStorage)
{
+ visitor->trace(m_window);
visitor->trace(m_sessionStorage);
visitor->trace(m_localStorage);
WillBeHeapSupplement<LocalDOMWindow>::trace(visitor);
@@ -65,10 +66,10 @@ Storage* DOMWindowStorage::localStorage(DOMWindow& window, ExceptionState& excep
Storage* DOMWindowStorage::sessionStorage(ExceptionState& exceptionState) const
{
- if (!m_window.isCurrentlyDisplayedInFrame())
+ if (!m_window->isCurrentlyDisplayedInFrame())
return nullptr;
- Document* document = m_window.document();
+ Document* document = m_window->document();
if (!document)
return nullptr;
@@ -84,32 +85,32 @@ Storage* DOMWindowStorage::sessionStorage(ExceptionState& exceptionState) const
}
if (m_sessionStorage) {
- if (!m_sessionStorage->area()->canAccessStorage(m_window.frame())) {
+ if (!m_sessionStorage->area()->canAccessStorage(m_window->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- return m_sessionStorage.get();
+ return m_sessionStorage;
}
Page* page = document->page();
if (!page)
return nullptr;
- OwnPtrWillBeRawPtr<StorageArea> storageArea = StorageNamespaceController::from(page)->sessionStorage()->storageArea(document->securityOrigin());
- if (!storageArea->canAccessStorage(m_window.frame())) {
+ StorageArea* storageArea = StorageNamespaceController::from(page)->sessionStorage()->storageArea(document->securityOrigin());
+ if (!storageArea->canAccessStorage(m_window->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- m_sessionStorage = Storage::create(m_window.frame(), storageArea.release());
- return m_sessionStorage.get();
+ m_sessionStorage = Storage::create(m_window->frame(), storageArea);
+ return m_sessionStorage;
}
Storage* DOMWindowStorage::localStorage(ExceptionState& exceptionState) const
{
- if (!m_window.isCurrentlyDisplayedInFrame())
+ if (!m_window->isCurrentlyDisplayedInFrame())
return nullptr;
- Document* document = m_window.document();
+ Document* document = m_window->document();
if (!document)
return nullptr;
String accessDeniedMessage = "Access is denied for this document.";
@@ -123,23 +124,23 @@ Storage* DOMWindowStorage::localStorage(ExceptionState& exceptionState) const
return nullptr;
}
if (m_localStorage) {
- if (!m_localStorage->area()->canAccessStorage(m_window.frame())) {
+ if (!m_localStorage->area()->canAccessStorage(m_window->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- return m_localStorage.get();
+ return m_localStorage;
}
// FIXME: Seems this check should be much higher?
FrameHost* host = document->frameHost();
if (!host || !host->settings().localStorageEnabled())
return nullptr;
- OwnPtrWillBeRawPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
- if (!storageArea->canAccessStorage(m_window.frame())) {
+ StorageArea* storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
+ if (!storageArea->canAccessStorage(m_window->frame())) {
exceptionState.throwSecurityError(accessDeniedMessage);
return nullptr;
}
- m_localStorage = Storage::create(m_window.frame(), storageArea.release());
- return m_localStorage.get();
+ m_localStorage = Storage::create(m_window->frame(), storageArea);
+ return m_localStorage;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698