| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/net/utility_process_mojo_proxy_resolver_factory.h" | 5 #include "chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" | 
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" | 
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" | 
| 11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" | 
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" | 
| 13 #include "content/public/browser/utility_process_host.h" | 13 #include "content/public/browser/utility_process_host.h" | 
| 14 #include "content/public/browser/utility_process_host_client.h" | 14 #include "content/public/browser/utility_process_host_client.h" | 
| 15 #include "content/public/common/service_registry.h" | 15 #include "content/public/common/service_registry.h" | 
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" | 
| 17 | 17 | 
| 18 namespace { | 18 namespace { | 
| 19 const int kUtilityProcessIdleTimeoutSeconds = 5; | 19 const int kUtilityProcessIdleTimeoutSeconds = 5; | 
| 20 } | 20 } | 
| 21 | 21 | 
| 22 // static | 22 // static | 
| 23 UtilityProcessMojoProxyResolverFactory* | 23 UtilityProcessMojoProxyResolverFactory* | 
| 24 UtilityProcessMojoProxyResolverFactory::GetInstance() { | 24 UtilityProcessMojoProxyResolverFactory::GetInstance() { | 
| 25   DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 25   DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 
| 26   return Singleton< | 26   return base::Singleton<UtilityProcessMojoProxyResolverFactory, | 
| 27       UtilityProcessMojoProxyResolverFactory, | 27                          base::LeakySingletonTraits< | 
| 28       LeakySingletonTraits<UtilityProcessMojoProxyResolverFactory>>::get(); | 28                              UtilityProcessMojoProxyResolverFactory>>::get(); | 
| 29 } | 29 } | 
| 30 | 30 | 
| 31 UtilityProcessMojoProxyResolverFactory:: | 31 UtilityProcessMojoProxyResolverFactory:: | 
| 32     UtilityProcessMojoProxyResolverFactory() { | 32     UtilityProcessMojoProxyResolverFactory() { | 
| 33   DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 33   DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 
| 34 } | 34 } | 
| 35 | 35 | 
| 36 UtilityProcessMojoProxyResolverFactory:: | 36 UtilityProcessMojoProxyResolverFactory:: | 
| 37     ~UtilityProcessMojoProxyResolverFactory() { | 37     ~UtilityProcessMojoProxyResolverFactory() { | 
| 38   DCHECK(thread_checker_.CalledOnValidThread()); | 38   DCHECK(thread_checker_.CalledOnValidThread()); | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107   } | 107   } | 
| 108 } | 108 } | 
| 109 | 109 | 
| 110 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { | 110 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { | 
| 111   DCHECK(thread_checker_.CalledOnValidThread()); | 111   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 112   DCHECK_EQ(num_proxy_resolvers_, 0u); | 112   DCHECK_EQ(num_proxy_resolvers_, 0u); | 
| 113   delete weak_utility_process_host_.get(); | 113   delete weak_utility_process_host_.get(); | 
| 114   weak_utility_process_host_.reset(); | 114   weak_utility_process_host_.reset(); | 
| 115   resolver_factory_.reset(); | 115   resolver_factory_.reset(); | 
| 116 } | 116 } | 
| OLD | NEW | 
|---|