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 // 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 #endif | 489 #endif |
490 new IPC::ChannelProxy( | 490 new IPC::ChannelProxy( |
491 channel_id, IPC::Channel::MODE_SERVER, this, | 491 channel_id, IPC::Channel::MODE_SERVER, this, |
492 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 492 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
493 | 493 |
494 // Call the embedder first so that their IPC filters have priority. | 494 // Call the embedder first so that their IPC filters have priority. |
495 GetContentClient()->browser()->RenderProcessHostCreated(this); | 495 GetContentClient()->browser()->RenderProcessHostCreated(this); |
496 | 496 |
497 CreateMessageFilters(); | 497 CreateMessageFilters(); |
498 | 498 |
499 // Single-process mode not supported in split-dll mode. | |
500 #if !defined(CHROME_SPLIT_DLL) | |
501 if (run_renderer_in_process()) { | 499 if (run_renderer_in_process()) { |
502 // Crank up a thread and run the initialization there. With the way that | 500 // Crank up a thread and run the initialization there. With the way that |
503 // messages flow between the browser and renderer, this thread is required | 501 // messages flow between the browser and renderer, this thread is required |
504 // to prevent a deadlock in single-process mode. Since the primordial | 502 // to prevent a deadlock in single-process mode. Since the primordial |
505 // thread in the renderer process runs the WebKit code and can sometimes | 503 // thread in the renderer process runs the WebKit code and can sometimes |
506 // make blocking calls to the UI thread (i.e. this thread), they need to run | 504 // make blocking calls to the UI thread (i.e. this thread), they need to run |
507 // on separate threads. | 505 // on separate threads. |
508 in_process_renderer_.reset(new RendererMainThread(channel_id)); | 506 in_process_renderer_.reset(new RendererMainThread(channel_id)); |
509 | 507 |
510 base::Thread::Options options; | 508 base::Thread::Options options; |
511 #if defined(OS_WIN) && !defined(OS_MACOSX) | 509 #if defined(OS_WIN) && !defined(OS_MACOSX) |
512 // In-process plugins require this to be a UI message loop. | 510 // In-process plugins require this to be a UI message loop. |
513 options.message_loop_type = base::MessageLoop::TYPE_UI; | 511 options.message_loop_type = base::MessageLoop::TYPE_UI; |
514 #else | 512 #else |
515 // We can't have multiple UI loops on Linux and Android, so we don't support | 513 // We can't have multiple UI loops on Linux and Android, so we don't support |
516 // in-process plugins. | 514 // in-process plugins. |
517 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 515 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
518 #endif | 516 #endif |
519 in_process_renderer_->StartWithOptions(options); | 517 in_process_renderer_->StartWithOptions(options); |
520 | 518 |
521 OnProcessLaunched(); // Fake a callback that the process is ready. | 519 OnProcessLaunched(); // Fake a callback that the process is ready. |
522 } else | 520 } else { |
523 #endif // !CHROME_SPLIT_DLL | |
524 { | |
525 // Build command line for renderer. We call AppendRendererCommandLine() | 521 // Build command line for renderer. We call AppendRendererCommandLine() |
526 // first so the process type argument will appear first. | 522 // first so the process type argument will appear first. |
527 CommandLine* cmd_line = new CommandLine(renderer_path); | 523 CommandLine* cmd_line = new CommandLine(renderer_path); |
528 if (!renderer_prefix.empty()) | 524 if (!renderer_prefix.empty()) |
529 cmd_line->PrependWrapper(renderer_prefix); | 525 cmd_line->PrependWrapper(renderer_prefix); |
530 AppendRendererCommandLine(cmd_line); | 526 AppendRendererCommandLine(cmd_line); |
531 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 527 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
532 | 528 |
533 // Spawn the child process asynchronously to avoid blocking the UI thread. | 529 // Spawn the child process asynchronously to avoid blocking the UI thread. |
534 // As long as there's no renderer prefix, we can use the zygote process | 530 // As long as there's no renderer prefix, we can use the zygote process |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 TRACE_EVENT0("renderer_host", | 1742 TRACE_EVENT0("renderer_host", |
1747 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1743 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1748 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1744 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1749 ack_params.sync_point = 0; | 1745 ack_params.sync_point = 0; |
1750 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1746 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1751 gpu_process_host_id, | 1747 gpu_process_host_id, |
1752 ack_params); | 1748 ack_params); |
1753 } | 1749 } |
1754 | 1750 |
1755 } // namespace content | 1751 } // namespace content |
OLD | NEW |