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

Unified Diff: trunk/src/content/child/quota_dispatcher.cc

Issue 21042002: Revert 214162 "Make Platform::queryStorageUsageAndQuota work fro..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 | « trunk/src/content/child/quota_dispatcher.h ('k') | trunk/src/content/child/quota_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/child/quota_dispatcher.cc
===================================================================
--- trunk/src/content/child/quota_dispatcher.cc (revision 214171)
+++ trunk/src/content/child/quota_dispatcher.cc (working copy)
@@ -5,11 +5,7 @@
#include "content/child/quota_dispatcher.h"
#include "base/basictypes.h"
-#include "base/lazy_instance.h"
-#include "base/threading/thread_local.h"
#include "content/child/child_thread.h"
-#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/web/WebStorageQuotaCallbacks.h"
#include "third_party/WebKit/public/web/WebStorageQuotaType.h"
@@ -22,13 +18,7 @@
using WebKit::WebStorageQuotaError;
using WebKit::WebStorageQuotaType;
-using webkit_glue::WorkerTaskRunner;
-
namespace content {
-
-static base::LazyInstance<base::ThreadLocalPointer<QuotaDispatcher> >::Leaky
- g_quota_dispatcher_tls = LAZY_INSTANCE_INITIALIZER;
-
namespace {
// QuotaDispatcher::Callback implementation for WebStorageQuotaCallbacks.
@@ -54,17 +44,9 @@
WebKit::WebStorageQuotaCallbacks* callbacks_;
};
-int CurrentWorkerId() {
- return WorkerTaskRunner::Instance()->CurrentWorkerId();
-}
-
} // namespace
-QuotaDispatcher::QuotaDispatcher(ThreadSafeSender* thread_safe_sender,
- QuotaMessageFilter* quota_message_filter)
- : thread_safe_sender_(thread_safe_sender),
- quota_message_filter_(quota_message_filter) {
- g_quota_dispatcher_tls.Pointer()->Set(this);
+QuotaDispatcher::QuotaDispatcher() {
}
QuotaDispatcher::~QuotaDispatcher() {
@@ -73,28 +55,9 @@
iter.GetCurrentValue()->DidFail(quota::kQuotaErrorAbort);
iter.Advance();
}
-
- g_quota_dispatcher_tls.Pointer()->Set(NULL);
}
-QuotaDispatcher* QuotaDispatcher::ThreadSpecificInstance(
- ThreadSafeSender* thread_safe_sender,
- QuotaMessageFilter* quota_message_filter) {
- if (g_quota_dispatcher_tls.Pointer()->Get())
- return g_quota_dispatcher_tls.Pointer()->Get();
-
- QuotaDispatcher* dispatcher = new QuotaDispatcher(
- thread_safe_sender, quota_message_filter);
- if (WorkerTaskRunner::Instance()->CurrentWorkerId())
- WorkerTaskRunner::Instance()->AddStopObserver(dispatcher);
- return dispatcher;
-}
-
-void QuotaDispatcher::OnWorkerRunLoopStopped() {
- delete this;
-}
-
-void QuotaDispatcher::OnMessageReceived(const IPC::Message& msg) {
+bool QuotaDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(QuotaDispatcher, msg)
IPC_MESSAGE_HANDLER(QuotaMsg_DidGrantStorageQuota,
@@ -104,7 +67,7 @@
IPC_MESSAGE_HANDLER(QuotaMsg_DidFail, DidFail);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
- DCHECK(handled) << "Unhandled message:" << msg.type();
+ return handled;
}
void QuotaDispatcher::QueryStorageUsageAndQuota(
@@ -113,8 +76,7 @@
Callback* callback) {
DCHECK(callback);
int request_id = pending_quota_callbacks_.Add(callback);
- quota_message_filter_->RegisterRequestID(request_id, CurrentWorkerId());
- thread_safe_sender_->Send(new QuotaHostMsg_QueryStorageUsageAndQuota(
+ ChildThread::current()->Send(new QuotaHostMsg_QueryStorageUsageAndQuota(
request_id, origin_url, type));
}
@@ -125,10 +87,8 @@
int64 requested_size,
Callback* callback) {
DCHECK(callback);
- DCHECK(CurrentWorkerId() == 0);
int request_id = pending_quota_callbacks_.Add(callback);
- quota_message_filter_->RegisterRequestID(request_id, CurrentWorkerId());
- thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(
+ ChildThread::current()->Send(new QuotaHostMsg_RequestStorageQuota(
render_view_id, request_id, origin_url, type, requested_size));
}
« no previous file with comments | « trunk/src/content/child/quota_dispatcher.h ('k') | trunk/src/content/child/quota_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698