OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 void ChildThreadImpl::ConnectChannel() { | 388 void ChildThreadImpl::ConnectChannel() { |
389 std::string channel_token; | 389 std::string channel_token; |
390 mojo::ScopedMessagePipeHandle handle; | 390 mojo::ScopedMessagePipeHandle handle; |
391 if (!IsInBrowserProcess()) { | 391 if (!IsInBrowserProcess()) { |
392 channel_token = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 392 channel_token = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
393 switches::kMojoChannelToken); | 393 switches::kMojoChannelToken); |
394 } | 394 } |
395 | 395 |
396 if (!channel_token.empty()) { | 396 if (!channel_token.empty()) { |
397 // TODO(rockot): Remove all paths which lead to this branch. The Channel | 397 // TODO(rockot): Remove all paths which lead to this branch. The Channel |
398 // connection should always be established by a shell connection from the | 398 // connection should always be established by a service manager connection |
399 // browser. http://crbug.com/623396. | 399 // from the browser. http://crbug.com/623396. |
400 handle = mojo::edk::CreateChildMessagePipe(channel_token); | 400 handle = mojo::edk::CreateChildMessagePipe(channel_token); |
401 } else { | 401 } else { |
402 DCHECK(service_manager_connection_); | 402 DCHECK(service_manager_connection_); |
403 IPC::mojom::ChannelBootstrapPtr bootstrap; | 403 IPC::mojom::ChannelBootstrapPtr bootstrap; |
404 handle = mojo::GetProxy(&bootstrap).PassMessagePipe(); | 404 handle = mojo::GetProxy(&bootstrap).PassMessagePipe(); |
405 service_manager_connection_->AddConnectionFilter( | 405 service_manager_connection_->AddConnectionFilter( |
406 base::MakeUnique<ChannelBootstrapFilter>(bootstrap.PassInterface())); | 406 base::MakeUnique<ChannelBootstrapFilter>(bootstrap.PassInterface())); |
407 } | 407 } |
408 | 408 |
409 DCHECK(handle.is_valid()); | 409 DCHECK(handle.is_valid()); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 Listener* route = router_.GetRoute(routing_id); | 864 Listener* route = router_.GetRoute(routing_id); |
865 if (route) | 865 if (route) |
866 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 866 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
867 } | 867 } |
868 | 868 |
869 bool ChildThreadImpl::IsInBrowserProcess() const { | 869 bool ChildThreadImpl::IsInBrowserProcess() const { |
870 return static_cast<bool>(browser_process_io_runner_); | 870 return static_cast<bool>(browser_process_io_runner_); |
871 } | 871 } |
872 | 872 |
873 } // namespace content | 873 } // namespace content |
OLD | NEW |