| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 BrowserThread::IO, | 218 BrowserThread::IO, |
| 219 FROM_HERE, | 219 FROM_HERE, |
| 220 base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this)); | 220 base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ServiceDiscoveryHostClient::StartOnIOThread() { | 223 void ServiceDiscoveryHostClient::StartOnIOThread() { |
| 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 225 utility_host_ = UtilityProcessHost::Create( | 225 utility_host_ = UtilityProcessHost::Create( |
| 226 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); | 226 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); |
| 227 if (utility_host_) { | 227 if (utility_host_) { |
| 228 // Temporary to test things on mac. |
| 229 utility_host_->DisableSandbox(); |
| 228 utility_host_->EnableZygote(); | 230 utility_host_->EnableZygote(); |
| 229 utility_host_->EnableMDns(); | 231 utility_host_->EnableMDns(); |
| 230 utility_host_->StartBatchMode(); | 232 utility_host_->StartBatchMode(); |
| 231 } | 233 } |
| 232 } | 234 } |
| 233 | 235 |
| 234 void ServiceDiscoveryHostClient::ShutdownOnIOThread() { | 236 void ServiceDiscoveryHostClient::ShutdownOnIOThread() { |
| 235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 236 if (utility_host_) { | 238 if (utility_host_) { |
| 237 utility_host_->Send(new LocalDiscoveryMsg_ShutdownLocalDiscovery); | 239 utility_host_->Send(new LocalDiscoveryMsg_ShutdownLocalDiscovery); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 void ServiceDiscoveryHostClientFactory::ReleaseClientInternal() { | 371 void ServiceDiscoveryHostClientFactory::ReleaseClientInternal() { |
| 370 DCHECK(CalledOnValidThread()); | 372 DCHECK(CalledOnValidThread()); |
| 371 references_--; | 373 references_--; |
| 372 if (references_ == 0) { | 374 if (references_ == 0) { |
| 373 instance_->Shutdown(); | 375 instance_->Shutdown(); |
| 374 instance_ = NULL; | 376 instance_ = NULL; |
| 375 } | 377 } |
| 376 } | 378 } |
| 377 | 379 |
| 378 } // namespace local_discovery | 380 } // namespace local_discovery |
| OLD | NEW |