OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child_resource_message_filter.h" | 5 #include "content/child/child_resource_message_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "content/child/resource_dispatcher.h" | 10 #include "content/child/resource_dispatcher.h" |
11 #include "content/common/resource_messages.h" | 11 #include "content/common/resource_messages.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 ChildResourceMessageFilter::ChildResourceMessageFilter( | 15 ChildResourceMessageFilter::ChildResourceMessageFilter( |
16 ResourceDispatcher* resource_dispatcher) | 16 ResourceDispatcher* resource_dispatcher) |
17 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 17 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
18 resource_dispatcher_(resource_dispatcher) {} | 18 resource_dispatcher_(resource_dispatcher) {} |
19 | 19 |
20 ChildResourceMessageFilter::~ChildResourceMessageFilter() {} | 20 ChildResourceMessageFilter::~ChildResourceMessageFilter() {} |
21 | 21 |
22 bool ChildResourceMessageFilter::OnMessageReceived( | 22 bool ChildResourceMessageFilter::OnMessageReceived( |
23 const IPC::Message& message) { | 23 const IPC::Message& message) { |
24 if (message.type() == ResourceMsg_RequestComplete::ID || | 24 if (message.type() == ResourceMsg_RequestComplete::ID || |
25 message.type() == ResourceMsg_ReceivedResponse::ID || | 25 message.type() == ResourceMsg_ReceivedResponse::ID || |
26 message.type() == ResourceMsg_ReceivedRedirect::ID) { | 26 message.type() == ResourceMsg_ReceivedRedirect::ID) { |
27 main_thread_task_runner_->PostTask(FROM_HERE, base::Bind( | 27 main_thread_task_runner_->PostTask(FROM_HERE, base::Bind( |
28 &ResourceDispatcher::set_io_timestamp, | 28 &ResourceDispatcher::set_io_timestamp, |
29 base::Unretained(resource_dispatcher_), | 29 base::Unretained(resource_dispatcher_), |
30 base::TimeTicks::Now())); | 30 base::TimeTicks::Now())); |
31 } | 31 } |
32 return false; | 32 return false; |
33 } | 33 } |
34 | 34 |
35 } // namespace content | 35 } // namespace content |
OLD | NEW |