Index: content/child/quota_message_filter.cc |
diff --git a/content/child/quota_message_filter.cc b/content/child/quota_message_filter.cc |
index 590a9663a458823b367287a360c5ae3c59a1ac28..139be2550deff675625eda80fa407dc53258c962 100644 |
--- a/content/child/quota_message_filter.cc |
+++ b/content/child/quota_message_filter.cc |
@@ -4,16 +4,11 @@ |
#include "content/child/quota_message_filter.h" |
-#include "base/bind.h" |
-#include "base/location.h" |
#include "base/message_loop/message_loop_proxy.h" |
-#include "base/pickle.h" |
#include "content/child/quota_dispatcher.h" |
#include "content/child/thread_safe_sender.h" |
+#include "content/child/worker_thread_task_runner.h" |
#include "content/common/quota_messages.h" |
-#include "webkit/child/worker_task_runner.h" |
- |
-using webkit_glue::WorkerTaskRunner; |
namespace content { |
@@ -24,30 +19,7 @@ QuotaMessageFilter::QuotaMessageFilter( |
next_request_id_(0) { |
} |
-bool QuotaMessageFilter::OnMessageReceived(const IPC::Message& msg) { |
- if (IPC_MESSAGE_CLASS(msg) != QuotaMsgStart) |
- return false; |
- int request_id = -1; |
- bool result = PickleIterator(msg).ReadInt(&request_id); |
- DCHECK(result); |
- base::Closure closure = base::Bind( |
- &QuotaMessageFilter::DispatchMessage, this, msg); |
- int thread_id = 0; |
- { |
- base::AutoLock lock(request_id_map_lock_); |
- RequestIdToThreadId::iterator found = request_id_map_.find(request_id); |
- if (found != request_id_map_.end()) { |
- thread_id = found->second; |
- request_id_map_.erase(found); |
- } |
- } |
- if (!thread_id) { |
- main_thread_loop_proxy_->PostTask(FROM_HERE, closure); |
- return true; |
- } |
- WorkerTaskRunner::Instance()->PostTask(thread_id, closure); |
- return true; |
-} |
+QuotaMessageFilter::~QuotaMessageFilter() {} |
int QuotaMessageFilter::GenerateRequestID(int thread_id) { |
base::AutoLock lock(request_id_map_lock_); |
@@ -66,11 +38,35 @@ void QuotaMessageFilter::ClearThreadRequests(int thread_id) { |
} |
} |
-QuotaMessageFilter::~QuotaMessageFilter() {} |
+base::TaskRunner* QuotaMessageFilter::OverrideTaskRunnerForMessage( |
+ const IPC::Message& msg) { |
+ if (IPC_MESSAGE_CLASS(msg) != QuotaMsgStart) |
+ return NULL; |
+ |
+ int request_id = -1, thread_id = 0; |
+ const bool success = PickleIterator(msg).ReadInt(&request_id); |
+ DCHECK(success); |
-void QuotaMessageFilter::DispatchMessage(const IPC::Message& msg) { |
+ { |
+ base::AutoLock lock(request_id_map_lock_); |
+ RequestIdToThreadId::iterator found = request_id_map_.find(request_id); |
+ if (found != request_id_map_.end()) { |
+ thread_id = found->second; |
+ request_id_map_.erase(found); |
+ } |
+ } |
+ |
+ if (!thread_id) |
+ return main_thread_loop_proxy_.get(); |
+ return new WorkerThreadTaskRunner(thread_id); |
+} |
+ |
+bool QuotaMessageFilter::OnMessageReceived(const IPC::Message& msg) { |
+ if (IPC_MESSAGE_CLASS(msg) != QuotaMsgStart) |
+ return false; |
QuotaDispatcher::ThreadSpecificInstance(thread_safe_sender_.get(), this) |
->OnMessageReceived(msg); |
+ return true; |
} |
} // namespace content |