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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 base::Bind(&RemoveShaderInfo, GetID())); | 432 base::Bind(&RemoveShaderInfo, GetID())); |
433 } | 433 } |
434 | 434 |
435 void RenderProcessHostImpl::EnableSendQueue() { | 435 void RenderProcessHostImpl::EnableSendQueue() { |
436 is_initialized_ = false; | 436 is_initialized_ = false; |
437 } | 437 } |
438 | 438 |
439 bool RenderProcessHostImpl::Init() { | 439 bool RenderProcessHostImpl::Init() { |
440 // calling Init() more than once does nothing, this makes it more convenient | 440 // calling Init() more than once does nothing, this makes it more convenient |
441 // for the view host which may not be sure in some cases | 441 // for the view host which may not be sure in some cases |
442 if (channel_.get()) | 442 if (channel_) |
443 return true; | 443 return true; |
444 | 444 |
445 CommandLine::StringType renderer_prefix; | 445 CommandLine::StringType renderer_prefix; |
446 #if defined(OS_POSIX) | 446 #if defined(OS_POSIX) |
447 // A command prefix is something prepended to the command line of the spawned | 447 // A command prefix is something prepended to the command line of the spawned |
448 // process. It is supported only on POSIX systems. | 448 // process. It is supported only on POSIX systems. |
449 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 449 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
450 renderer_prefix = | 450 renderer_prefix = |
451 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 451 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
452 #endif // defined(OS_POSIX) | 452 #endif // defined(OS_POSIX) |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 for (; dib != cached_dibs_.end(); ++dib) | 1076 for (; dib != cached_dibs_.end(); ++dib) |
1077 dib->second->Detach(); | 1077 dib->second->Detach(); |
1078 #else | 1078 #else |
1079 STLDeleteContainerPairSecondPointers( | 1079 STLDeleteContainerPairSecondPointers( |
1080 cached_dibs_.begin(), cached_dibs_.end()); | 1080 cached_dibs_.begin(), cached_dibs_.end()); |
1081 #endif | 1081 #endif |
1082 cached_dibs_.clear(); | 1082 cached_dibs_.clear(); |
1083 } | 1083 } |
1084 | 1084 |
1085 bool RenderProcessHostImpl::Send(IPC::Message* msg) { | 1085 bool RenderProcessHostImpl::Send(IPC::Message* msg) { |
1086 if (!channel_.get()) { | 1086 if (!channel_) { |
1087 if (!is_initialized_) { | 1087 if (!is_initialized_) { |
1088 queued_messages_.push(msg); | 1088 queued_messages_.push(msg); |
1089 return true; | 1089 return true; |
1090 } else { | 1090 } else { |
1091 delete msg; | 1091 delete msg; |
1092 return false; | 1092 return false; |
1093 } | 1093 } |
1094 } | 1094 } |
1095 | 1095 |
1096 if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) { | 1096 if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) { |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 } | 1669 } |
1670 | 1670 |
1671 void RenderProcessHostImpl::OnProcessLaunched() { | 1671 void RenderProcessHostImpl::OnProcessLaunched() { |
1672 // No point doing anything, since this object will be destructed soon. We | 1672 // No point doing anything, since this object will be destructed soon. We |
1673 // especially don't want to send the RENDERER_PROCESS_CREATED notification, | 1673 // especially don't want to send the RENDERER_PROCESS_CREATED notification, |
1674 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to | 1674 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to |
1675 // properly cleanup. | 1675 // properly cleanup. |
1676 if (deleting_soon_) | 1676 if (deleting_soon_) |
1677 return; | 1677 return; |
1678 | 1678 |
1679 if (child_process_launcher_.get()) { | 1679 if (child_process_launcher_) { |
1680 if (!child_process_launcher_->GetHandle()) { | 1680 if (!child_process_launcher_->GetHandle()) { |
1681 OnChannelError(); | 1681 OnChannelError(); |
1682 return; | 1682 return; |
1683 } | 1683 } |
1684 | 1684 |
1685 child_process_launcher_->SetProcessBackgrounded(backgrounded_); | 1685 child_process_launcher_->SetProcessBackgrounded(backgrounded_); |
1686 } | 1686 } |
1687 | 1687 |
1688 // NOTE: This needs to be before sending queued messages because | 1688 // NOTE: This needs to be before sending queued messages because |
1689 // ExtensionService uses this notification to initialize the renderer process | 1689 // ExtensionService uses this notification to initialize the renderer process |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 TRACE_EVENT0("renderer_host", | 1721 TRACE_EVENT0("renderer_host", |
1722 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1722 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1723 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1723 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1724 ack_params.sync_point = 0; | 1724 ack_params.sync_point = 0; |
1725 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1725 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
1726 gpu_process_host_id, | 1726 gpu_process_host_id, |
1727 ack_params); | 1727 ack_params); |
1728 } | 1728 } |
1729 | 1729 |
1730 } // namespace content | 1730 } // namespace content |
OLD | NEW |