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

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

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test 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
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/arc_bridge_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_bootstrap.h" 5 #include "components/arc/arc_bridge_bootstrap.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "base/threading/worker_pool.h" 18 #include "base/threading/worker_pool.h"
19 #include "chromeos/dbus/dbus_method_call_status.h" 19 #include "chromeos/dbus/dbus_method_call_status.h"
20 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
21 #include "chromeos/dbus/session_manager_client.h" 21 #include "chromeos/dbus/session_manager_client.h"
22 #include "ipc/unix_domain_socket_util.h" 22 #include "ipc/unix_domain_socket_util.h"
23 #include "mojo/edk/embedder/embedder.h"
24 #include "mojo/edk/embedder/platform_channel_pair.h"
25 #include "mojo/edk/embedder/scoped_platform_handle.h"
23 #include "mojo/public/cpp/bindings/binding.h" 26 #include "mojo/public/cpp/bindings/binding.h"
24 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
25 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
26 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
27 27
28 namespace arc { 28 namespace arc {
29 29
30 namespace { 30 namespace {
31 31
32 const base::FilePath::CharType kArcBridgeSocketPath[] = 32 const base::FilePath::CharType kArcBridgeSocketPath[] =
33 FILE_PATH_LITERAL("/var/run/chrome/arc_bridge.sock"); 33 FILE_PATH_LITERAL("/var/run/chrome/arc_bridge.sock");
34 34
35 void OnChannelCreated(mojo::embedder::ChannelInfo* channel) {}
36
37 class ArcBridgeBootstrapImpl : public ArcBridgeBootstrap { 35 class ArcBridgeBootstrapImpl : public ArcBridgeBootstrap {
38 public: 36 public:
39 // The possible states of the bootstrap connection. In the normal flow, 37 // The possible states of the bootstrap connection. In the normal flow,
40 // the state changes in the following sequence: 38 // the state changes in the following sequence:
41 // 39 //
42 // STOPPED 40 // STOPPED
43 // Start() -> 41 // Start() ->
44 // SOCKET_CREATING 42 // SOCKET_CREATING
45 // CreateSocket() -> OnSocketCreated() -> 43 // CreateSocket() -> OnSocketCreated() ->
46 // STARTING 44 // STARTING
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return base::ScopedFD(raw_fd); 225 return base::ScopedFD(raw_fd);
228 } 226 }
229 227
230 void ArcBridgeBootstrapImpl::OnInstanceConnected(base::ScopedFD fd) { 228 void ArcBridgeBootstrapImpl::OnInstanceConnected(base::ScopedFD fd) {
231 DCHECK(thread_checker_.CalledOnValidThread()); 229 DCHECK(thread_checker_.CalledOnValidThread());
232 if (state_ != State::STARTED) { 230 if (state_ != State::STARTED) {
233 VLOG(1) << "Stop() called when ARC is not running"; 231 VLOG(1) << "Stop() called when ARC is not running";
234 return; 232 return;
235 } 233 }
236 SetState(State::READY); 234 SetState(State::READY);
237 mojo::ScopedMessagePipeHandle server_pipe = mojo::embedder::CreateChannel( 235 mojo::ScopedMessagePipeHandle server_pipe = mojo::edk::CreateMessagePipe(
238 mojo::embedder::ScopedPlatformHandle( 236 mojo::edk::ScopedPlatformHandle(
239 mojo::embedder::PlatformHandle(fd.release())), 237 mojo::edk::PlatformHandle(fd.release())));
240 base::Bind(&OnChannelCreated), base::ThreadTaskRunnerHandle::Get());
241 ArcBridgeInstancePtr instance; 238 ArcBridgeInstancePtr instance;
242 instance.Bind( 239 instance.Bind(
243 mojo::InterfacePtrInfo<ArcBridgeInstance>(std::move(server_pipe), 0u)); 240 mojo::InterfacePtrInfo<ArcBridgeInstance>(std::move(server_pipe), 0u));
244 delegate_->OnConnectionEstablished(std::move(instance)); 241 delegate_->OnConnectionEstablished(std::move(instance));
245 } 242 }
246 243
247 void ArcBridgeBootstrapImpl::Stop() { 244 void ArcBridgeBootstrapImpl::Stop() {
248 DCHECK(thread_checker_.CalledOnValidThread()); 245 DCHECK(thread_checker_.CalledOnValidThread());
249 if (state_ == State::STOPPED || state_ == State::STOPPING) { 246 if (state_ == State::STOPPED || state_ == State::STOPPING) {
250 VLOG(1) << "Stop() called when ARC is not running"; 247 VLOG(1) << "Stop() called when ARC is not running";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 282
286 ArcBridgeBootstrap::ArcBridgeBootstrap() {} 283 ArcBridgeBootstrap::ArcBridgeBootstrap() {}
287 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} 284 ArcBridgeBootstrap::~ArcBridgeBootstrap() {}
288 285
289 // static 286 // static
290 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { 287 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() {
291 return make_scoped_ptr(new ArcBridgeBootstrapImpl()); 288 return make_scoped_ptr(new ArcBridgeBootstrapImpl());
292 } 289 }
293 290
294 } // namespace arc 291 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/arc_bridge_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698