| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_host_impl.h" | 5 #include "components/arc/arc_bridge_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 mojom::VideoInstancePtr video_ptr) { | 193 mojom::VideoInstancePtr video_ptr) { |
| 194 OnInstanceReady(ArcBridgeService::Get()->video(), std::move(video_ptr)); | 194 OnInstanceReady(ArcBridgeService::Get()->video(), std::move(video_ptr)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ArcBridgeHostImpl::OnWallpaperInstanceReady( | 197 void ArcBridgeHostImpl::OnWallpaperInstanceReady( |
| 198 mojom::WallpaperInstancePtr wallpaper_ptr) { | 198 mojom::WallpaperInstancePtr wallpaper_ptr) { |
| 199 OnInstanceReady(ArcBridgeService::Get()->wallpaper(), | 199 OnInstanceReady(ArcBridgeService::Get()->wallpaper(), |
| 200 std::move(wallpaper_ptr)); | 200 std::move(wallpaper_ptr)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void ArcBridgeHostImpl::OnTraceInstanceReady( |
| 204 mojom::TraceInstancePtr trace_ptr) { |
| 205 OnInstanceReady(ArcBridgeService::Get()->trace(), |
| 206 std::move(trace_ptr)); |
| 207 } |
| 208 |
| 203 void ArcBridgeHostImpl::OnClosed() { | 209 void ArcBridgeHostImpl::OnClosed() { |
| 204 DCHECK(thread_checker_.CalledOnValidThread()); | 210 DCHECK(thread_checker_.CalledOnValidThread()); |
| 205 VLOG(1) << "Mojo connection lost"; | 211 VLOG(1) << "Mojo connection lost"; |
| 206 | 212 |
| 207 // Close all mojo channels. | 213 // Close all mojo channels. |
| 208 mojo_channels_.clear(); | 214 mojo_channels_.clear(); |
| 209 instance_.reset(); | 215 instance_.reset(); |
| 210 if (binding_.is_bound()) | 216 if (binding_.is_bound()) |
| 211 binding_.Close(); | 217 binding_.Close(); |
| 212 } | 218 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 238 void ArcBridgeHostImpl::OnChannelClosed(MojoChannel* channel) { | 244 void ArcBridgeHostImpl::OnChannelClosed(MojoChannel* channel) { |
| 239 DCHECK(thread_checker_.CalledOnValidThread()); | 245 DCHECK(thread_checker_.CalledOnValidThread()); |
| 240 mojo_channels_.erase( | 246 mojo_channels_.erase( |
| 241 std::find_if(mojo_channels_.begin(), mojo_channels_.end(), | 247 std::find_if(mojo_channels_.begin(), mojo_channels_.end(), |
| 242 [channel](std::unique_ptr<MojoChannel>& ptr) { | 248 [channel](std::unique_ptr<MojoChannel>& ptr) { |
| 243 return ptr.get() == channel; | 249 return ptr.get() == channel; |
| 244 })); | 250 })); |
| 245 } | 251 } |
| 246 | 252 |
| 247 } // namespace arc | 253 } // namespace arc |
| OLD | NEW |