Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 #include "content/browser/download/mhtml_generation_manager.h" | 49 #include "content/browser/download/mhtml_generation_manager.h" |
| 50 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 50 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 51 #include "content/browser/fileapi/fileapi_message_filter.h" | 51 #include "content/browser/fileapi/fileapi_message_filter.h" |
| 52 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 52 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 53 #include "content/browser/gpu/gpu_data_manager_impl.h" | 53 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 54 #include "content/browser/gpu/gpu_process_host.h" | 54 #include "content/browser/gpu/gpu_process_host.h" |
| 55 #include "content/browser/histogram_message_filter.h" | 55 #include "content/browser/histogram_message_filter.h" |
| 56 #include "content/browser/hyphenator/hyphenator_message_filter.h" | 56 #include "content/browser/hyphenator/hyphenator_message_filter.h" |
| 57 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 57 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
| 58 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 58 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 59 #include "content/browser/loader/resource_dispatcher_host_impl.h" | |
| 59 #include "content/browser/loader/resource_message_filter.h" | 60 #include "content/browser/loader/resource_message_filter.h" |
| 61 #include "content/browser/loader/resource_scheduler.h" | |
| 62 #include "content/browser/loader/resource_scheduler_filter.h" | |
| 60 #include "content/browser/mime_registry_message_filter.h" | 63 #include "content/browser/mime_registry_message_filter.h" |
| 61 #include "content/browser/plugin_service_impl.h" | 64 #include "content/browser/plugin_service_impl.h" |
| 62 #include "content/browser/profiler_message_filter.h" | 65 #include "content/browser/profiler_message_filter.h" |
| 63 #include "content/browser/renderer_host/clipboard_message_filter.h" | 66 #include "content/browser/renderer_host/clipboard_message_filter.h" |
| 64 #include "content/browser/renderer_host/database_message_filter.h" | 67 #include "content/browser/renderer_host/database_message_filter.h" |
| 65 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 68 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
| 66 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" | 69 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" |
| 67 #include "content/browser/renderer_host/gpu_message_filter.h" | 70 #include "content/browser/renderer_host/gpu_message_filter.h" |
| 68 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 71 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
| 69 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 72 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 | 475 |
| 473 fast_shutdown_started_ = false; | 476 fast_shutdown_started_ = false; |
| 474 } | 477 } |
| 475 | 478 |
| 476 is_initialized_ = true; | 479 is_initialized_ = true; |
| 477 return true; | 480 return true; |
| 478 } | 481 } |
| 479 | 482 |
| 480 void RenderProcessHostImpl::CreateMessageFilters() { | 483 void RenderProcessHostImpl::CreateMessageFilters() { |
| 481 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 484 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 485 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); | |
| 482 MediaObserver* media_observer = | 486 MediaObserver* media_observer = |
| 483 GetContentClient()->browser()->GetMediaObserver(); | 487 GetContentClient()->browser()->GetMediaObserver(); |
| 484 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 488 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
| 485 // from guests. | 489 // from guests. |
| 486 if (IsGuest()) { | 490 if (IsGuest()) { |
| 487 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 491 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
| 488 new BrowserPluginMessageFilter( | 492 new BrowserPluginMessageFilter( |
| 489 GetID(), | 493 GetID(), |
| 490 GetBrowserContext())); | 494 GetBrowserContext())); |
| 491 channel_->AddFilter(bp_message_filter); | 495 channel_->AddFilter(bp_message_filter); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 ignore_input_events_ = ignore_input_events; | 1101 ignore_input_events_ = ignore_input_events; |
| 1098 } | 1102 } |
| 1099 | 1103 |
| 1100 bool RenderProcessHostImpl::IgnoreInputEvents() const { | 1104 bool RenderProcessHostImpl::IgnoreInputEvents() const { |
| 1101 return ignore_input_events_; | 1105 return ignore_input_events_; |
| 1102 } | 1106 } |
| 1103 | 1107 |
| 1104 void RenderProcessHostImpl::Attach(RenderWidgetHost* host, | 1108 void RenderProcessHostImpl::Attach(RenderWidgetHost* host, |
| 1105 int routing_id) { | 1109 int routing_id) { |
| 1106 render_widget_hosts_.AddWithID(host, routing_id); | 1110 render_widget_hosts_.AddWithID(host, routing_id); |
| 1111 if (ResourceDispatcherHostImpl::Get()) { | |
| 1112 ResourceDispatcherHostImpl::Get()->scheduler()->OnCreate( | |
|
darin (slow to review)
2012/12/14 22:16:28
Isn't there some potential raciness here? I could
James Simonsen
2012/12/15 02:58:57
Done.
| |
| 1113 GetID(), routing_id); | |
| 1114 } | |
| 1107 } | 1115 } |
| 1108 | 1116 |
| 1109 void RenderProcessHostImpl::Release(int routing_id) { | 1117 void RenderProcessHostImpl::Release(int routing_id) { |
| 1110 DCHECK(render_widget_hosts_.Lookup(routing_id) != NULL); | 1118 DCHECK(render_widget_hosts_.Lookup(routing_id) != NULL); |
| 1111 render_widget_hosts_.Remove(routing_id); | 1119 render_widget_hosts_.Remove(routing_id); |
| 1112 | 1120 |
| 1113 // Make sure that all associated resource requests are stopped. | 1121 // Make sure that all associated resource requests are stopped. |
| 1114 CancelResourceRequests(routing_id); | 1122 CancelResourceRequests(routing_id); |
| 1115 | 1123 |
| 1116 #if defined(OS_WIN) | 1124 #if defined(OS_WIN) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1448 child_process_launcher_.reset(); | 1456 child_process_launcher_.reset(); |
| 1449 channel_.reset(); | 1457 channel_.reset(); |
| 1450 gpu_message_filter_ = NULL; | 1458 gpu_message_filter_ = NULL; |
| 1451 | 1459 |
| 1452 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_); | 1460 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_); |
| 1453 while (!iter.IsAtEnd()) { | 1461 while (!iter.IsAtEnd()) { |
| 1454 RenderWidgetHostImpl::From(iter.GetCurrentValue())->OnMessageReceived( | 1462 RenderWidgetHostImpl::From(iter.GetCurrentValue())->OnMessageReceived( |
| 1455 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(), | 1463 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(), |
| 1456 static_cast<int>(status), | 1464 static_cast<int>(status), |
| 1457 exit_code)); | 1465 exit_code)); |
| 1466 if (ResourceDispatcherHostImpl::Get()) { | |
| 1467 ResourceDispatcherHostImpl::Get()->scheduler()->OnDestroy( | |
| 1468 GetID(), iter.GetCurrentKey()); | |
| 1469 } | |
| 1458 iter.Advance(); | 1470 iter.Advance(); |
| 1459 } | 1471 } |
| 1460 | 1472 |
| 1461 ClearTransportDIBCache(); | 1473 ClearTransportDIBCache(); |
| 1462 | 1474 |
| 1463 // this object is not deleted at this point and may be reused later. | 1475 // this object is not deleted at this point and may be reused later. |
| 1464 // TODO(darin): clean this up | 1476 // TODO(darin): clean this up |
| 1465 } | 1477 } |
| 1466 | 1478 |
| 1467 int RenderProcessHostImpl::GetActiveViewCount() { | 1479 int RenderProcessHostImpl::GetActiveViewCount() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1589 int32 gpu_process_host_id) { | 1601 int32 gpu_process_host_id) { |
| 1590 TRACE_EVENT0("renderer_host", | 1602 TRACE_EVENT0("renderer_host", |
| 1591 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1603 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1592 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1604 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1593 gpu_process_host_id, | 1605 gpu_process_host_id, |
| 1594 surface_handle, | 1606 surface_handle, |
| 1595 0); | 1607 0); |
| 1596 } | 1608 } |
| 1597 | 1609 |
| 1598 } // namespace content | 1610 } // namespace content |
| OLD | NEW |