| 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 "chrome/browser/local_discovery/service_discovery_host_client.h" | 5 #include "chrome/browser/local_discovery/service_discovery_host_client.h" |
| 6 | 6 |
| 7 #include "chrome/common/local_discovery/local_discovery_messages.h" | 7 #include "chrome/common/local_discovery/local_discovery_messages.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/utility_process_host.h" | 9 #include "content/public/browser/utility_process_host.h" |
| 10 | 10 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 FROM_HERE, | 156 FROM_HERE, |
| 157 base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this)); | 157 base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ServiceDiscoveryHostClient::StartOnIOThread() { | 160 void ServiceDiscoveryHostClient::StartOnIOThread() { |
| 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 162 utility_host_ = UtilityProcessHost::Create( | 162 utility_host_ = UtilityProcessHost::Create( |
| 163 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); | 163 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); |
| 164 if (utility_host_) { | 164 if (utility_host_) { |
| 165 utility_host_->EnableZygote(); | 165 utility_host_->EnableZygote(); |
| 166 // TODO(vitalybuka): enable sandbox. http://crbug.com/245391 | 166 utility_host_->EnableMDns(); |
| 167 utility_host_->DisableSandbox(); | |
| 168 utility_host_->StartBatchMode(); | 167 utility_host_->StartBatchMode(); |
| 169 } | 168 } |
| 170 } | 169 } |
| 171 | 170 |
| 172 void ServiceDiscoveryHostClient::ShutdownOnIOThread() { | 171 void ServiceDiscoveryHostClient::ShutdownOnIOThread() { |
| 173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 174 if (utility_host_) | 173 if (utility_host_) |
| 175 utility_host_->EndBatchMode(); | 174 utility_host_->EndBatchMode(); |
| 176 } | 175 } |
| 177 | 176 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 uint64 id, | 232 uint64 id, |
| 234 ServiceResolver::RequestStatus status, | 233 ServiceResolver::RequestStatus status, |
| 235 const ServiceDescription& description) { | 234 const ServiceDescription& description) { |
| 236 DCHECK(CalledOnValidThread()); | 235 DCHECK(CalledOnValidThread()); |
| 237 ResolverCallbacks::iterator it = service_resolver_callbacks_.find(id); | 236 ResolverCallbacks::iterator it = service_resolver_callbacks_.find(id); |
| 238 if (it != service_resolver_callbacks_.end() && !it->second.is_null()) | 237 if (it != service_resolver_callbacks_.end() && !it->second.is_null()) |
| 239 it->second.Run(status, description); | 238 it->second.Run(status, description); |
| 240 } | 239 } |
| 241 | 240 |
| 242 } // namespace local_discovery | 241 } // namespace local_discovery |
| OLD | NEW |