| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 // Note: When we create the RenderProcessHostImpl, it's technically | 421 // Note: When we create the RenderProcessHostImpl, it's technically |
| 422 // backgrounded, because it has no visible listeners. But the process | 422 // backgrounded, because it has no visible listeners. But the process |
| 423 // doesn't actually exist yet, so we'll Background it later, after | 423 // doesn't actually exist yet, so we'll Background it later, after |
| 424 // creation. | 424 // creation. |
| 425 } | 425 } |
| 426 | 426 |
| 427 RenderProcessHostImpl::~RenderProcessHostImpl() { | 427 RenderProcessHostImpl::~RenderProcessHostImpl() { |
| 428 DCHECK(!run_renderer_in_process()); | 428 DCHECK(!run_renderer_in_process()); |
| 429 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); | 429 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); |
| 430 GpuDataManagerImpl::GetInstance()->RemoveObserver(this); |
| 430 | 431 |
| 431 // We may have some unsent messages at this point, but that's OK. | 432 // We may have some unsent messages at this point, but that's OK. |
| 432 channel_.reset(); | 433 channel_.reset(); |
| 433 while (!queued_messages_.empty()) { | 434 while (!queued_messages_.empty()) { |
| 434 delete queued_messages_.front(); | 435 delete queued_messages_.front(); |
| 435 queued_messages_.pop(); | 436 queued_messages_.pop(); |
| 436 } | 437 } |
| 437 | 438 |
| 438 ClearTransportDIBCache(); | 439 ClearTransportDIBCache(); |
| 439 UnregisterHost(GetID()); | 440 UnregisterHost(GetID()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 base::EnvironmentVector(), | 545 base::EnvironmentVector(), |
| 545 channel_->TakeClientFileDescriptor(), | 546 channel_->TakeClientFileDescriptor(), |
| 546 #endif | 547 #endif |
| 547 cmd_line, | 548 cmd_line, |
| 548 GetID(), | 549 GetID(), |
| 549 this)); | 550 this)); |
| 550 | 551 |
| 551 fast_shutdown_started_ = false; | 552 fast_shutdown_started_ = false; |
| 552 } | 553 } |
| 553 | 554 |
| 555 GpuDataManagerImpl::GetInstance()->AddObserver(this); |
| 556 |
| 554 is_initialized_ = true; | 557 is_initialized_ = true; |
| 555 return true; | 558 return true; |
| 556 } | 559 } |
| 557 | 560 |
| 558 void RenderProcessHostImpl::CreateMessageFilters() { | 561 void RenderProcessHostImpl::CreateMessageFilters() { |
| 559 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 560 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); | 563 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); |
| 561 MediaInternals* media_internals = MediaInternals::GetInstance();; | 564 MediaInternals* media_internals = MediaInternals::GetInstance();; |
| 562 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 565 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
| 563 // from guests. | 566 // from guests. |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 int32 gpu_process_host_id) { | 1757 int32 gpu_process_host_id) { |
| 1755 TRACE_EVENT0("renderer_host", | 1758 TRACE_EVENT0("renderer_host", |
| 1756 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1759 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1757 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1760 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1758 ack_params.sync_point = 0; | 1761 ack_params.sync_point = 0; |
| 1759 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1762 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1760 gpu_process_host_id, | 1763 gpu_process_host_id, |
| 1761 ack_params); | 1764 ack_params); |
| 1762 } | 1765 } |
| 1763 | 1766 |
| 1767 void RenderProcessHostImpl::OnGpuSwitching() { |
| 1768 for (RenderWidgetHostsIterator iter = GetRenderWidgetHostsIterator(); |
| 1769 !iter.IsAtEnd(); |
| 1770 iter.Advance()) { |
| 1771 const RenderWidgetHost* widget = iter.GetCurrentValue(); |
| 1772 DCHECK(widget); |
| 1773 if (!widget || !widget->IsRenderView()) |
| 1774 continue; |
| 1775 |
| 1776 RenderViewHost* rvh = |
| 1777 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); |
| 1778 |
| 1779 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); |
| 1780 } |
| 1781 } |
| 1782 |
| 1764 } // namespace content | 1783 } // namespace content |
| OLD | NEW |