diff options
author | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 05:13:38 +0000 |
---|---|---|
committer | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 05:13:38 +0000 |
commit | 546d91c4310198ec9d8843af640540d0b71d23ea (patch) | |
tree | 207b8a5fbd612d25e6048f3237fe23d49b19e4cb /content | |
parent | 292a1c1c25a7b218618dc27b44d0c67c42afe9ed (diff) | |
download | chromium_src-546d91c4310198ec9d8843af640540d0b71d23ea.zip chromium_src-546d91c4310198ec9d8843af640540d0b71d23ea.tar.gz chromium_src-546d91c4310198ec9d8843af640540d0b71d23ea.tar.bz2 |
Quota: Remove self-destructive callbacks for cleanup (Chromium)
Blink-side patch: https://codereview.chromium.org/135723009/
BUG=338995
TEST=should pass all existing tests (no behavioral changes)
Review URL: https://codereview.chromium.org/132333016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/child/quota_dispatcher.cc | 28 | ||||
-rw-r--r-- | content/child/quota_dispatcher.h | 11 | ||||
-rw-r--r-- | content/renderer/render_frame_impl.cc | 6 | ||||
-rw-r--r-- | content/renderer/render_frame_impl.h | 10 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 10 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.h | 12 | ||||
-rw-r--r-- | content/worker/worker_webkitplatformsupport_impl.cc | 2 | ||||
-rw-r--r-- | content/worker/worker_webkitplatformsupport_impl.h | 12 |
10 files changed, 78 insertions, 17 deletions
diff --git a/content/child/quota_dispatcher.cc b/content/child/quota_dispatcher.cc index be304c2..3555f72 100644 --- a/content/child/quota_dispatcher.cc +++ b/content/child/quota_dispatcher.cc @@ -11,7 +11,6 @@ #include "content/child/quota_message_filter.h" #include "content/child/thread_safe_sender.h" #include "content/common/quota_messages.h" -#include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" #include "third_party/WebKit/public/platform/WebStorageQuotaType.h" #include "url/gurl.h" @@ -34,11 +33,22 @@ namespace { // QuotaDispatcher::Callback implementation for WebStorageQuotaCallbacks. class WebStorageQuotaDispatcherCallback : public QuotaDispatcher::Callback { public: - WebStorageQuotaDispatcherCallback(blink::WebStorageQuotaCallbacks* callback) - : callbacks_(callback) { - DCHECK(callbacks_); - } + explicit WebStorageQuotaDispatcherCallback( + blink::WebStorageQuotaCallbacksType callback) + : callbacks_(callback) {} virtual ~WebStorageQuotaDispatcherCallback() {} + +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS + virtual void DidQueryStorageUsageAndQuota(int64 usage, int64 quota) OVERRIDE { + callbacks_.didQueryStorageUsageAndQuota(usage, quota); + } + virtual void DidGrantStorageQuota(int64 usage, int64 granted_quota) OVERRIDE { + callbacks_.didGrantStorageQuota(usage, granted_quota); + } + virtual void DidFail(quota::QuotaStatusCode error) OVERRIDE { + callbacks_.didFail(static_cast<WebStorageQuotaError>(error)); + } +#else virtual void DidQueryStorageUsageAndQuota(int64 usage, int64 quota) OVERRIDE { callbacks_->didQueryStorageUsageAndQuota(usage, quota); } @@ -48,10 +58,12 @@ class WebStorageQuotaDispatcherCallback : public QuotaDispatcher::Callback { virtual void DidFail(quota::QuotaStatusCode error) OVERRIDE { callbacks_->didFail(static_cast<WebStorageQuotaError>(error)); } +#endif private: - // Not owned (self-destructed). - blink::WebStorageQuotaCallbacks* callbacks_; + blink::WebStorageQuotaCallbacksType callbacks_; + + DISALLOW_COPY_AND_ASSIGN(WebStorageQuotaDispatcherCallback); }; int CurrentWorkerId() { @@ -135,7 +147,7 @@ void QuotaDispatcher::RequestStorageQuota( // static QuotaDispatcher::Callback* QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper( - blink::WebStorageQuotaCallbacks* callbacks) { + blink::WebStorageQuotaCallbacksType callbacks) { return new WebStorageQuotaDispatcherCallback(callbacks); } diff --git a/content/child/quota_dispatcher.h b/content/child/quota_dispatcher.h index 818ffef..a94ba62 100644 --- a/content/child/quota_dispatcher.h +++ b/content/child/quota_dispatcher.h @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/id_map.h" #include "base/memory/ref_counted.h" +#include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" #include "webkit/child/worker_task_runner.h" #include "webkit/common/quota/quota_types.h" @@ -22,6 +23,14 @@ class Message; namespace blink { class WebStorageQuotaCallbacks; + +// TODO(nhiroki): Remove this after a Blink-side patch is landed. +// (http://crbug.com/338995) +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS +typedef WebStorageQuotaCallbacks WebStorageQuotaCallbacksType; +#else +typedef WebStorageQuotaCallbacks* WebStorageQuotaCallbacksType; +#endif } namespace content { @@ -69,7 +78,7 @@ class QuotaDispatcher : public webkit_glue::WorkerTaskRunner::Observer { // Creates a new Callback instance for WebStorageQuotaCallbacks. static Callback* CreateWebStorageQuotaCallbacksWrapper( - blink::WebStorageQuotaCallbacks* callbacks); + blink::WebStorageQuotaCallbacksType callbacks); private: // Message handlers. diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index c8151da..5aa6180 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -1482,12 +1482,16 @@ void RenderFrameImpl::requestStorageQuota( blink::WebFrame* frame, blink::WebStorageQuotaType type, unsigned long long requested_size, - blink::WebStorageQuotaCallbacks* callbacks) { + blink::WebStorageQuotaCallbacksType callbacks) { DCHECK(frame); WebSecurityOrigin origin = frame->document().securityOrigin(); if (origin.isUnique()) { // Unique origins cannot store persistent state. +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS + callbacks.didFail(blink::WebStorageQuotaErrorAbort); +#else callbacks->didFail(blink::WebStorageQuotaErrorAbort); +#endif return; } ChildThread::current()->quota_dispatcher()->RequestStorageQuota( diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 2d34494..48e564b 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -30,6 +30,14 @@ class WebMouseEvent; struct WebCompositionUnderline; struct WebContextMenuData; struct WebCursorInfo; + +// TODO(nhiroki): Remove this after a Blink-side patch is landed. +// (http://crbug.com/338995) +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS +typedef WebStorageQuotaCallbacks WebStorageQuotaCallbacksType; +#else +typedef WebStorageQuotaCallbacks* WebStorageQuotaCallbacksType; +#endif } namespace gfx { @@ -300,7 +308,7 @@ class CONTENT_EXPORT RenderFrameImpl blink::WebFrame* frame, blink::WebStorageQuotaType type, unsigned long long requested_size, - blink::WebStorageQuotaCallbacks* callbacks); + blink::WebStorageQuotaCallbacksType callbacks); virtual void willOpenSocketStream( blink::WebSocketStreamHandle* handle); virtual void willStartUsingPeerConnectionHandler( diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 8e7b8b3..5d3a5cd 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -3947,7 +3947,7 @@ void RenderViewImpl::requestStorageQuota( WebFrame* frame, WebStorageQuotaType type, unsigned long long requested_size, - WebStorageQuotaCallbacks* callbacks) { + blink::WebStorageQuotaCallbacksType callbacks) { NOTREACHED(); } diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index c763653..a95d468 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -121,6 +121,14 @@ struct WebWindowFeatures; #if defined(OS_ANDROID) class WebHitTestResult; #endif + +// TODO(nhiroki): Remove this after a Blink-side patch is landed. +// (http://crbug.com/338995) +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS +typedef WebStorageQuotaCallbacks WebStorageQuotaCallbacksType; +#else +typedef WebStorageQuotaCallbacks* WebStorageQuotaCallbacksType; +#endif } namespace webkit_glue { @@ -598,7 +606,7 @@ class CONTENT_EXPORT RenderViewImpl blink::WebFrame* frame, blink::WebStorageQuotaType type, unsigned long long requested_size, - blink::WebStorageQuotaCallbacks* callbacks); + blink::WebStorageQuotaCallbacksType callbacks); virtual void willOpenSocketStream( blink::WebSocketStreamHandle* handle); virtual void willStartUsingPeerConnectionHandler(blink::WebFrame* frame, diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 85bdea3..f345be4 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -1069,7 +1069,7 @@ void RendererWebKitPlatformSupportImpl::cancelVibration() { void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota( const blink::WebURL& storage_partition, blink::WebStorageQuotaType type, - blink::WebStorageQuotaCallbacks* callbacks) { + blink::WebStorageQuotaCallbacksType callbacks) { if (!thread_safe_sender_.get() || !quota_message_filter_.get()) return; QuotaDispatcher::ThreadSpecificInstance( diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index ca77294..1a1c1f7 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -31,6 +31,14 @@ namespace blink { class WebDeviceMotionData; class WebDeviceOrientationData; class WebGraphicsContext3DProvider; + +// TODO(nhiroki): Remove this after a Blink-side patch is landed. +// (http://crbug.com/338995) +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS +typedef WebStorageQuotaCallbacks WebStorageQuotaCallbacksType; +#else +typedef WebStorageQuotaCallbacks* WebStorageQuotaCallbacksType; +#endif } namespace content { @@ -147,7 +155,7 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl virtual void queryStorageUsageAndQuota( const blink::WebURL& storage_partition, blink::WebStorageQuotaType, - blink::WebStorageQuotaCallbacks*) OVERRIDE; + blink::WebStorageQuotaCallbacksType) OVERRIDE; virtual void vibrate(unsigned int milliseconds); virtual void cancelVibration(); @@ -217,6 +225,8 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl webkit::WebCompositorSupportImpl compositor_support_; scoped_ptr<WebCryptoImpl> web_crypto_; + + DISALLOW_COPY_AND_ASSIGN(RendererWebKitPlatformSupportImpl); }; } // namespace content diff --git a/content/worker/worker_webkitplatformsupport_impl.cc b/content/worker/worker_webkitplatformsupport_impl.cc index 553f677..c1fff234 100644 --- a/content/worker/worker_webkitplatformsupport_impl.cc +++ b/content/worker/worker_webkitplatformsupport_impl.cc @@ -292,7 +292,7 @@ WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() { void WorkerWebKitPlatformSupportImpl::queryStorageUsageAndQuota( const blink::WebURL& storage_partition, blink::WebStorageQuotaType type, - blink::WebStorageQuotaCallbacks* callbacks) { + blink::WebStorageQuotaCallbacksType callbacks) { if (!thread_safe_sender_.get() || !quota_message_filter_.get()) return; QuotaDispatcher::ThreadSpecificInstance( diff --git a/content/worker/worker_webkitplatformsupport_impl.h b/content/worker/worker_webkitplatformsupport_impl.h index 784dcca8e..0333a2a 100644 --- a/content/worker/worker_webkitplatformsupport_impl.h +++ b/content/worker/worker_webkitplatformsupport_impl.h @@ -20,6 +20,14 @@ class SyncMessageFilter; namespace blink { class WebFileUtilities; + +// TODO(nhiroki): Remove this after a Blink-side patch is landed. +// (http://crbug.com/338995) +#ifdef NON_SELFDESTRUCT_WEBSTORAGEQUOTACALLBACKS +typedef WebStorageQuotaCallbacks WebStorageQuotaCallbacksType; +#else +typedef WebStorageQuotaCallbacks* WebStorageQuotaCallbacksType; +#endif } namespace content { @@ -98,7 +106,7 @@ class WorkerWebKitPlatformSupportImpl : public WebKitPlatformSupportImpl, virtual void queryStorageUsageAndQuota( const blink::WebURL& storage_partition, blink::WebStorageQuotaType, - blink::WebStorageQuotaCallbacks*) OVERRIDE; + blink::WebStorageQuotaCallbacksType) OVERRIDE; WebDatabaseObserverImpl* web_database_observer_impl() { return web_database_observer_impl_.get(); @@ -115,6 +123,8 @@ class WorkerWebKitPlatformSupportImpl : public WebKitPlatformSupportImpl, scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; scoped_refptr<QuotaMessageFilter> quota_message_filter_; scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_; + + DISALLOW_COPY_AND_ASSIGN(WorkerWebKitPlatformSupportImpl); }; } // namespace content |