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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2238633003: Revert renderer IPC::Channel acquisition via shell connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // Crank up a thread and run the initialization there. With the way that 827 // Crank up a thread and run the initialization there. With the way that
828 // messages flow between the browser and renderer, this thread is required 828 // messages flow between the browser and renderer, this thread is required
829 // to prevent a deadlock in single-process mode. Since the primordial 829 // to prevent a deadlock in single-process mode. Since the primordial
830 // thread in the renderer process runs the WebKit code and can sometimes 830 // thread in the renderer process runs the WebKit code and can sometimes
831 // make blocking calls to the UI thread (i.e. this thread), they need to run 831 // make blocking calls to the UI thread (i.e. this thread), they need to run
832 // on separate threads. 832 // on separate threads.
833 in_process_renderer_.reset( 833 in_process_renderer_.reset(
834 g_renderer_main_thread_factory(InProcessChildThreadParams( 834 g_renderer_main_thread_factory(InProcessChildThreadParams(
835 channel_id, 835 channel_id,
836 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 836 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
837 std::string(), mojo_child_connection_->service_token()))); 837 channel_token_, mojo_child_connection_->service_token())));
838 838
839 base::Thread::Options options; 839 base::Thread::Options options;
840 #if defined(OS_WIN) && !defined(OS_MACOSX) 840 #if defined(OS_WIN) && !defined(OS_MACOSX)
841 // In-process plugins require this to be a UI message loop. 841 // In-process plugins require this to be a UI message loop.
842 options.message_loop_type = base::MessageLoop::TYPE_UI; 842 options.message_loop_type = base::MessageLoop::TYPE_UI;
843 #else 843 #else
844 // We can't have multiple UI loops on Linux and Android, so we don't support 844 // We can't have multiple UI loops on Linux and Android, so we don't support
845 // in-process plugins. 845 // in-process plugins.
846 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; 846 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT;
847 #endif 847 #endif
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 887
888 is_initialized_ = true; 888 is_initialized_ = true;
889 init_time_ = base::TimeTicks::Now(); 889 init_time_ = base::TimeTicks::Now();
890 return true; 890 return true;
891 } 891 }
892 892
893 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( 893 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
894 const std::string& channel_id) { 894 const std::string& channel_id) {
895 scoped_refptr<base::SingleThreadTaskRunner> runner = 895 scoped_refptr<base::SingleThreadTaskRunner> runner =
896 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 896 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
897 IPC::mojom::ChannelBootstrapPtr bootstrap; 897 channel_token_ = mojo::edk::GenerateRandomToken();
898 GetRemoteInterfaces()->GetInterface(&bootstrap); 898 mojo::ScopedMessagePipeHandle handle =
899 mojo::edk::CreateParentMessagePipe(channel_token_, child_token_);
899 std::unique_ptr<IPC::ChannelFactory> channel_factory = 900 std::unique_ptr<IPC::ChannelFactory> channel_factory =
900 IPC::ChannelMojo::CreateServerFactory( 901 IPC::ChannelMojo::CreateServerFactory(std::move(handle), runner);
901 bootstrap.PassInterface().PassHandle(), runner);
902 902
903 // Do NOT expand ifdef or run time condition checks here! Synchronous 903 // Do NOT expand ifdef or run time condition checks here! Synchronous
904 // IPCs from browser process are banned. It is only narrowly allowed 904 // IPCs from browser process are banned. It is only narrowly allowed
905 // for Android WebView to maintain backward compatibility. 905 // for Android WebView to maintain backward compatibility.
906 // See crbug.com/526842 for details. 906 // See crbug.com/526842 for details.
907 #if defined(OS_ANDROID) 907 #if defined(OS_ANDROID)
908 if (GetContentClient()->UsingSynchronousCompositing()) { 908 if (GetContentClient()->UsingSynchronousCompositing()) {
909 return IPC::SyncChannel::Create( 909 return IPC::SyncChannel::Create(
910 std::move(channel_factory), this, runner.get(), true, &never_signaled_); 910 std::move(channel_factory), this, runner.get(), true, &never_signaled_);
911 } 911 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 command_line->AppendSwitch(switches::kEnablePinch); 1427 command_line->AppendSwitch(switches::kEnablePinch);
1428 1428
1429 #if defined(OS_WIN) 1429 #if defined(OS_WIN)
1430 command_line->AppendSwitchASCII( 1430 command_line->AppendSwitchASCII(
1431 switches::kDeviceScaleFactor, 1431 switches::kDeviceScaleFactor,
1432 base::DoubleToString(display::win::GetDPIScale())); 1432 base::DoubleToString(display::win::GetDPIScale()));
1433 #endif 1433 #endif
1434 1434
1435 AppendCompositorCommandLineFlags(command_line); 1435 AppendCompositorCommandLineFlags(command_line);
1436 1436
1437 if (!channel_token_.empty()) {
1438 command_line->AppendSwitchASCII(
1439 switches::kMojoChannelToken, channel_token_);
1440 }
1441
1437 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, 1442 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken,
1438 mojo_child_connection_->service_token()); 1443 mojo_child_connection_->service_token());
1439 } 1444 }
1440 1445
1441 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( 1446 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
1442 const base::CommandLine& browser_cmd, 1447 const base::CommandLine& browser_cmd,
1443 base::CommandLine* renderer_cmd) const { 1448 base::CommandLine* renderer_cmd) const {
1444 // Propagate the following switches to the renderer command line (along 1449 // Propagate the following switches to the renderer command line (along
1445 // with any associated values) if present in the browser command line. 1450 // with any associated values) if present in the browser command line.
1446 static const char* const kSwitchNames[] = { 1451 static const char* const kSwitchNames[] = {
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2842 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2838 2843
2839 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2844 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2840 // enough information here so that we can determine what the bad message was. 2845 // enough information here so that we can determine what the bad message was.
2841 base::debug::Alias(&error); 2846 base::debug::Alias(&error);
2842 bad_message::ReceivedBadMessage(process.get(), 2847 bad_message::ReceivedBadMessage(process.get(),
2843 bad_message::RPH_MOJO_PROCESS_ERROR); 2848 bad_message::RPH_MOJO_PROCESS_ERROR);
2844 } 2849 }
2845 2850
2846 } // namespace content 2851 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698