| 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/browser/renderer_host/pepper/pepper_network_monitor_host.h" | 5 #include "content/browser/renderer_host/pepper/pepper_network_monitor_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 81 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 82 GetAndSendNetworkList(); | 82 GetAndSendNetworkList(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void PepperNetworkMonitorHost::GetAndSendNetworkList() { | 85 void PepperNetworkMonitorHost::GetAndSendNetworkList() { |
| 86 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 86 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 87 | 87 |
| 88 // Call GetNetworkList() on a thread that allows blocking IO. | 88 // Call GetNetworkList() on a thread that allows blocking IO. |
| 89 base::PostTaskWithTraitsAndReplyWithResult( | 89 base::PostTaskWithTraitsAndReplyWithResult( |
| 90 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 90 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 91 base::TaskPriority::BACKGROUND), | |
| 92 base::Bind(&GetNetworkList), | 91 base::Bind(&GetNetworkList), |
| 93 base::Bind(&PepperNetworkMonitorHost::SendNetworkList, | 92 base::Bind(&PepperNetworkMonitorHost::SendNetworkList, |
| 94 weak_factory_.GetWeakPtr())); | 93 weak_factory_.GetWeakPtr())); |
| 95 } | 94 } |
| 96 | 95 |
| 97 void PepperNetworkMonitorHost::SendNetworkList( | 96 void PepperNetworkMonitorHost::SendNetworkList( |
| 98 std::unique_ptr<net::NetworkInterfaceList> list) { | 97 std::unique_ptr<net::NetworkInterfaceList> list) { |
| 99 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 98 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 100 | 99 |
| 101 std::unique_ptr<ppapi::proxy::SerializedNetworkList> list_copy( | 100 std::unique_ptr<ppapi::proxy::SerializedNetworkList> list_copy( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 network_copy.type = PP_NETWORKLIST_TYPE_UNKNOWN; | 116 network_copy.type = PP_NETWORKLIST_TYPE_UNKNOWN; |
| 118 network_copy.state = PP_NETWORKLIST_STATE_UP; | 117 network_copy.state = PP_NETWORKLIST_STATE_UP; |
| 119 network_copy.display_name = network.name; | 118 network_copy.display_name = network.name; |
| 120 network_copy.mtu = 0; | 119 network_copy.mtu = 0; |
| 121 } | 120 } |
| 122 host()->SendUnsolicitedReply( | 121 host()->SendUnsolicitedReply( |
| 123 pp_resource(), PpapiPluginMsg_NetworkMonitor_NetworkList(*list_copy)); | 122 pp_resource(), PpapiPluginMsg_NetworkMonitor_NetworkList(*list_copy)); |
| 124 } | 123 } |
| 125 | 124 |
| 126 } // namespace content | 125 } // namespace content |
| OLD | NEW |