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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/child/resource_scheduling_filter.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/child/resource_scheduling_filter.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "content/child/resource_dispatcher.h"
10 #include "ipc/ipc_message.h"
11 #include "ipc/ipc_message_start.h"
12
13 namespace content {
14
15 ResourceSchedulingFilter::ResourceSchedulingFilter(
16 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
17 ResourceDispatcher* resource_dispatcher)
18 : main_thread_task_runner_(main_thread_task_runner),
19 resource_dispatcher_(resource_dispatcher),
20 weak_ptr_factory_(this) {
21 DCHECK(main_thread_task_runner_.get());
22 DCHECK(resource_dispatcher_);
23 }
24
25 ResourceSchedulingFilter::~ResourceSchedulingFilter() {
26 }
27
28 bool ResourceSchedulingFilter::OnMessageReceived(const IPC::Message& message) {
29 main_thread_task_runner_->PostTask(
30 FROM_HERE,
31 base::Bind(&ResourceSchedulingFilter::DispatchMessage,
32 weak_ptr_factory_.GetWeakPtr(),
33 message));
34 return true;
35 }
36
37 bool ResourceSchedulingFilter::GetSupportedMessageClasses(
38 std::vector<uint32>* supported_message_classes) const {
39 supported_message_classes->push_back(ResourceMsgStart);
40 return true;
41 }
42
43 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) {
44 resource_dispatcher_->OnMessageReceived(message);
45 }
46
47 } // namespace content
OLDNEW
« 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