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

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

Issue 11270027: Add a ResourceScheduler to ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resilient to crashing renderers Created 8 years 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 | Annotate | Revision Log
OLDNEW
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
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 476
474 fast_shutdown_started_ = false; 477 fast_shutdown_started_ = false;
475 } 478 }
476 479
477 is_initialized_ = true; 480 is_initialized_ = true;
478 return true; 481 return true;
479 } 482 }
480 483
481 void RenderProcessHostImpl::CreateMessageFilters() { 484 void RenderProcessHostImpl::CreateMessageFilters() {
482 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 485 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
486 channel_->AddFilter(new ResourceSchedulerFilter(GetID()));
483 MediaObserver* media_observer = 487 MediaObserver* media_observer =
484 GetContentClient()->browser()->GetMediaObserver(); 488 GetContentClient()->browser()->GetMediaObserver();
485 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages 489 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
486 // from guests. 490 // from guests.
487 if (IsGuest()) { 491 if (IsGuest()) {
488 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( 492 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter(
489 new BrowserPluginMessageFilter( 493 new BrowserPluginMessageFilter(
490 GetID(), 494 GetID(),
491 GetBrowserContext())); 495 GetBrowserContext()));
492 channel_->AddFilter(bp_message_filter); 496 channel_->AddFilter(bp_message_filter);
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 ignore_input_events_ = ignore_input_events; 1105 ignore_input_events_ = ignore_input_events;
1102 } 1106 }
1103 1107
1104 bool RenderProcessHostImpl::IgnoreInputEvents() const { 1108 bool RenderProcessHostImpl::IgnoreInputEvents() const {
1105 return ignore_input_events_; 1109 return ignore_input_events_;
1106 } 1110 }
1107 1111
1108 void RenderProcessHostImpl::Attach(RenderWidgetHost* host, 1112 void RenderProcessHostImpl::Attach(RenderWidgetHost* host,
1109 int routing_id) { 1113 int routing_id) {
1110 render_widget_hosts_.AddWithID(host, routing_id); 1114 render_widget_hosts_.AddWithID(host, routing_id);
1115 if (ResourceDispatcherHostImpl::Get()) {
1116 ResourceDispatcherHostImpl::Get()->scheduler()->OnCreate(
1117 GetID(), routing_id);
1118 }
1111 } 1119 }
1112 1120
1113 void RenderProcessHostImpl::Release(int routing_id) { 1121 void RenderProcessHostImpl::Release(int routing_id) {
1114 DCHECK(render_widget_hosts_.Lookup(routing_id) != NULL); 1122 DCHECK(render_widget_hosts_.Lookup(routing_id) != NULL);
1115 render_widget_hosts_.Remove(routing_id); 1123 render_widget_hosts_.Remove(routing_id);
1116 1124
1117 // Make sure that all associated resource requests are stopped. 1125 // Make sure that all associated resource requests are stopped.
1118 CancelResourceRequests(routing_id); 1126 CancelResourceRequests(routing_id);
1119 1127
1120 #if defined(OS_WIN) 1128 #if defined(OS_WIN)
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 child_process_launcher_.reset(); 1460 child_process_launcher_.reset();
1453 channel_.reset(); 1461 channel_.reset();
1454 gpu_message_filter_ = NULL; 1462 gpu_message_filter_ = NULL;
1455 1463
1456 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_); 1464 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_);
1457 while (!iter.IsAtEnd()) { 1465 while (!iter.IsAtEnd()) {
1458 RenderWidgetHostImpl::From(iter.GetCurrentValue())->OnMessageReceived( 1466 RenderWidgetHostImpl::From(iter.GetCurrentValue())->OnMessageReceived(
1459 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(), 1467 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(),
1460 static_cast<int>(status), 1468 static_cast<int>(status),
1461 exit_code)); 1469 exit_code));
1470 if (ResourceDispatcherHostImpl::Get()) {
1471 ResourceDispatcherHostImpl::Get()->scheduler()->OnDestroy(
1472 GetID(), iter.GetCurrentKey());
1473 }
1462 iter.Advance(); 1474 iter.Advance();
1463 } 1475 }
1464 1476
1465 ClearTransportDIBCache(); 1477 ClearTransportDIBCache();
1466 1478
1467 // this object is not deleted at this point and may be reused later. 1479 // this object is not deleted at this point and may be reused later.
1468 // TODO(darin): clean this up 1480 // TODO(darin): clean this up
1469 } 1481 }
1470 1482
1471 int RenderProcessHostImpl::GetActiveViewCount() { 1483 int RenderProcessHostImpl::GetActiveViewCount() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 int32 gpu_process_host_id) { 1605 int32 gpu_process_host_id) {
1594 TRACE_EVENT0("renderer_host", 1606 TRACE_EVENT0("renderer_host",
1595 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); 1607 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost");
1596 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, 1608 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id,
1597 gpu_process_host_id, 1609 gpu_process_host_id,
1598 surface_handle, 1610 surface_handle,
1599 0); 1611 0);
1600 } 1612 }
1601 1613
1602 } // namespace content 1614 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698