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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 #endif 381 #endif
382 382
383 channel_ = 383 channel_ =
384 IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(), 384 IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(),
385 ChildProcess::current()->GetShutDownEvent()); 385 ChildProcess::current()->GetShutDownEvent());
386 #ifdef IPC_MESSAGE_LOG_ENABLED 386 #ifdef IPC_MESSAGE_LOG_ENABLED
387 if (!IsInBrowserProcess()) 387 if (!IsInBrowserProcess())
388 IPC::Logging::GetInstance()->SetIPCSender(this); 388 IPC::Logging::GetInstance()->SetIPCSender(this);
389 #endif 389 #endif
390 390
391 mojo_ipc_support_.reset(new IPC::ScopedIPCSupport(GetIOTaskRunner())); 391 if (!IsInBrowserProcess()) {
392 // Don't double-initialize IPC support in single-process mode.
393 mojo_ipc_support_.reset(new IPC::ScopedIPCSupport(GetIOTaskRunner()));
394 }
395
392 mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); 396 mojo_application_.reset(new MojoApplication(GetIOTaskRunner()));
393 397
394 sync_message_filter_ = channel_->CreateSyncMessageFilter(); 398 sync_message_filter_ = channel_->CreateSyncMessageFilter();
395 thread_safe_sender_ = new ThreadSafeSender( 399 thread_safe_sender_ = new ThreadSafeSender(
396 message_loop_->task_runner(), sync_message_filter_.get()); 400 message_loop_->task_runner(), sync_message_filter_.get());
397 401
398 resource_dispatcher_.reset(new ResourceDispatcher( 402 resource_dispatcher_.reset(new ResourceDispatcher(
399 this, message_loop()->task_runner())); 403 this, message_loop()->task_runner()));
400 websocket_dispatcher_.reset(new WebSocketDispatcher); 404 websocket_dispatcher_.reset(new WebSocketDispatcher);
401 file_system_dispatcher_.reset(new FileSystemDispatcher()); 405 file_system_dispatcher_.reset(new FileSystemDispatcher());
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 684 }
681 685
682 void ChildThreadImpl::OnBindExternalMojoShellHandle( 686 void ChildThreadImpl::OnBindExternalMojoShellHandle(
683 const IPC::PlatformFileForTransit& file) { 687 const IPC::PlatformFileForTransit& file) {
684 #if defined(MOJO_SHELL_CLIENT) 688 #if defined(MOJO_SHELL_CLIENT)
685 #if defined(OS_POSIX) 689 #if defined(OS_POSIX)
686 base::PlatformFile handle = file.fd; 690 base::PlatformFile handle = file.fd;
687 #elif defined(OS_WIN) 691 #elif defined(OS_WIN)
688 base::PlatformFile handle = file; 692 base::PlatformFile handle = file;
689 #endif 693 #endif
690 mojo::ScopedMessagePipeHandle message_pipe = 694 mojo_shell_channel_init_.Init(
691 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); 695 handle, GetIOTaskRunner(),
692 DCHECK(message_pipe.is_valid()); 696 base::Bind(&MojoShellConnectionImpl::BindToMessagePipe,
693 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(message_pipe)); 697 base::Unretained(MojoShellConnectionImpl::Get())));
694 #endif // defined(MOJO_SHELL_CLIENT) 698 #endif // defined(MOJO_SHELL_CLIENT)
695 } 699 }
696 700
697 void ChildThreadImpl::OnSetMojoParentPipeHandle( 701 void ChildThreadImpl::OnSetMojoParentPipeHandle(
698 const IPC::PlatformFileForTransit& file) { 702 const IPC::PlatformFileForTransit& file) {
699 mojo::embedder::SetParentPipeHandle( 703 mojo::embedder::SetParentPipeHandle(
700 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( 704 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle(
701 IPC::PlatformFileForTransitToPlatformFile(file)))); 705 IPC::PlatformFileForTransitToPlatformFile(file))));
702 } 706 }
703 707
(...skipping 27 matching lines...) Expand all
731 void ChildThreadImpl::EnsureConnected() { 735 void ChildThreadImpl::EnsureConnected() {
732 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 736 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
733 base::Process::Current().Terminate(0, false); 737 base::Process::Current().Terminate(0, false);
734 } 738 }
735 739
736 bool ChildThreadImpl::IsInBrowserProcess() const { 740 bool ChildThreadImpl::IsInBrowserProcess() const {
737 return browser_process_io_runner_; 741 return browser_process_io_runner_;
738 } 742 }
739 743
740 } // namespace content 744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698