OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/resource_scheduling_filter.h" | 5 #include "content/child/resource_scheduling_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "content/child/resource_dispatcher.h" | 9 #include "content/child/resource_dispatcher.h" |
| 10 #include "content/common/resource_messages.h" |
10 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
11 #include "ipc/ipc_message_start.h" | 12 #include "ipc/ipc_message_start.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 ResourceSchedulingFilter::ResourceSchedulingFilter( | 16 ResourceSchedulingFilter::ResourceSchedulingFilter( |
16 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, | 17 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, |
17 ResourceDispatcher* resource_dispatcher) | 18 ResourceDispatcher* resource_dispatcher) |
18 : main_thread_task_runner_(main_thread_task_runner), | 19 : main_thread_task_runner_(main_thread_task_runner), |
19 resource_dispatcher_(resource_dispatcher), | 20 resource_dispatcher_(resource_dispatcher), |
20 weak_ptr_factory_(this) { | 21 weak_ptr_factory_(this) { |
21 DCHECK(main_thread_task_runner_.get()); | 22 DCHECK(main_thread_task_runner_.get()); |
22 DCHECK(resource_dispatcher_); | 23 DCHECK(resource_dispatcher_); |
23 } | 24 } |
24 | 25 |
25 ResourceSchedulingFilter::~ResourceSchedulingFilter() { | 26 ResourceSchedulingFilter::~ResourceSchedulingFilter() { |
26 } | 27 } |
27 | 28 |
28 bool ResourceSchedulingFilter::OnMessageReceived(const IPC::Message& message) { | 29 bool ResourceSchedulingFilter::OnMessageReceived(const IPC::Message& message) { |
| 30 // TODO(erikchen): Temporary code to help track http://crbug.com/527588. |
| 31 content::CheckContentsOfDataReceivedMessage(&message); |
| 32 |
29 main_thread_task_runner_->PostTask( | 33 main_thread_task_runner_->PostTask( |
30 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, | 34 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, |
31 weak_ptr_factory_.GetWeakPtr(), message)); | 35 weak_ptr_factory_.GetWeakPtr(), message)); |
32 return true; | 36 return true; |
33 } | 37 } |
34 | 38 |
35 bool ResourceSchedulingFilter::GetSupportedMessageClasses( | 39 bool ResourceSchedulingFilter::GetSupportedMessageClasses( |
36 std::vector<uint32>* supported_message_classes) const { | 40 std::vector<uint32>* supported_message_classes) const { |
37 supported_message_classes->push_back(ResourceMsgStart); | 41 supported_message_classes->push_back(ResourceMsgStart); |
38 return true; | 42 return true; |
39 } | 43 } |
40 | 44 |
41 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { | 45 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { |
42 resource_dispatcher_->OnMessageReceived(message); | 46 resource_dispatcher_->OnMessageReceived(message); |
43 } | 47 } |
44 | 48 |
45 } // namespace content | 49 } // namespace content |
OLD | NEW |