| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 NOTREACHED() << "malformed resource message"; | 59 NOTREACHED() << "malformed resource message"; |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 // Dispatch the message on the request id specific task runner, if there is | 62 // Dispatch the message on the request id specific task runner, if there is |
| 63 // one, or on the general main_thread_task_runner if there isn't. | 63 // one, or on the general main_thread_task_runner if there isn't. |
| 64 RequestIdToTaskRunnerMap::const_iterator iter = | 64 RequestIdToTaskRunnerMap::const_iterator iter = |
| 65 request_id_to_task_runner_map_.find(request_id); | 65 request_id_to_task_runner_map_.find(request_id); |
| 66 if (iter != request_id_to_task_runner_map_.end()) { | 66 if (iter != request_id_to_task_runner_map_.end()) { |
| 67 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE coexist. | 67 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE coexist. |
| 68 iter->second->postTask( | 68 iter->second->postTask( |
| 69 BLINK_FROM_HERE, | 69 blink::WebTraceLocation(__FUNCTION__, __FILE__), |
| 70 new DispatchMessageTask(weak_ptr_factory_.GetWeakPtr(), message)); | 70 new DispatchMessageTask(weak_ptr_factory_.GetWeakPtr(), message)); |
| 71 } else { | 71 } else { |
| 72 main_thread_task_runner_->PostTask( | 72 main_thread_task_runner_->PostTask( |
| 73 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, | 73 FROM_HERE, base::Bind(&ResourceSchedulingFilter::DispatchMessage, |
| 74 weak_ptr_factory_.GetWeakPtr(), message)); | 74 weak_ptr_factory_.GetWeakPtr(), message)); |
| 75 } | 75 } |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ResourceSchedulingFilter::SetRequestIdTaskRunner( | 79 void ResourceSchedulingFilter::SetRequestIdTaskRunner( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 std::vector<uint32_t>* supported_message_classes) const { | 93 std::vector<uint32_t>* supported_message_classes) const { |
| 94 supported_message_classes->push_back(ResourceMsgStart); | 94 supported_message_classes->push_back(ResourceMsgStart); |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { | 98 void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) { |
| 99 resource_dispatcher_->OnMessageReceived(message); | 99 resource_dispatcher_->OnMessageReceived(message); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace content | 102 } // namespace content |
| OLD | NEW |