Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Side by Side Diff: chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc

Issue 2766263009: Convert content ConnectionFilter to OnBindInterface (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 DCHECK(!weak_utility_process_host_); 47 DCHECK(!weak_utility_process_host_);
48 DVLOG(1) << "Attempting to create utility process for proxy resolver"; 48 DVLOG(1) << "Attempting to create utility process for proxy resolver";
49 content::UtilityProcessHost* utility_process_host = 49 content::UtilityProcessHost* utility_process_host =
50 content::UtilityProcessHost::Create( 50 content::UtilityProcessHost::Create(
51 scoped_refptr<content::UtilityProcessHostClient>(), 51 scoped_refptr<content::UtilityProcessHostClient>(),
52 base::ThreadTaskRunnerHandle::Get()); 52 base::ThreadTaskRunnerHandle::Get());
53 utility_process_host->SetName(l10n_util::GetStringUTF16( 53 utility_process_host->SetName(l10n_util::GetStringUTF16(
54 IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME)); 54 IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME));
55 bool process_started = utility_process_host->Start(); 55 bool process_started = utility_process_host->Start();
56 if (process_started) { 56 if (process_started) {
57 utility_process_host->GetRemoteInterfaces()->GetInterface( 57 BindInterface(utility_process_host, &resolver_factory_);
58 &resolver_factory_);
59 resolver_factory_.set_connection_error_handler( 58 resolver_factory_.set_connection_error_handler(
60 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnConnectionError, 59 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnConnectionError,
61 base::Unretained(this))); 60 base::Unretained(this)));
62 weak_utility_process_host_ = utility_process_host->AsWeakPtr(); 61 weak_utility_process_host_ = utility_process_host->AsWeakPtr();
63 } else { 62 } else {
64 LOG(ERROR) << "Unable to connect to utility process"; 63 LOG(ERROR) << "Unable to connect to utility process";
65 } 64 }
66 } 65 }
67 66
68 std::unique_ptr<base::ScopedClosureRunner> 67 std::unique_ptr<base::ScopedClosureRunner>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 112 }
114 } 113 }
115 114
116 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { 115 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() {
117 DCHECK(thread_checker_.CalledOnValidThread()); 116 DCHECK(thread_checker_.CalledOnValidThread());
118 DCHECK_EQ(num_proxy_resolvers_, 0u); 117 DCHECK_EQ(num_proxy_resolvers_, 0u);
119 delete weak_utility_process_host_.get(); 118 delete weak_utility_process_host_.get();
120 weak_utility_process_host_.reset(); 119 weak_utility_process_host_.reset();
121 resolver_factory_.reset(); 120 resolver_factory_.reset();
122 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698