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 <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "content/child/resource_dispatcher.h" | 11 #include "content/child/resource_dispatcher.h" |
10 #include "content/common/resource_messages.h" | 12 #include "content/common/resource_messages.h" |
11 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_message_start.h" | 14 #include "ipc/ipc_message_start.h" |
13 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 15 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
14 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 16 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, | 77 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, |
76 weak_ptr_factory_.GetWeakPtr(), message)); | 78 weak_ptr_factory_.GetWeakPtr(), message)); |
77 } | 79 } |
78 return true; | 80 return true; |
79 } | 81 } |
80 | 82 |
81 void ResourceSchedulingFilter::SetRequestIdTaskRunner( | 83 void ResourceSchedulingFilter::SetRequestIdTaskRunner( |
82 int id, scoped_ptr<blink::WebTaskRunner> web_task_runner) { | 84 int id, scoped_ptr<blink::WebTaskRunner> web_task_runner) { |
83 base::AutoLock lock(request_id_to_task_runner_map_lock_); | 85 base::AutoLock lock(request_id_to_task_runner_map_lock_); |
84 request_id_to_task_runner_map_.insert( | 86 request_id_to_task_runner_map_.insert( |
85 std::make_pair(id, web_task_runner.Pass())); | 87 std::make_pair(id, std::move(web_task_runner))); |
86 } | 88 } |
87 | 89 |
88 void ResourceSchedulingFilter::ClearRequestIdTaskRunner(int id) { | 90 void ResourceSchedulingFilter::ClearRequestIdTaskRunner(int id) { |
89 base::AutoLock lock(request_id_to_task_runner_map_lock_); | 91 base::AutoLock lock(request_id_to_task_runner_map_lock_); |
90 request_id_to_task_runner_map_.erase(id); | 92 request_id_to_task_runner_map_.erase(id); |
91 } | 93 } |
92 | 94 |
93 bool ResourceSchedulingFilter::GetSupportedMessageClasses( | 95 bool ResourceSchedulingFilter::GetSupportedMessageClasses( |
94 std::vector<uint32_t>* supported_message_classes) const { | 96 std::vector<uint32_t>* supported_message_classes) const { |
95 supported_message_classes->push_back(ResourceMsgStart); | 97 supported_message_classes->push_back(ResourceMsgStart); |
96 return true; | 98 return true; |
97 } | 99 } |
98 | 100 |
99 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { | 101 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { |
100 resource_dispatcher_->OnMessageReceived(message); | 102 resource_dispatcher_->OnMessageReceived(message); |
101 } | 103 } |
102 | 104 |
103 } // namespace content | 105 } // namespace content |
OLD | NEW |