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

Unified Diff: content/child/resource_scheduling_filter.cc

Issue 648403004: Schedule ResourceDispatch messages via a Filter Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: It should compile now Created 6 years, 2 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 | « content/child/resource_scheduling_filter.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_scheduling_filter.cc
diff --git a/content/child/resource_scheduling_filter.cc b/content/child/resource_scheduling_filter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..23733cd3d904dbaa96ad371f812a4aab6d6ab248
--- /dev/null
+++ b/content/child/resource_scheduling_filter.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/resource_scheduling_filter.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "content/child/resource_dispatcher.h"
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_start.h"
+
+namespace content {
+
+ResourceSchedulingFilter::ResourceSchedulingFilter(
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
+ ResourceDispatcher* resource_dispatcher)
+ : main_thread_task_runner_(main_thread_task_runner),
+ resource_dispatcher_(resource_dispatcher),
+ weak_ptr_factory_(this) {
+ DCHECK(main_thread_task_runner_.get());
+ DCHECK(resource_dispatcher_);
+}
+
+ResourceSchedulingFilter::~ResourceSchedulingFilter() {
+}
+
+bool ResourceSchedulingFilter::OnMessageReceived(const IPC::Message& message) {
+ main_thread_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&ResourceSchedulingFilter::DispatchMessage,
+ weak_ptr_factory_.GetWeakPtr(),
+ message));
+ return true;
+}
+
+bool ResourceSchedulingFilter::GetSupportedMessageClasses(
+ std::vector<uint32>* supported_message_classes) const {
+ supported_message_classes->push_back(ResourceMsgStart);
+ return true;
+}
+
+void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) {
+ resource_dispatcher_->OnMessageReceived(message);
+}
+
+} // namespace content
« no previous file with comments | « content/child/resource_scheduling_filter.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698