| 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/nacl/common/nacl_service.h" | 5 #include "components/nacl/common/nacl_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.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 Loading... |
| 47 switches::kServiceRequestChannelToken); | 47 switches::kServiceRequestChannelToken); |
| 48 DCHECK(!service_request_channel_token.empty()); | 48 DCHECK(!service_request_channel_token.empty()); |
| 49 mojo::ScopedMessagePipeHandle parent_handle = | 49 mojo::ScopedMessagePipeHandle parent_handle = |
| 50 mojo::edk::CreateChildMessagePipe(service_request_channel_token); | 50 mojo::edk::CreateChildMessagePipe(service_request_channel_token); |
| 51 DCHECK(parent_handle.is_valid()); | 51 DCHECK(parent_handle.is_valid()); |
| 52 return mojo::MakeRequest<service_manager::mojom::Service>( | 52 return mojo::MakeRequest<service_manager::mojom::Service>( |
| 53 std::move(parent_handle)); | 53 std::move(parent_handle)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ConnectBootstrapChannel(IPC::mojom::ChannelBootstrapPtrInfo ptr, | 56 void ConnectBootstrapChannel(IPC::mojom::ChannelBootstrapPtrInfo ptr, |
| 57 const service_manager::BindSourceInfo& source_info, |
| 57 IPC::mojom::ChannelBootstrapRequest request) { | 58 IPC::mojom::ChannelBootstrapRequest request) { |
| 58 mojo::FuseInterface(std::move(request), std::move(ptr)); | 59 mojo::FuseInterface(std::move(request), std::move(ptr)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 class NaClService : public service_manager::Service { | 62 class NaClService : public service_manager::Service { |
| 62 public: | 63 public: |
| 63 NaClService(IPC::mojom::ChannelBootstrapPtrInfo bootstrap, | 64 NaClService(IPC::mojom::ChannelBootstrapPtrInfo bootstrap, |
| 64 std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support); | 65 std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support); |
| 65 ~NaClService() override; | 66 ~NaClService() override; |
| 66 | 67 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST); | 110 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST); |
| 110 EstablishMojoConnection(); | 111 EstablishMojoConnection(); |
| 111 | 112 |
| 112 IPC::mojom::ChannelBootstrapPtr bootstrap; | 113 IPC::mojom::ChannelBootstrapPtr bootstrap; |
| 113 *ipc_channel = mojo::MakeRequest(&bootstrap).PassMessagePipe(); | 114 *ipc_channel = mojo::MakeRequest(&bootstrap).PassMessagePipe(); |
| 114 return base::MakeUnique<service_manager::ServiceContext>( | 115 return base::MakeUnique<service_manager::ServiceContext>( |
| 115 base::MakeUnique<NaClService>(bootstrap.PassInterface(), | 116 base::MakeUnique<NaClService>(bootstrap.PassInterface(), |
| 116 std::move(ipc_support)), | 117 std::move(ipc_support)), |
| 117 ConnectToServiceManager()); | 118 ConnectToServiceManager()); |
| 118 } | 119 } |
| OLD | NEW |