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

Side by Side Diff: components/arc/arc_bridge_service_impl.cc

Issue 1635603002: Make use of CreateInterfacePtrAndBind() where appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 11 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 "components/arc/arc_bridge_service_impl.h" 5 #include "components/arc/arc_bridge_service_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DCHECK(CalledOnValidThread()); 94 DCHECK(CalledOnValidThread());
95 if (state() != State::CONNECTING) { 95 if (state() != State::CONNECTING) {
96 VLOG(1) << "StopInstance() called while connecting"; 96 VLOG(1) << "StopInstance() called while connecting";
97 return; 97 return;
98 } 98 }
99 99
100 instance_ptr_ = std::move(instance); 100 instance_ptr_ = std::move(instance);
101 instance_ptr_.set_connection_error_handler(base::Bind( 101 instance_ptr_.set_connection_error_handler(base::Bind(
102 &ArcBridgeServiceImpl::OnChannelClosed, weak_factory_.GetWeakPtr())); 102 &ArcBridgeServiceImpl::OnChannelClosed, weak_factory_.GetWeakPtr()));
103 103
104 ArcBridgeHostPtr host; 104 instance_ptr_->Init(binding_.CreateInterfacePtrAndBind());
105 binding_.Bind(GetProxy(&host));
106 instance_ptr_->Init(std::move(host));
107 105
108 SetState(State::READY); 106 SetState(State::READY);
109 } 107 }
110 108
111 void ArcBridgeServiceImpl::OnStopped() { 109 void ArcBridgeServiceImpl::OnStopped() {
112 DCHECK(CalledOnValidThread()); 110 DCHECK(CalledOnValidThread());
113 SetState(State::STOPPED); 111 SetState(State::STOPPED);
114 if (reconnect_) { 112 if (reconnect_) {
115 // There was a previous invocation and it crashed for some reason. Try 113 // There was a previous invocation and it crashed for some reason. Try
116 // starting the container again. 114 // starting the container again.
117 reconnect_ = false; 115 reconnect_ = false;
118 PrerequisitesChanged(); 116 PrerequisitesChanged();
119 } 117 }
120 } 118 }
121 119
122 void ArcBridgeServiceImpl::OnChannelClosed() { 120 void ArcBridgeServiceImpl::OnChannelClosed() {
123 DCHECK(CalledOnValidThread()); 121 DCHECK(CalledOnValidThread());
124 if (state() == State::STOPPED || state() == State::STOPPING) { 122 if (state() == State::STOPPED || state() == State::STOPPING) {
125 // This will happen when the instance is shut down. Ignore that case. 123 // This will happen when the instance is shut down. Ignore that case.
126 return; 124 return;
127 } 125 }
128 VLOG(1) << "Mojo connection lost"; 126 VLOG(1) << "Mojo connection lost";
129 CloseAllChannels(); 127 CloseAllChannels();
130 reconnect_ = true; 128 reconnect_ = true;
131 StopInstance(); 129 StopInstance();
132 } 130 }
133 131
134 } // namespace arc 132 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc ('k') | components/arc/clipboard/arc_clipboard_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698