diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-18 00:34:30 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-18 00:34:30 +0000 |
commit | f3b1a084a01ab82caf998daefcb989c66ff16135 (patch) | |
tree | 1072e46976c2fb7fa82d72c74bdc579d78f0ce01 | |
parent | 8f0633691cd10779408642e2ad5eaa9b0c190b0a (diff) | |
download | chromium_src-f3b1a084a01ab82caf998daefcb989c66ff16135.zip chromium_src-f3b1a084a01ab82caf998daefcb989c66ff16135.tar.gz chromium_src-f3b1a084a01ab82caf998daefcb989c66ff16135.tar.bz2 |
Define the public interface for content browser RenderProcessHost. This interface is implemented by the RenderProcessHostImpl class which lives in content\browser\renderer_host\render_process_host_impl.cc/.h. The RenderProcessHostImpl class is a consolidation of the RenderProcessHost and BrowserRenderProcessHost classes.
The RenderProcessHost public interface was created from the now deleted RenderProcessHost class defined in content\browser\renderer_host\render_process_host.h.
Additional methods have been added to the interface to ensure that it works correctly with the MockRenderProcessHost class used by unit tests. I had to implement a number of overrides in the MockRenderProcessHost class to ensure that tests work correctly. This was because of assumptions in the tests that the MockRPH class was a real RPH which it was till now.
Added a TODO for the methods which could potentially be removed from this interface. Will revisit that in a subsequent CL.
BUG=98716
TEST=No change in functionality. Hopefully it all compiles and works.
Review URL: http://codereview.chromium.org/8515027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110615 0039d316-1c4b-4281-b951-d872f2087c98
167 files changed, 1478 insertions, 1151 deletions
diff --git a/chrome/app/DEPS b/chrome/app/DEPS index d9f9aee..414df54 100644 --- a/chrome/app/DEPS +++ b/chrome/app/DEPS @@ -7,7 +7,7 @@ include_rules = [ "+chrome/utility/chrome_content_utility_client.h", "+content/app", # TODO(joi): Remove once content API in place. "+content/public/app", - "+content/browser/renderer_host/render_process_host.h", + "+content/public/browser/render_process_host.h", "+grit", # For generated headers "+media/base", # For initializing media library. "+policy", # For generated headers and source diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 618b894..380e0553 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -30,9 +30,9 @@ #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/utility/chrome_content_utility_client.h" #include "content/app/content_main.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/common/content_counters.h" #include "content/public/app/content_main_delegate.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/content_client.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" @@ -570,7 +570,7 @@ void ChromeMainDelegate::PreSandboxStartup() { // don't enable it for official Chrome builds. #if !defined(GOOGLE_CHROME_BUILD) if (command_line.HasSwitch(switches::kSingleProcess)) { - RenderProcessHost::set_run_renderer_in_process(true); + content::RenderProcessHost::set_run_renderer_in_process(true); #if defined(OS_MACOSX) // TODO(port-mac): This is from renderer_main_platform_delegate.cc. // shess tried to refactor things appropriately, but it sprawled out diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index aa0fe0b..e9200cf 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -73,12 +73,12 @@ #include "chrome/common/content_settings_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/download/save_package.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/child_process_info.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" @@ -143,8 +143,8 @@ void InitialLoadObserver::Observe(int type, } } else if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { base::TerminationStatus status = - content::Details<RenderProcessHost::RendererClosedDetails>(details)-> - status; + content::Details<content::RenderProcessHost::RendererClosedDetails>( + details)->status; switch (status) { case base::TERMINATION_STATUS_NORMAL_TERMINATION: break; diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc index 4d53ef5..079b940 100644 --- a/chrome/browser/automation/automation_util.cc +++ b/chrome/browser/automation/automation_util.cc @@ -139,7 +139,7 @@ net::URLRequestContextGetter* GetRequestContext(TabContents* contents) { // Since we may be on the UI thread don't call GetURLRequestContext(). // Get the request context specific to the current TabContents and app. return contents->browser_context()->GetRequestContextForRenderProcess( - contents->render_view_host()->process()->id()); + contents->render_view_host()->process()->GetID()); } void GetCookies(const GURL& url, diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index a3ee268..d47a5ec 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -111,10 +111,10 @@ #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/common_param_traits.h" #include "net/base/cookie_store.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" @@ -1258,7 +1258,7 @@ void TestingAutomationProvider::GetTabProcessID(int handle, int* process_id) { *process_id = 0; TabContents* tab_contents = tab_tracker_->GetResource(handle)->tab_contents(); - RenderProcessHost* rph = tab_contents->GetRenderProcessHost(); + content::RenderProcessHost* rph = tab_contents->GetRenderProcessHost(); if (rph) *process_id = base::GetProcId(rph->GetHandle()); } @@ -2881,7 +2881,7 @@ void TestingAutomationProvider::GetBrowserInfo( DictionaryValue* view = new DictionaryValue; view->SetInteger( "render_process_id", - ex_host->render_process_host()->id()); + ex_host->render_process_host()->GetID()); view->SetInteger( "render_view_id", ex_host->render_view_host()->routing_id()); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index ab38114..a852671 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -47,11 +47,11 @@ #include "chrome/common/url_constants.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/sensors/sensors_provider.h" #include "content/common/gpu/gpu_messages.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/content_client.h" #include "crypto/nss_util.h" #include "googleurl/src/gurl.h" @@ -832,7 +832,8 @@ std::string AboutTcmalloc() { MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); std::string browser("Browser"); AboutTcmallocOutputs::GetInstance()->SetOutput(browser, buffer); - RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + content::RenderProcessHost::iterator + it(content::RenderProcessHost::AllHostsIterator()); while (!it.IsAtEnd()) { it.GetCurrentValue()->Send(new ChromeViewMsg_GetRendererTcmalloc); it.Advance(); diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index baf12d0..06d5c19 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -79,10 +79,10 @@ #include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/net/browser_online_state_observer.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/url_fetcher.h" #include "ipc/ipc_logging.h" #include "net/socket/client_socket_pool_manager.h" @@ -1082,7 +1082,8 @@ void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { // Finally, tell the renderers which don't derive from ChildProcess. // Messages to the renderers must be done on the UI (main) thread. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) i.GetCurrentValue()->Send(new ChildProcessMsg_SetIPCLoggingEnabled(enable)); } diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 64a3a06..5aa4b66 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -35,10 +35,10 @@ #include "chrome/common/pref_names.h" #include "chrome/common/switch_utils.h" #include "content/browser/plugin_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) @@ -99,7 +99,8 @@ void OnShutdownStarting(ShutdownType type) { // shutdown path for the ones that didn't exit here. shutdown_num_processes_ = 0; shutdown_num_processes_slow_ = 0; - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { ++shutdown_num_processes_; if (!i.GetCurrentValue()->FastShutdownIfPossible()) diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 46a9e2f..f651aed 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -63,7 +63,6 @@ #include "content/browser/browser_url_handler.h" #include "content/browser/browsing_instance.h" #include "content/browser/plugin_process_host.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/resource_context.h" #include "content/browser/site_instance.h" @@ -73,6 +72,7 @@ #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/worker_host/worker_process_host.h" #include "content/public/browser/browser_main_parts.h" +#include "content/public/browser/render_process_host.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" #include "net/base/cookie_monster.h" @@ -195,13 +195,13 @@ RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( } RenderProcessHostPrivilege GetProcessPrivilege( - RenderProcessHost* process_host, + content::RenderProcessHost* process_host, extensions::ProcessMap* process_map, ExtensionService* service) { // TODO(aa): It seems like hosted apps should be grouped separately from // extensions: crbug.com/102533. std::set<std::string> extension_ids = - process_map->GetExtensionsInProcess(process_host->id()); + process_map->GetExtensionsInProcess(process_host->GetID()); if (extension_ids.empty()) return PRIV_NORMAL; @@ -303,18 +303,18 @@ void ChromeContentBrowserClient::RenderViewHostCreated( new ExtensionMessageHandler(render_view_host); } -void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) { - int id = host->id(); - Profile* profile = Profile::FromBrowserContext(host->browser_context()); - host->channel()->AddFilter(new ChromeRenderMessageFilter( +void ChromeContentBrowserClient::RenderProcessHostCreated( + content::RenderProcessHost* host) { + int id = host->GetID(); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); + host->GetChannel()->AddFilter(new ChromeRenderMessageFilter( id, profile, profile->GetRequestContextForRenderProcess(id))); - host->channel()->AddFilter(new PluginInfoMessageFilter(id, profile)); - host->channel()->AddFilter(new PrintingMessageFilter()); - host->channel()->AddFilter( + host->GetChannel()->AddFilter(new PluginInfoMessageFilter(id, profile)); + host->GetChannel()->AddFilter(new PrintingMessageFilter()); + host->GetChannel()->AddFilter( new SearchProviderInstallStateMessageFilter(id, profile)); - host->channel()->AddFilter(new SpellCheckMessageFilter(id)); - host->channel()->AddFilter(new ChromeBenchmarkingMessageFilter( + host->GetChannel()->AddFilter(new SpellCheckMessageFilter(id)); + host->GetChannel()->AddFilter(new ChromeBenchmarkingMessageFilter( id, profile, profile->GetRequestContextForRenderProcess(id))); host->Send(new ChromeViewMsg_SetIsIncognitoProcess( @@ -396,10 +396,10 @@ bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { } bool ChromeContentBrowserClient::IsSuitableHost( - RenderProcessHost* process_host, + content::RenderProcessHost* process_host, const GURL& site_url) { Profile* profile = - Profile::FromBrowserContext(process_host->browser_context()); + Profile::FromBrowserContext(process_host->GetBrowserContext()); ExtensionService* service = profile->GetExtensionService(); extensions::ProcessMap* process_map = service->process_map(); @@ -448,13 +448,13 @@ void ChromeContentBrowserClient::SiteInstanceGotProcess( return; service->process_map()->Insert( - extension->id(), site_instance->GetProcess()->id()); + extension->id(), site_instance->GetProcess()->GetID()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, profile->GetExtensionInfoMap(), extension->id(), - site_instance->GetProcess()->id())); + site_instance->GetProcess()->GetID())); } void ChromeContentBrowserClient::SiteInstanceDeleting( @@ -476,13 +476,13 @@ void ChromeContentBrowserClient::SiteInstanceDeleting( return; service->process_map()->Remove( - extension->id(), site_instance->GetProcess()->id()); + extension->id(), site_instance->GetProcess()->GetID()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, profile->GetExtensionInfoMap(), extension->id(), - site_instance->GetProcess()->id())); + site_instance->GetProcess()->GetID())); } bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( @@ -546,12 +546,14 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); #endif - RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(child_process_id); - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + Profile* profile = Profile::FromBrowserContext( + process->GetBrowserContext()); extensions::ProcessMap* process_map = profile->GetExtensionService()->process_map(); - if (process_map && process_map->Contains(process->id())) + if (process_map && process_map->Contains(process->GetID())) command_line->AppendSwitch(switches::kExtensionProcess); PrefService* prefs = profile->GetPrefs(); @@ -893,8 +895,8 @@ void ChromeContentBrowserClient::RequestDesktopNotificationPermission( return; } - RenderProcessHost* process = rvh->process(); - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + content::RenderProcessHost* process = rvh->process(); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(profile); service->RequestPermission( @@ -935,8 +937,8 @@ void ChromeContentBrowserClient::ShowDesktopNotification( return; } - RenderProcessHost* process = rvh->process(); - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + content::RenderProcessHost* process = rvh->process(); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(profile); service->ShowDesktopNotification( @@ -956,8 +958,8 @@ void ChromeContentBrowserClient::CancelDesktopNotification( return; } - RenderProcessHost* process = rvh->process(); - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + content::RenderProcessHost* process = rvh->process(); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(profile); service->CancelDesktopNotification( @@ -1036,12 +1038,12 @@ WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(RenderViewHost* rvh) { void ChromeContentBrowserClient::UpdateInspectorSetting( RenderViewHost* rvh, const std::string& key, const std::string& value) { RenderViewHostDelegateHelper::UpdateInspectorSetting( - rvh->process()->browser_context(), key, value); + rvh->process()->GetBrowserContext(), key, value); } void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { RenderViewHostDelegateHelper::ClearInspectorSettings( - rvh->process()->browser_context()); + rvh->process()->GetBrowserContext()); } void ChromeContentBrowserClient::BrowserURLHandlerCreated( @@ -1062,7 +1064,7 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated( void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { Profile* profile = Profile::FromBrowserContext( - rvh->site_instance()->GetProcess()->browser_context()); + rvh->site_instance()->GetProcess()->GetBrowserContext()); BrowsingDataRemover* remover = new BrowsingDataRemover(profile, BrowsingDataRemover::EVERYTHING, base::Time()); @@ -1072,7 +1074,7 @@ void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { Profile* profile = Profile::FromBrowserContext( - rvh->site_instance()->GetProcess()->browser_context()); + rvh->site_instance()->GetProcess()->GetBrowserContext()); BrowsingDataRemover* remover = new BrowsingDataRemover(profile, BrowsingDataRemover::EVERYTHING, base::Time()); diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 50aed5d..5f49963 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -23,8 +23,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual TabContentsView* CreateTabContentsView( TabContents* tab_contents) OVERRIDE; virtual void RenderViewHostCreated(RenderViewHost* render_view_host) OVERRIDE; - virtual void BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) OVERRIDE; + virtual void RenderProcessHostCreated( + content::RenderProcessHost* host) OVERRIDE; virtual void PluginProcessHostCreated(PluginProcessHost* host) OVERRIDE; virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE; virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, @@ -32,7 +32,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, const GURL& url) OVERRIDE; virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE; - virtual bool IsSuitableHost(RenderProcessHost* process_host, + virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& url) OVERRIDE; virtual void SiteInstanceGotProcess(SiteInstance* site_instance) OVERRIDE; virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE; diff --git a/chrome/browser/chrome_plugin_message_filter.cc b/chrome/browser/chrome_plugin_message_filter.cc index 7c0c2da..fee4c01 100644 --- a/chrome/browser/chrome_plugin_message_filter.cc +++ b/chrome/browser/chrome_plugin_message_filter.cc @@ -13,10 +13,10 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_plugin_messages.h" #include "content/browser/plugin_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "net/url_request/url_request_context_getter.h" #include "webkit/plugins/npapi/default_plugin_shared.h" @@ -71,7 +71,8 @@ void ChromePluginMessageFilter::OnDownloadUrlOnUIThread( const std::string& url, gfx::NativeWindow caller_window, int render_process_id) { - RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(render_process_id); if (!host) { return; } @@ -79,7 +80,7 @@ void ChromePluginMessageFilter::OnDownloadUrlOnUIThread( BrowserThread::FILE, FROM_HERE, base::Bind(&ChromePluginMessageFilter::OnDownloadUrlOnFileThread, url, caller_window, - host->browser_context()->GetRequestContext())); + host->GetBrowserContext()->GetRequestContext())); } void ChromePluginMessageFilter::OnDownloadUrlOnFileThread( diff --git a/chrome/browser/chrome_plugin_service_filter.cc b/chrome/browser/chrome_plugin_service_filter.cc index 29b3c40..51d26df 100644 --- a/chrome/browser/chrome_plugin_service_filter.cc +++ b/chrome/browser/chrome_plugin_service_filter.cc @@ -10,10 +10,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/resource_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "webkit/plugins/npapi/plugin_group.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -142,7 +142,7 @@ void ChromePluginServiceFilter::Observe( switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { int render_process_id = - content::Source<RenderProcessHost>(source).ptr()->id(); + content::Source<content::RenderProcessHost>(source).ptr()->GetID(); base::AutoLock auto_lock(lock_); for (size_t i = 0; i < overridden_plugins_.size(); ++i) { diff --git a/chrome/browser/chromeos/status/memory_menu_button.cc b/chrome/browser/chromeos/status/memory_menu_button.cc index f7504d6..ee90e78 100644 --- a/chrome/browser/chromeos/status/memory_menu_button.cc +++ b/chrome/browser/chromeos/status/memory_menu_button.cc @@ -15,9 +15,9 @@ #include "chrome/browser/chromeos/view_ids.h" #include "chrome/browser/memory_purger.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "views/controls/menu/menu_runner.h" @@ -160,7 +160,8 @@ void MemoryMenuButton::SendCommandToRenderers(int id) { // Use the "is running" value for this process to determine whether to // start or stop profiling on the renderer processes. bool started = IsHeapProfilerRunning(); - for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + for (content::RenderProcessHost::iterator it = + content::RenderProcessHost::AllHostsIterator(); !it.IsAtEnd(); it.Advance()) { switch (id) { case TOGGLE_PROFILING_ITEM: @@ -262,9 +263,9 @@ void MemoryMenuButton::Observe(int type, const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost::RendererClosedDetails* process_details = - content::Details<RenderProcessHost::RendererClosedDetails>(details). - ptr(); + content::RenderProcessHost::RendererClosedDetails* process_details = + content::Details<content::RenderProcessHost::RendererClosedDetails>( + details).ptr(); if (process_details->status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { renderer_kills_++; diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 0377e35..1df3ee7 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -626,7 +626,7 @@ DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( bool do_open = force_open; if (!window) { Profile* profile = Profile::FromBrowserContext( - inspected_rvh->process()->browser_context()); + inspected_rvh->process()->GetBrowserContext()); bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); window = Create(profile, inspected_rvh, docked, false); manager->RegisterDevToolsClientHostFor(inspected_rvh, window); diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc index 79de935..9629c63 100644 --- a/chrome/browser/download/download_extension_api.cc +++ b/chrome/browser/download/download_extension_api.cc @@ -35,9 +35,9 @@ #include "content/browser/download/download_state_info.h" #include "content/browser/download/download_types.h" #include "content/browser/download/interrupt_reasons.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" +#include "content/public/browser/render_process_host.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" @@ -220,7 +220,7 @@ bool DownloadsDownloadFunction::ParseArgs() { } iodata_->rdh = g_browser_process->resource_dispatcher_host(); iodata_->resource_context = &profile()->GetResourceContext(); - iodata_->render_process_host_id = render_view_host()->process()->id(); + iodata_->render_process_host_id = render_view_host()->process()->GetID(); iodata_->render_view_host_routing_id = render_view_host()->routing_id(); return true; } diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 75f57b5..05be15b 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -105,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(1)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(1)->web_ui()); LOG(INFO) << "Nav 1."; @@ -113,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { browser(), base_url.Resolve("path2/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(2)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(2)->web_ui()); LOG(INFO) << "Nav 2."; @@ -126,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html")); LOG(INFO) << "Nav 3."; EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(3)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(3)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(3)->web_ui()); // We should have opened 3 new extension tabs. Including the original blank @@ -217,7 +217,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); LOG(INFO) << "Nav 1."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(1)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(1)->web_ui()); ui_test_utils::WindowedNotificationObserver tab_added_observer( @@ -229,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); LOG(INFO) << "Nav 2."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(2)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(2)->web_ui()); // We should have opened 2 new extension tabs. Including the original blank @@ -308,7 +308,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); TabContents* contents = browser()->GetTabContentsAt(0); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Load app and navigate to the page. const Extension* app = @@ -316,13 +316,13 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ASSERT_TRUE(app); ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and navigate to the page. DisableExtension(app->id()); ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Enable app and reload the page. EnableExtension(app->id()); @@ -333,7 +333,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { browser()->Reload(CURRENT_TAB); reload_observer.Wait(); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and reload the page. DisableExtension(app->id()); @@ -344,7 +344,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { browser()->Reload(CURRENT_TAB); reload_observer2.Wait(); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Enable app and reload via JavaScript. EnableExtension(app->id()); @@ -356,7 +356,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { L"", L"location.reload();")); js_reload_observer.Wait(); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and reload via JavaScript. DisableExtension(app->id()); @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { L"", L"location.reload();")); js_reload_observer2.Wait(); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); } // Tests that if we have a non-app process (path3/container.html) that has an @@ -399,7 +399,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(0)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(0)->render_view_host()->process()->GetID())); // Wait for popup window to appear. GURL app_url = base_url.Resolve("path1/empty.html"); @@ -422,7 +422,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { // Popup window should be in the app's process. EXPECT_TRUE(process_map->Contains( last_active_browser->GetTabContentsAt(0)->render_view_host()->process()-> - id())); + GetID())); } // Tests that if we have an app process (path1/container.html) with a non-app @@ -457,9 +457,9 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); - RenderProcessHost* process = + content::RenderProcessHost* process = browser()->GetTabContentsAt(0)->render_view_host()->process(); - EXPECT_TRUE(process_map->Contains(process->id())); + EXPECT_TRUE(process_map->Contains(process->GetID())); // Wait for popup window to appear. The new Browser may not have been // added with SetLastActive, in which case we need to show it first. @@ -479,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { observer.Wait(); // Popup window should be in the app's process. - RenderProcessHost* popup_process = + content::RenderProcessHost* popup_process = last_active_browser->GetTabContentsAt(0)->render_view_host()->process(); EXPECT_EQ(process, popup_process); } @@ -499,7 +499,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); TabContents* contents = browser()->GetTabContentsAt(0); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); bool is_installed = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( contents->render_view_host(), L"", diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 83f032f..bca31e4 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -17,9 +17,9 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { @@ -72,7 +72,7 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { GetBackgroundHostForExtension(extension_id); ASSERT_TRUE(extension_host); - RenderProcessHost* extension_rph = + content::RenderProcessHost* extension_rph = extension_host->render_view_host()->process(); base::KillProcess(extension_rph->GetHandle(), content::RESULT_CODE_KILLED, false); @@ -94,7 +94,8 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { extensions::ProcessMap* process_map = browser()->profile()->GetExtensionService()->process_map(); ASSERT_TRUE(process_map->Contains( - extension->id(), extension_host->render_view_host()->process()->id())); + extension->id(), extension_host->render_view_host()->process()-> + GetID())); } void LoadTestExtension() { diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index 73c7db2..54336ee 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -22,8 +22,8 @@ #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/api/extension_api.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; using extensions::ExtensionAPI; @@ -43,10 +43,11 @@ void NotifyEventListenerRemovedOnIOThread( } // namespace struct ExtensionEventRouter::EventListener { - RenderProcessHost* process; + content::RenderProcessHost* process; std::string extension_id; - EventListener(RenderProcessHost* process, const std::string& extension_id) + EventListener(content::RenderProcessHost* process, + const std::string& extension_id) : process(process), extension_id(extension_id) {} bool operator<(const EventListener& that) const { @@ -109,14 +110,15 @@ ExtensionEventRouter::~ExtensionEventRouter() {} void ExtensionEventRouter::AddEventListener( const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id) { EventListener listener(process, extension_id); DCHECK_EQ(listeners_[event_name].count(listener), 0u) << event_name; listeners_[event_name].insert(listener); if (extension_devtools_manager_.get()) - extension_devtools_manager_->AddEventListener(event_name, process->id()); + extension_devtools_manager_->AddEventListener(event_name, + process->GetID()); // We lazily tell the TaskManager to start updating when listeners to the // processes.onUpdated event arrive. @@ -126,18 +128,19 @@ void ExtensionEventRouter::AddEventListener( void ExtensionEventRouter::RemoveEventListener( const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id) { EventListener listener(process, extension_id); DCHECK_EQ(listeners_[event_name].count(listener), 1u) << - " PID=" << process->id() << " extension=" << extension_id << + " PID=" << process->GetID() << " extension=" << extension_id << " event=" << event_name; listeners_[event_name].erase(listener); // Note: extension_id may point to data in the now-deleted listeners_ object. // Do not use. if (extension_devtools_manager_.get()) - extension_devtools_manager_->RemoveEventListener(event_name, process->id()); + extension_devtools_manager_->RemoveEventListener(event_name, + process->GetID()); // If a processes.onUpdated event listener is removed (or a process with one // exits), then we let the TaskManager know that it has one fewer listener. @@ -273,14 +276,13 @@ void ExtensionEventRouter::DispatchEventImpl( continue; Profile* listener_profile = Profile::FromBrowserContext( - listener->process->browser_context()); + listener->process->GetBrowserContext()); extensions::ProcessMap* process_map = listener_profile->GetExtensionService()->process_map(); - // If the event is privileged, only send to extension processes. Otherwise, // it's OK to send to normal renderers (e.g., for content scripts). if (ExtensionAPI::GetInstance()->IsPrivileged(event->event_name) && - !process_map->Contains(extension->id(), listener->process->id())) { + !process_map->Contains(extension->id(), listener->process->GetID())) { continue; } @@ -366,8 +368,8 @@ void ExtensionEventRouter::Observe( switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost* renderer = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* renderer = + content::Source<content::RenderProcessHost>(source).ptr(); // Remove all event listeners associated with this renderer for (ListenerMap::iterator it = listeners_.begin(); it != listeners_.end(); ) { diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h index ade675e..cc2608d 100644 --- a/chrome/browser/extensions/extension_event_router.h +++ b/chrome/browser/extensions/extension_event_router.h @@ -21,7 +21,10 @@ class GURL; class Extension; class ExtensionDevToolsManager; class Profile; + +namespace content { class RenderProcessHost; +} class ExtensionEventRouter : public content::NotificationObserver { public: @@ -41,10 +44,10 @@ class ExtensionEventRouter : public content::NotificationObserver { // collapsing. Also, a single extension can have 2 processes if it is a split // mode extension. void AddEventListener(const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id); void RemoveEventListener(const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id); // Returns true if there is at least one listener for the given event. diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index b66e898..b102d88d 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -33,10 +33,10 @@ #include "chrome/common/extensions/file_browser_handler.h" #include "chrome/common/pref_names.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/platform_locale_settings.h" @@ -443,7 +443,7 @@ bool RequestLocalFileSystemFunction::RunImpl() { &RequestLocalFileSystemFunction::RequestOnFileThread, this, source_url_, - render_view_host()->process()->id())); + render_view_host()->process()->GetID())); // Will finish asynchronously. return true; } @@ -722,9 +722,9 @@ class ExecuteTasksFileBrowserFunction::ExecuteTasksFileSystemCallbackDispatcher SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); if (!site_instance || !site_instance->HasProcess()) return; - RenderProcessHost* process = site_instance->GetProcess(); + content::RenderProcessHost* process = site_instance->GetProcess(); - target_process_id_ = process->id(); + target_process_id_ = process->GetID(); } // Checks legitimacy of file url and grants file RO access permissions from @@ -882,7 +882,7 @@ void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread( new ExecuteTasksFileSystemCallbackDispatcher( this, profile(), - render_view_host()->process()->id(), + render_view_host()->process()->GetID(), source_url, GetExtension(), task_id, diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index c4a502f..c87c15a 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -11,11 +11,11 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" #include "chrome/common/extensions/extension_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/user_metrics.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" using content::BrowserThread; @@ -116,7 +116,7 @@ void ExtensionFunction::SendResponseImpl(base::ProcessHandle process, void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; - if (RenderProcessHost::run_renderer_in_process()) { + if (content::RenderProcessHost::run_renderer_in_process()) { // In single process mode it is better if we don't suicide but just crash. CHECK(false); } else { diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index c94b277..2482a0a 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -581,7 +581,7 @@ Browser* ExtensionFunctionDispatcher::GetCurrentBrowser( // we will search the incognito version only, regardless of the value of // |include_incognito|. Profile* profile = Profile::FromBrowserContext( - render_view_host->process()->browser_context()); + render_view_host->process()->GetBrowserContext()); browser = BrowserList::FindTabbedBrowser(profile, include_incognito); // NOTE(rafaelw): This can return NULL in some circumstances. In particular, @@ -608,7 +608,7 @@ void ExtensionFunctionDispatcher::Dispatch( scoped_refptr<ExtensionFunction> function( CreateExtensionFunction(params, extension, - render_view_host->process()->id(), + render_view_host->process()->GetID(), *(service->process_map()), profile(), render_view_host, render_view_host->routing_id())); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 6c97feb..36743e3 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -31,12 +31,11 @@ #include "chrome/common/url_constants.h" #include "chrome/common/chrome_view_types.h" #include "content/browser/browsing_instance.h" -#include "content/browser/renderer_host/browser_render_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/native_web_keyboard_event.h" #include "grit/browser_resources.h" @@ -185,7 +184,7 @@ TabContents* ExtensionHost::GetAssociatedTabContents() const { return associated_tab_contents_; } -RenderProcessHost* ExtensionHost::render_process_host() const { +content::RenderProcessHost* ExtensionHost::render_process_host() const { return host_contents()->GetRenderProcessHost(); } diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 4475ade..c098376 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -29,12 +29,15 @@ class Browser; class Extension; -class RenderProcessHost; class RenderWidgetHostView; class TabContents; struct ViewHostMsg_RunFileChooser_Params; struct WebPreferences; +namespace content { +class RenderProcessHost; +} + // This class is the browser component of an extension component's RenderView. // It handles setting up the renderer process, if needed, with special // privileges available to extensions. It may have a view to be shown in the @@ -72,7 +75,7 @@ class ExtensionHost : public TabContentsDelegate, const std::string& extension_id() const { return extension_id_; } TabContents* host_contents() const { return host_contents_.get(); } RenderViewHost* render_view_host() const; - RenderProcessHost* render_process_host() const; + content::RenderProcessHost* render_process_host() const; bool did_stop_loading() const { return did_stop_loading_; } bool document_element_available() const { return document_element_available_; diff --git a/chrome/browser/extensions/extension_message_handler.cc b/chrome/browser/extensions/extension_message_handler.cc index f600fa5..6ba6e46 100644 --- a/chrome/browser/extensions/extension_message_handler.cc +++ b/chrome/browser/extensions/extension_message_handler.cc @@ -10,7 +10,7 @@ #include "content/browser/child_process_security_policy.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" ExtensionMessageHandler::ExtensionMessageHandler( RenderViewHost* render_view_host) @@ -38,7 +38,7 @@ void ExtensionMessageHandler::RenderViewHostInitialized() { void ExtensionMessageHandler::OnPostMessage(int port_id, const std::string& message) { Profile* profile = Profile::FromBrowserContext( - render_view_host()->process()->browser_context()); + render_view_host()->process()->GetBrowserContext()); if (profile->GetExtensionMessageService()) { profile->GetExtensionMessageService()->PostMessageFromRenderer( port_id, message); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index d89b6e6..361c408 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -17,11 +17,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_messages.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" // Since we have 2 ports for every channel, we just index channels by half the // port ID. @@ -94,7 +94,7 @@ static void DispatchOnMessage(const ExtensionMessageService::MessagePort& port, port.routing_id, target_port_id, message)); } -static RenderProcessHost* GetExtensionProcess(Profile* profile, +static content::RenderProcessHost* GetExtensionProcess(Profile* profile, const std::string& extension_id) { SiteInstance* site_instance = profile->GetExtensionProcessManager()->GetSiteInstanceForURL( @@ -153,10 +153,11 @@ void ExtensionMessageService::OpenChannelToExtension( const std::string& source_extension_id, const std::string& target_extension_id, const std::string& channel_name) { - RenderProcessHost* source = RenderProcessHost::FromID(source_process_id); + content::RenderProcessHost* source = + content::RenderProcessHost::FromID(source_process_id); if (!source) return; - Profile* profile = Profile::FromBrowserContext(source->browser_context()); + Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); // Note: we use the source's profile here. If the source is an incognito // process, we will use the incognito EPM to find the right extension process, @@ -183,10 +184,11 @@ void ExtensionMessageService::OpenChannelToTab( int source_process_id, int source_routing_id, int receiver_port_id, int tab_id, const std::string& extension_id, const std::string& channel_name) { - RenderProcessHost* source = RenderProcessHost::FromID(source_process_id); + content::RenderProcessHost* source = + content::RenderProcessHost::FromID(source_process_id); if (!source) return; - Profile* profile = Profile::FromBrowserContext(source->browser_context()); + Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); TabContentsWrapper* contents = NULL; MessagePort receiver; @@ -345,8 +347,8 @@ void ExtensionMessageService::Observe( switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost* renderer = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* renderer = + content::Source<content::RenderProcessHost>(source).ptr(); OnSenderClosed(renderer); break; } diff --git a/chrome/browser/extensions/extension_permissions_api.cc b/chrome/browser/extensions/extension_permissions_api.cc index b6ce293..bfc7116 100644 --- a/chrome/browser/extensions/extension_permissions_api.cc +++ b/chrome/browser/extensions/extension_permissions_api.cc @@ -218,10 +218,11 @@ void ExtensionPermissionsManager::NotifyPermissionsUpdated( content::Details<UpdatedExtensionPermissionsInfo>(&info)); // Send the new permissions to the renderers. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); - Profile* profile = Profile::FromBrowserContext(host->browser_context()); + content::RenderProcessHost* host = i.GetCurrentValue(); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); if (extension_service_->profile()->IsSameProfile(profile)) host->Send(new ExtensionMsg_UpdatePermissions( static_cast<int>(reason), diff --git a/chrome/browser/extensions/extension_permissions_api.h b/chrome/browser/extensions/extension_permissions_api.h index 22563b9..583302e 100644 --- a/chrome/browser/extensions/extension_permissions_api.h +++ b/chrome/browser/extensions/extension_permissions_api.h @@ -13,7 +13,7 @@ #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/common/extensions/extension_permission_set.h" #include "chrome/common/chrome_notification_types.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" class Extension; class ExtensionPermissionSet; diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc index a35096f..5ca38b3 100644 --- a/chrome/browser/extensions/extension_processes_api.cc +++ b/chrome/browser/extensions/extension_processes_api.cc @@ -20,9 +20,9 @@ #include "chrome/browser/task_manager/task_manager.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension_error_utils.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" namespace keys = extension_processes_api_constants; diff --git a/chrome/browser/extensions/extension_save_page_api.cc b/chrome/browser/extensions/extension_save_page_api.cc index 7fb8416..2a934b2 100644 --- a/chrome/browser/extensions/extension_save_page_api.cc +++ b/chrome/browser/extensions/extension_save_page_api.cc @@ -124,7 +124,7 @@ void SavePageAsMHTMLFunction::ReturnFailure(const std::string& error) { void SavePageAsMHTMLFunction::ReturnSuccess(int64 file_size) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - int child_id = render_view_host()->process()->id(); + int child_id = render_view_host()->process()->GetID(); ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( child_id, mhtml_path_); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 3f77711..9f55624 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -87,12 +87,12 @@ #include "content/browser/debugger/devtools_manager.h" #include "content/browser/plugin_process_host.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/user_metrics.h" #include "content/common/pepper_plugin_registry.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "net/base/registry_controlled_domain.h" #include "webkit/database/database_tracker.h" @@ -916,11 +916,12 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { content::Details<const Extension>(extension)); // Tell renderers about the new extension. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); + content::RenderProcessHost* host = i.GetCurrentValue(); Profile* host_profile = - Profile::FromBrowserContext(host->browser_context()); + Profile::FromBrowserContext(host->GetBrowserContext()); if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { std::vector<ExtensionMsg_Loaded_Params> loaded_extensions( 1, ExtensionMsg_Loaded_Params(extension)); @@ -1036,11 +1037,12 @@ void ExtensionService::NotifyExtensionUnloaded( content::Source<Profile>(profile_), content::Details<UnloadedExtensionInfo>(&details)); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); + content::RenderProcessHost* host = i.GetCurrentValue(); Profile* host_profile = - Profile::FromBrowserContext(host->browser_context()); + Profile::FromBrowserContext(host->GetBrowserContext()); if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) host->Send(new ExtensionMsg_Unloaded(extension->id())); } @@ -2316,10 +2318,10 @@ void ExtensionService::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* host_profile = - Profile::FromBrowserContext(process->browser_context()); + Profile::FromBrowserContext(process->GetBrowserContext()); if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) break; @@ -2343,21 +2345,21 @@ void ExtensionService::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* host_profile = - Profile::FromBrowserContext(process->browser_context()); + Profile::FromBrowserContext(process->GetBrowserContext()); if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) break; - installed_app_hosts_.erase(process->id()); + installed_app_hosts_.erase(process->GetID()); - process_map_.Remove(process->id()); + process_map_.Remove(process->GetID()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, profile_->GetExtensionInfoMap(), - process->id())); + process->GetID())); break; } case chrome::NOTIFICATION_PREF_CHANGED: { diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 7ad5261..3456a53 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -169,7 +169,7 @@ void ExtensionTabHelper::OnGetAppNotifyChannel( Profile::FromBrowserContext(tab_contents()->browser_context()); ExtensionService* extension_service = profile->GetExtensionService(); extensions::ProcessMap* process_map = extension_service->process_map(); - RenderProcessHost* process = + content::RenderProcessHost* process = tab_contents_wrapper()->render_view_host()->process(); const Extension* extension = extension_service->GetInstalledApp(requestor_url); @@ -177,7 +177,7 @@ void ExtensionTabHelper::OnGetAppNotifyChannel( extension && extension->HasAPIPermission( ExtensionAPIPermission::kExperimental) && - process_map->Contains(extension->id(), process->id()); + process_map->Contains(extension->id(), process->GetID()); if (!allowed) { AppNotifyChannelSetupComplete("", "permission_error", return_route_id, callback_id); diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc index bf51e24..581e8e4 100644 --- a/chrome/browser/extensions/extension_tab_id_map.cc +++ b/chrome/browser/extensions/extension_tab_id_map.cc @@ -74,7 +74,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -88,7 +88,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -107,7 +107,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -119,7 +119,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::ClearTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id())); + host->process()->GetID(), host->routing_id())); break; } default: diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc index 9a2c189..e6038ed 100644 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ b/chrome/browser/extensions/extension_webrequest_api.cc @@ -290,10 +290,11 @@ void NotifyWebRequestAPIUsed(void* profile_id, const Extension* extension) { profile->GetExtensionService()->SetHasUsedWebRequest(extension, true); content::BrowserContext* browser_context = profile; - for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + for (content::RenderProcessHost::iterator it = + content::RenderProcessHost::AllHostsIterator(); !it.IsAtEnd(); it.Advance()) { - RenderProcessHost* host = it.GetCurrentValue(); - if (host->browser_context() == browser_context) + content::RenderProcessHost* host = it.GetCurrentValue(); + if (host->GetBrowserContext() == browser_context) SendExtensionWebRequestStatusToHost(host); } } @@ -1629,8 +1630,8 @@ void WebRequestHandlerBehaviorChanged::OnQuotaExceeded() { Run(); } -void SendExtensionWebRequestStatusToHost(RenderProcessHost* host) { - Profile* profile = Profile::FromBrowserContext(host->browser_context()); +void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); if (!profile || !profile->GetExtensionService()) return; diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h index 8e28f41..400d46a 100644 --- a/chrome/browser/extensions/extension_webrequest_api.h +++ b/chrome/browser/extensions/extension_webrequest_api.h @@ -26,13 +26,16 @@ class ExtensionInfoMap; class ExtensionWebRequestTimeTracker; class GURL; -class RenderProcessHost; namespace base { class DictionaryValue; class ListValue; } +namespace content { +class RenderProcessHost; +} + namespace net { class AuthCredentials; class AuthChallengeInfo; @@ -366,6 +369,6 @@ class WebRequestHandlerBehaviorChanged : public SyncIOThreadExtensionFunction { // Send updates to |host| with information about what webRequest-related // extensions are installed. // TODO(mpcomplete): remove. http://crbug.com/100411 -void SendExtensionWebRequestStatusToHost(RenderProcessHost* host); +void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index 541a0ce..431aa7a 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -12,10 +12,10 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/test_url_constants.h" +#include "content/public/browser/render_process_host.h" #include "net/base/mock_host_resolver.h" namespace { @@ -37,7 +37,7 @@ class IsolatedAppTest : public ExtensionBrowserTest { ExtensionService* service = profile->GetExtensionService(); if (service) { installed_app = service->GetInstalledAppForRenderer( - contents->render_view_host()->process()->id()); + contents->render_view_host()->process()->GetID()); } return installed_app; } @@ -169,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, NoCookieIsolationWithoutApp) { // RenderProcessHosts even if we hit the process limit. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, ProcessOverflow) { // Set max renderers to 1 to force running out of processes. - RenderProcessHost::SetMaxRendererProcessCountForTest(1); + content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); host_resolver()->AddRule("*", "127.0.0.1"); ASSERT_TRUE(test_server()->Start()); @@ -205,15 +205,15 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, ProcessOverflow) { NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); ASSERT_EQ(5, browser()->tab_count()); - RenderProcessHost* isolated1_host = + content::RenderProcessHost* isolated1_host = browser()->GetTabContentsAt(0)->GetRenderProcessHost(); - RenderProcessHost* ntp_host = + content::RenderProcessHost* ntp_host = browser()->GetTabContentsAt(1)->GetRenderProcessHost(); - RenderProcessHost* normal_extension_host = + content::RenderProcessHost* normal_extension_host = browser()->GetTabContentsAt(2)->GetRenderProcessHost(); - RenderProcessHost* web_host = + content::RenderProcessHost* web_host = browser()->GetTabContentsAt(3)->GetRenderProcessHost(); - RenderProcessHost* isolated2_host = + content::RenderProcessHost* isolated2_host = browser()->GetTabContentsAt(4)->GetRenderProcessHost(); // Isolated apps shared with each other, but no one else. They're clannish diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index f936459..7a2082a 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -24,8 +24,8 @@ #include "chrome/common/extensions/extension_message_bundle.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/extension_set.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -320,7 +320,8 @@ void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) { // We've got scripts ready to go. shared_memory_.swap(handle_deleter); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { SendUpdate(i.GetCurrentValue(), handle); } @@ -380,10 +381,10 @@ void UserScriptMaster::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* profile = Profile::FromBrowserContext( - process->browser_context()); + process->GetBrowserContext()); if (!profile_->IsSameProfile(profile)) return; if (ScriptsReady()) @@ -410,9 +411,9 @@ void UserScriptMaster::StartLoad() { script_reloader_->StartLoad(user_scripts_, extensions_info_); } -void UserScriptMaster::SendUpdate(RenderProcessHost* process, +void UserScriptMaster::SendUpdate(content::RenderProcessHost* process, base::SharedMemory* shared_memory) { - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); // Make sure we only send user scripts to processes in our profile. if (!profile_->IsSameProfile(profile)) return; diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h index 291d932..2be6189 100644 --- a/chrome/browser/extensions/user_script_master.h +++ b/chrome/browser/extensions/user_script_master.h @@ -26,8 +26,11 @@ namespace base { class StringPiece; } -class Profile; +namespace content { class RenderProcessHost; +} + +class Profile; typedef std::map<std::string, ExtensionSet::ExtensionPathAndDefaultLocale> ExtensionsInfo; @@ -135,7 +138,7 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, const content::NotificationDetails& details) OVERRIDE; // Sends the renderer process a new set of user scripts. - void SendUpdate(RenderProcessHost* process, + void SendUpdate(content::RenderProcessHost* process, base::SharedMemory* shared_memory); // Manages our notification registrations. diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 6a0cc75..7dd57ae 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -560,7 +560,7 @@ void ExternalTabContainer::RegisterRenderViewHostForAutomation( RenderViewHost* render_view_host, bool pending_view) { if (render_view_host) { AutomationResourceMessageFilter::RegisterRenderView( - render_view_host->process()->id(), + render_view_host->process()->GetID(), render_view_host->routing_id(), tab_handle(), automation_resource_message_filter_, @@ -584,7 +584,7 @@ void ExternalTabContainer::UnregisterRenderViewHost( // ExternalTabContainer::RegisterRenderViewHost. if (render_view_host) { AutomationResourceMessageFilter::UnRegisterRenderView( - render_view_host->process()->id(), + render_view_host->process()->GetID(), render_view_host->routing_id()); } } @@ -1092,7 +1092,7 @@ void ExternalTabContainer::OnReinitialize() { RenderViewHost* rvh = tab_contents_->render_view_host(); if (rvh) { AutomationResourceMessageFilter::ResumePendingRenderView( - rvh->process()->id(), rvh->routing_id(), + rvh->process()->GetID(), rvh->routing_id(), tab_handle_, automation_resource_message_filter_); } } diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc index f7f93e3..af78c29 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc @@ -95,10 +95,12 @@ class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { protected: virtual ~GeolocationPermissionContextTests(); - int process_id() { return contents()->render_view_host()->process()->id(); } + int process_id() { + return contents()->render_view_host()->process()->GetID(); + } int process_id_for_tab(int tab) { return extra_tabs_[tab]->tab_contents()->render_view_host()->process()-> - id(); + GetID(); } int render_id() { return contents()->render_view_host()->routing_id(); } int render_id_for_tab(int tab) { diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 3f5cb15..20d04a4 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -18,11 +18,11 @@ #include "chrome/common/url_constants.h" #include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/backing_store_manager.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/bindings_policy.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -130,10 +130,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() { ProcessMemoryInformation& process = chrome_browser->processes[index]; - for (RenderProcessHost::iterator renderer_iter( - RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); - renderer_iter.Advance()) { - RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue(); + for (content::RenderProcessHost::iterator renderer_iter( + content::RenderProcessHost::AllHostsIterator()); + !renderer_iter.IsAtEnd(); renderer_iter.Advance()) { + content::RenderProcessHost* render_process_host = + renderer_iter.GetCurrentValue(); DCHECK(render_process_host); // Ignore processes that don't have a connection, such as crashed tabs. if (!render_process_host->HasConnection() || @@ -142,7 +143,8 @@ void MemoryDetails::CollectChildInfoOnUIThread() { } process.type = ChildProcessInfo::RENDER_PROCESS; Profile* profile = - Profile::FromBrowserContext(render_process_host->browser_context()); + Profile::FromBrowserContext( + render_process_host->GetBrowserContext()); ExtensionService* extension_service = profile->GetExtensionService(); extensions::ProcessMap* extension_process_map = extension_service->process_map(); @@ -154,7 +156,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { // NOTE: This is a bit dangerous. We know that for now, listeners // are always RenderWidgetHosts. But in theory, they don't // have to be. - RenderProcessHost::listeners_iterator iter( + content::RenderProcessHost::listeners_iterator iter( render_process_host->ListenersIterator()); for (; !iter.IsAtEnd(); iter.Advance()) { const RenderWidgetHost* widget = @@ -175,12 +177,12 @@ void MemoryDetails::CollectChildInfoOnUIThread() { process.renderer_type = ChildProcessInfo::RENDERER_DEVTOOLS; else process.renderer_type = ChildProcessInfo::RENDERER_CHROME; - } else if (extension_process_map->Contains(host->process()->id())) { + } else if (extension_process_map->Contains(host->process()->GetID())) { // For our purposes, don't count processes containing only hosted apps // as extension processes. See also: crbug.com/102533. std::set<std::string> extension_ids = extension_process_map->GetExtensionsInProcess( - host->process()->id()); + host->process()->GetID()); for (std::set<std::string>::iterator iter = extension_ids.begin(); iter != extension_ids.end(); ++iter) { const Extension* extension = @@ -193,7 +195,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { } TabContents* contents = host_delegate->GetAsTabContents(); if (!contents) { - if (extension_process_map->Contains(host->process()->id())) { + if (extension_process_map->Contains(host->process()->GetID())) { const Extension* extension = extension_service->GetExtensionByURL(url); if (extension) { diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc index 5bce67c..260355f 100644 --- a/chrome/browser/memory_purger.cc +++ b/chrome/browser/memory_purger.cc @@ -16,9 +16,9 @@ #include "chrome/common/render_messages.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/browser/renderer_host/backing_store_manager.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" @@ -147,13 +147,14 @@ void MemoryPurger::PurgeRenderers() { // Concern: Telling a bunch of renderer processes to destroy their data may // cause them to page everything in to do it, which could take a lot of time/ // cause jank. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) PurgeRendererForHost(i.GetCurrentValue()); } // static -void MemoryPurger::PurgeRendererForHost(RenderProcessHost* host) { +void MemoryPurger::PurgeRendererForHost(content::RenderProcessHost* host) { // Direct the renderer to free everything it can. host->Send(new ChromeViewMsg_PurgeMemory()); } diff --git a/chrome/browser/memory_purger.h b/chrome/browser/memory_purger.h index 667b530..4b7c553 100644 --- a/chrome/browser/memory_purger.h +++ b/chrome/browser/memory_purger.h @@ -16,7 +16,9 @@ #include "base/basictypes.h" +namespace content { class RenderProcessHost; +} class MemoryPurger { public: @@ -24,7 +26,7 @@ class MemoryPurger { static void PurgeAll(); static void PurgeBrowser(); static void PurgeRenderers(); - static void PurgeRendererForHost(RenderProcessHost* host); + static void PurgeRendererForHost(content::RenderProcessHost* host); private: DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryPurger); diff --git a/chrome/browser/metrics/field_trial_synchronizer.cc b/chrome/browser/metrics/field_trial_synchronizer.cc index bef65bb..8a65557 100644 --- a/chrome/browser/metrics/field_trial_synchronizer.cc +++ b/chrome/browser/metrics/field_trial_synchronizer.cc @@ -8,8 +8,8 @@ #include "base/threading/thread.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -31,7 +31,8 @@ void FieldTrialSynchronizer::NotifyAllRenderers( // need to be on the UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) { it.GetCurrentValue()->Send( new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); diff --git a/chrome/browser/metrics/histogram_synchronizer.cc b/chrome/browser/metrics/histogram_synchronizer.cc index 3f87718..07266c1 100644 --- a/chrome/browser/metrics/histogram_synchronizer.cc +++ b/chrome/browser/metrics/histogram_synchronizer.cc @@ -9,8 +9,8 @@ #include "base/threading/thread.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" using base::Time; using base::TimeDelta; @@ -134,13 +134,15 @@ int HistogramSynchronizer::NotifyAllRenderers( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); int notification_count = 0; - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) ++notification_count; int sequence_number = GetNextAvailableSequenceNumber(requester, notification_count); - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) { if (!it.GetCurrentValue()->Send( new ChromeViewMsg_GetRendererHistograms(sequence_number))) diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 92ab283..93dffd8 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -178,8 +178,8 @@ #include "chrome/common/render_messages.h" #include "content/browser/load_notification_details.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/url_fetcher.h" #include "webkit/plugins/webplugininfo.h" @@ -525,11 +525,12 @@ void MetricsService::Observe(int type, break; case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost::RendererClosedDetails* process_details = - content::Details<RenderProcessHost::RendererClosedDetails>( - details).ptr(); - RenderProcessHost* host = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost::RendererClosedDetails* process_details = + content::Details< + content::RenderProcessHost::RendererClosedDetails>( + details).ptr(); + content::RenderProcessHost* host = + content::Source<content::RenderProcessHost>(source).ptr(); LogRendererCrash( host, process_details->status, process_details->was_alive); } @@ -880,7 +881,8 @@ void MetricsService::StartScheduledUpload() { details->StartFetch(); // Collect WebCore cache information to put into a histogram. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) i.GetCurrentValue()->Send(new ChromeViewMsg_GetCacheResourceStats()); } @@ -1239,13 +1241,13 @@ void MetricsService::LogLoadStarted() { // might be lost due to a crash :-(. } -void MetricsService::LogRendererCrash(RenderProcessHost* host, +void MetricsService::LogRendererCrash(content::RenderProcessHost* host, base::TerminationStatus status, bool was_alive) { - Profile* profile = Profile::FromBrowserContext(host->browser_context()); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); ExtensionService* service = profile->GetExtensionService(); bool was_extension_process = - service && service->process_map()->Contains(host->id()); + service && service->process_map()->Contains(host->GetID()); if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { if (was_extension_process) diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index ee39a35..359b09f 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -33,7 +33,6 @@ class BookmarkNode; class MetricsReportingScheduler; class PrefService; class Profile; -class RenderProcessHost; class TemplateURLService; namespace base { @@ -41,6 +40,10 @@ class DictionaryValue; class MessageLoopProxy; } +namespace content { +class RenderProcessHost; +} + namespace prerender { bool IsOmniboxEnabled(Profile* profile); } @@ -249,7 +252,7 @@ class MetricsService : public content::NotificationObserver, void IncrementLongPrefsValue(const char* path); // Records a renderer process crash. - void LogRendererCrash(RenderProcessHost* host, + void LogRendererCrash(content::RenderProcessHost* host, base::TerminationStatus status, bool was_alive); diff --git a/chrome/browser/metrics/tracking_synchronizer.cc b/chrome/browser/metrics/tracking_synchronizer.cc index e1b3673..a12ad92 100644 --- a/chrome/browser/metrics/tracking_synchronizer.cc +++ b/chrome/browser/metrics/tracking_synchronizer.cc @@ -14,8 +14,8 @@ #include "chrome/browser/ui/webui/tracing_ui.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" using base::TimeTicks; using content::BrowserThread; @@ -84,9 +84,10 @@ void TrackingSynchronizer::SetTrackingStatus(bool enable) { // to be on the UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) { - RenderProcessHost* render_process_host = it.GetCurrentValue(); + content::RenderProcessHost* render_process_host = it.GetCurrentValue(); DCHECK(render_process_host); // Ignore processes that don't have a connection, such as crashed tabs. if (!render_process_host->HasConnection()) @@ -115,7 +116,8 @@ void TrackingSynchronizer::SetTrackingStatusInProcess(int process_id) { bool enable = tracked_objects::ThreadData::tracking_status(); - RenderProcessHost* process = RenderProcessHost::FromID(process_id); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(process_id); // Ignore processes that don't have a connection, such as crashed tabs. if (!process || !process->HasConnection()) return; @@ -173,9 +175,10 @@ int TrackingSynchronizer::RegisterAndNotifyAllProcesses( outstanding_requests_[sequence_number] = request; DCHECK_GT(request->processes_pending_, 0); - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) { - RenderProcessHost* render_process_host = it.GetCurrentValue(); + content::RenderProcessHost* render_process_host = it.GetCurrentValue(); DCHECK(render_process_host); // Ignore processes that don't have a connection, such as crashed tabs. if (!render_process_host->HasConnection()) diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index e6dfe39..d27c45e 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -14,12 +14,12 @@ #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "chrome/common/chrome_view_types.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/renderer_preferences.h" #include "ipc/ipc_message.h" diff --git a/chrome/browser/oom_priority_manager.cc b/chrome/browser/oom_priority_manager.cc index 1eb6de3..df8da3a 100644 --- a/chrome/browser/oom_priority_manager.cc +++ b/chrome/browser/oom_priority_manager.cc @@ -20,13 +20,13 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_constants.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/zygote_host_linux.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #if !defined(OS_CHROMEOS) #error This file only meant to be compiled on ChromeOS @@ -193,13 +193,14 @@ void OomPriorityManager::Observe(int type, switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { handle = - content::Details<RenderProcessHost::RendererClosedDetails>(details)-> - handle; + content::Details<content::RenderProcessHost::RendererClosedDetails>( + details)->handle; pid_to_oom_score_.erase(handle); break; } case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { - handle = content::Source<RenderProcessHost>(source)->GetHandle(); + handle = content::Source<content::RenderProcessHost>(source)-> + GetHandle(); pid_to_oom_score_.erase(handle); break; } diff --git a/chrome/browser/pdf_unsupported_feature.cc b/chrome/browser/pdf_unsupported_feature.cc index 098b549..8b7183c 100644 --- a/chrome/browser/pdf_unsupported_feature.cc +++ b/chrome/browser/pdf_unsupported_feature.cc @@ -136,7 +136,7 @@ void OpenUsingReader(TabContentsWrapper* tab, InfoBarDelegate* old_delegate, InfoBarDelegate* new_delegate) { ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( - tab->render_view_host()->process()->id(), + tab->render_view_host()->process()->GetID(), tab->render_view_host()->routing_id(), tab->tab_contents()->GetURL(), ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); @@ -402,6 +402,6 @@ void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { PluginService::GetInstance()->GetPluginGroups( base::Bind(&GotPluginGroupsCallback, - tab->render_view_host()->process()->id(), + tab->render_view_host()->process()->GetID(), tab->render_view_host()->routing_id())); } diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index d90afd6..0022c7d 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -61,8 +61,8 @@ #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/pref_names.h" #include "content/browser/host_zoom_map.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/ssl/ssl_manager.h" +#include "content/public/browser/render_process_host.h" #if defined(OS_MACOSX) #include "chrome/browser/ui/cocoa/presentation_mode_prefs.h" diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 3895e06..c8af93b 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -282,7 +282,7 @@ void PrerenderContents::StartPrerendering( render_view_host_observer_.reset( new PrerenderRenderViewHostObserver(this, render_view_host_mutable())); - child_id_ = render_view_host()->process()->id(); + child_id_ = render_view_host()->process()->GetID(); route_id_ = render_view_host()->routing_id(); // Register this with the ResourceDispatcherHost as a prerender diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 7662832..77cbd0b 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -37,7 +37,6 @@ #include "content/browser/cancelable_request.h" #include "content/browser/debugger/render_view_devtools_agent_host.h" #include "content/browser/in_process_webkit/session_storage_namespace.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/render_view_host_manager.h" @@ -47,6 +46,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -401,8 +401,8 @@ bool PrerenderManager::AddPrerender( // true, so that case needs to be explicitly checked for. // TODO(tburkard): Figure out how to cancel prerendering in the opposite // case, when a new tab is added to a process used for prerendering. - if (RenderProcessHost::ShouldTryToUseExistingProcessHost() && - !RenderProcessHost::run_renderer_in_process()) { + if (content::RenderProcessHost::ShouldTryToUseExistingProcessHost() && + !content::RenderProcessHost::run_renderer_in_process()) { RecordFinalStatus(origin, experiment, FINAL_STATUS_TOO_MANY_PROCESSES); return false; } @@ -1135,15 +1135,15 @@ void PrerenderManager::RecordFinalStatus(Origin origin, PrerenderManager* FindPrerenderManagerUsingRenderProcessId( int render_process_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - RenderProcessHost* render_process_host = - RenderProcessHost::FromID(render_process_id); + content::RenderProcessHost* render_process_host = + content::RenderProcessHost::FromID(render_process_id); // Each render process is guaranteed to only hold RenderViews owned by the // same BrowserContext. This is enforced by // RenderProcessHost::GetExistingProcessHost. - if (!render_process_host || !render_process_host->browser_context()) + if (!render_process_host || !render_process_host->GetBrowserContext()) return NULL; Profile* profile = Profile::FromBrowserContext( - render_process_host->browser_context()); + render_process_host->GetBrowserContext()); if (!profile) return NULL; return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 3310e12..206c04a 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -58,12 +58,13 @@ void BackgroundPrintingManager::OwnPrintPreviewTab( // // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - RenderProcessHost* rph = preview_tab->render_view_host()->process(); + content::RenderProcessHost* rph = preview_tab->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph))) { + content::Source<content::RenderProcessHost>( + rph))) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph)); + content::Source<content::RenderProcessHost>(rph)); } // Activate the initiator tab. @@ -85,7 +86,8 @@ void BackgroundPrintingManager::Observe( const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - OnRendererProcessClosed(content::Source<RenderProcessHost>(source).ptr()); + OnRendererProcessClosed( + content::Source<content::RenderProcessHost>(source).ptr()); break; } case chrome::NOTIFICATION_PRINT_JOB_RELEASED: { @@ -106,7 +108,7 @@ void BackgroundPrintingManager::Observe( } void BackgroundPrintingManager::OnRendererProcessClosed( - RenderProcessHost* rph) { + content::RenderProcessHost* rph) { TabContentsWrapperSet preview_tabs_pending_deletion; TabContentsWrapperSet::const_iterator it; for (it = begin(); it != end(); ++it) { @@ -143,9 +145,10 @@ void BackgroundPrintingManager::OnTabContentsDestroyed( bool shared_rph = HasSharedRenderProcessHost(printing_tabs_, preview_tab) || HasSharedRenderProcessHost(printing_tabs_pending_deletion_, preview_tab); if (!shared_rph) { - RenderProcessHost* rph = preview_tab->render_view_host()->process(); + content::RenderProcessHost* rph = + preview_tab->render_view_host()->process(); registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph)); + content::Source<content::RenderProcessHost>(rph)); } // Remove other notifications and remove the tab from its @@ -171,7 +174,7 @@ void BackgroundPrintingManager::DeletePreviewTab(TabContentsWrapper* tab) { bool BackgroundPrintingManager::HasSharedRenderProcessHost( const TabContentsWrapperSet& set, TabContentsWrapper* tab) { - RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = tab->render_view_host()->process(); for (TabContentsWrapperSet::const_iterator it = set.begin(); it != set.end(); ++it) { diff --git a/chrome/browser/printing/background_printing_manager.h b/chrome/browser/printing/background_printing_manager.h index 81c2843..4a7e12e 100644 --- a/chrome/browser/printing/background_printing_manager.h +++ b/chrome/browser/printing/background_printing_manager.h @@ -14,9 +14,12 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class RenderProcessHost; class TabContentsWrapper; +namespace content { +class RenderProcessHost; +} + namespace printing { // Manages hidden tabs that prints documents in the background. @@ -49,7 +52,7 @@ class BackgroundPrintingManager : public base::NonThreadSafe, private: // Notifications handlers. - void OnRendererProcessClosed(RenderProcessHost* rph); + void OnRendererProcessClosed(content::RenderProcessHost* rph); void OnPrintJobReleased(TabContentsWrapper* preview_tab); void OnTabContentsDestroyed(TabContentsWrapper* preview_tab); diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index dd57c26..ba6696a 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -41,7 +41,7 @@ namespace { void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { // Always enable the internal PDF plugin for the print preview page. ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( - preview_tab->render_view_host()->process()->id(), + preview_tab->render_view_host()->process()->GetID(), preview_tab->render_view_host()->routing_id(), GURL(), ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); @@ -196,7 +196,8 @@ void PrintPreviewTabController::Observe( const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - OnRendererProcessClosed(content::Source<RenderProcessHost>(source).ptr()); + OnRendererProcessClosed( + content::Source<content::RenderProcessHost>(source).ptr()); break; } case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { @@ -225,7 +226,7 @@ void PrintPreviewTabController::Observe( } void PrintPreviewTabController::OnRendererProcessClosed( - RenderProcessHost* rph) { + content::RenderProcessHost* rph) { // Store tabs in a vector and deal with them after iterating through // |preview_tab_map_| because RemoveFooTab() can change |preview_tab_map_|. std::vector<TabContentsWrapper*> closed_initiator_tabs; @@ -404,12 +405,13 @@ void PrintPreviewTabController::AddObservers(TabContentsWrapper* tab) { // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = tab->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph))) { + content::Source<content::RenderProcessHost>( + rph))) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph)); + content::Source<content::RenderProcessHost>(rph)); } } @@ -423,12 +425,13 @@ void PrintPreviewTabController::RemoveObservers(TabContentsWrapper* tab) { // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = tab->render_view_host()->process(); if (registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph))) { + content::Source<content::RenderProcessHost>( + rph))) { registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph)); + content::Source<content::RenderProcessHost>(rph)); } } diff --git a/chrome/browser/printing/print_preview_tab_controller.h b/chrome/browser/printing/print_preview_tab_controller.h index f4717ae..b5ebb6b 100644 --- a/chrome/browser/printing/print_preview_tab_controller.h +++ b/chrome/browser/printing/print_preview_tab_controller.h @@ -21,11 +21,11 @@ #include "content/public/browser/notification_registrar.h" class GURL; -class RenderProcessHost; class TabContentsWrapper; namespace content { struct LoadCommittedDetails; +class RenderProcessHost; } namespace printing { @@ -83,7 +83,7 @@ class PrintPreviewTabController // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when // the initiator renderer crashed. - void OnRendererProcessClosed(RenderProcessHost* rph); + void OnRendererProcessClosed(content::RenderProcessHost* rph); // Handler for the TAB_CONTENTS_DESTROYED notification. This is observed when // either tab is closed. diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index c6eb3f6..0de2f77 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -101,12 +101,12 @@ #include "content/browser/file_system/browser_file_system_helper.h" #include "content/browser/host_zoom_map.h" #include "content/browser/in_process_webkit/webkit_context.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/speech/speech_input_manager.h" #include "content/browser/ssl/ssl_host_state.h" #include "content/browser/user_metrics.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "grit/locale_settings.h" #include "net/base/transport_security_state.h" #include "net/http/http_server_properties.h" @@ -1195,10 +1195,10 @@ void ProfileImpl::ReinitializeSpellCheckHost(bool force) { GetRequestContext()); if (result == SpellCheckProfile::REINITIALIZE_REMOVED_HOST) { // The spellchecker has been disabled. - for (RenderProcessHost::iterator - i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* process = i.GetCurrentValue(); + content::RenderProcessHost* process = i.GetCurrentValue(); process->Send(new SpellCheckMsg_Init(IPC::InvalidPlatformFileForTransit(), std::vector<std::string>(), std::string(), @@ -1297,10 +1297,10 @@ void ProfileImpl::Observe(int type, ReinitializeSpellCheckHost(true); } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); - for (RenderProcessHost::iterator - i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* process = i.GetCurrentValue(); + content::RenderProcessHost* process = i.GetCurrentValue(); process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); } } else if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index b0ff82f..3a40d60 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc @@ -30,9 +30,9 @@ #include "chrome/common/render_messages.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/common/child_process_info.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" @@ -313,7 +313,8 @@ void ChromeRenderMessageFilter::OnGetExtensionMessageBundleOnFileThread( void ChromeRenderMessageFilter::OnExtensionAddListener( const std::string& extension_id, const std::string& event_name) { - RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(render_process_id_); if (!process || !profile_->GetExtensionEventRouter()) return; @@ -324,7 +325,8 @@ void ChromeRenderMessageFilter::OnExtensionAddListener( void ChromeRenderMessageFilter::OnExtensionRemoveListener( const std::string& extension_id, const std::string& event_name) { - RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(render_process_id_); if (!process || !profile_->GetExtensionEventRouter()) return; @@ -345,7 +347,7 @@ void ChromeRenderMessageFilter::OnExtensionEventAck( } void ChromeRenderMessageFilter::OnExtensionCloseChannel(int port_id) { - if (!RenderProcessHost::FromID(render_process_id_)) + if (!content::RenderProcessHost::FromID(render_process_id_)) return; // To guard against crash in browser_tests shutdown. if (profile_->GetExtensionMessageService()) diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc index eb0646c..dd59ff4 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -87,7 +87,7 @@ void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() { // TODO(aa): Totally lame to store this state in a global map in extension // service. Can we get it from EPM instead? profile_->GetExtensionService()->SetInstalledAppForRenderer( - render_view_host()->process()->id(), extension); + render_view_host()->process()->GetID(), extension); } } @@ -96,7 +96,7 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { if (!extension) return; - RenderProcessHost* process = render_view_host()->process(); + content::RenderProcessHost* process = render_view_host()->process(); if (extension->is_app()) { Send(new ExtensionMsg_ActivateApplication(extension->id())); @@ -105,7 +105,7 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { // restarted (hence the re-initialization), so we need to update that // mapping. profile_->GetExtensionService()->SetInstalledAppForRenderer( - process->id(), extension); + process->GetID(), extension); } // Some extensions use chrome:// URLs. @@ -113,14 +113,14 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { if (type == Extension::TYPE_EXTENSION || type == Extension::TYPE_PACKAGED_APP) { ChildProcessSecurityPolicy::GetInstance()->GrantScheme( - process->id(), chrome::kChromeUIScheme); + process->GetID(), chrome::kChromeUIScheme); } if (type == Extension::TYPE_EXTENSION && profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( extension->id())) { ChildProcessSecurityPolicy::GetInstance()->GrantScheme( - process->id(), chrome::kFileScheme); + process->GetID(), chrome::kFileScheme); } if (type == Extension::TYPE_EXTENSION || diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc index 1cf4874..4f9d270 100644 --- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc +++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc @@ -10,20 +10,21 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" namespace { RenderViewHost* FindFirstDevToolsHost() { - RenderProcessHost::iterator hosts = RenderProcessHost::AllHostsIterator(); + content::RenderProcessHost::iterator hosts = + content::RenderProcessHost::AllHostsIterator(); for (; !hosts.IsAtEnd(); hosts.Advance()) { - RenderProcessHost* render_process_host = hosts.GetCurrentValue(); + content::RenderProcessHost* render_process_host = hosts.GetCurrentValue(); DCHECK(render_process_host); if (!render_process_host->HasConnection()) continue; - RenderProcessHost::listeners_iterator iter( + content::RenderProcessHost::listeners_iterator iter( render_process_host->ListenersIterator()); for (; !iter.IsAtEnd(); iter.Advance()) { const RenderWidgetHost* widget = diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index 605a1b4..02bf510 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -19,8 +19,8 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" using base::Time; using base::TimeDelta; @@ -163,15 +163,15 @@ void WebCacheManager::Observe(int type, const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); - Add(process->id()); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); + Add(process->GetID()); break; } case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); - Remove(process->id()); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); + Remove(process->GetID()); break; } default: @@ -308,7 +308,8 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) { // Inform each render process of its cache allocation. AllocationStrategy::const_iterator allocation = strategy.begin(); while (allocation != strategy.end()) { - RenderProcessHost* host = RenderProcessHost::FromID(allocation->first); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(allocation->first); if (host) { // This is the capacity this renderer has been allocated. size_t capacity = allocation->second; @@ -336,7 +337,8 @@ void WebCacheManager::ClearRendederCache( WebCacheManager::ClearCacheOccasion occasion) { std::set<int>::const_iterator iter = renderers.begin(); for (; iter != renderers.end(); ++iter) { - RenderProcessHost* host = RenderProcessHost::FromID(*iter); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(*iter); if (host) host->Send(new ChromeViewMsg_ClearCache(occasion == ON_NAVIGATION)); } diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc index f949f7d..1f1cac1 100644 --- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc +++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/common/result_codes.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 0bf18a8..d3edca3 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -21,7 +21,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -33,6 +32,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" using content::BrowserThread; @@ -343,7 +343,7 @@ void ClientSideDetectionHost::OnSafeBrowsingHit( // either a malware or phishing hit. In this case we store the unique page // ID for later. if (tab_contents() && - tab_contents()->GetRenderProcessHost()->id() == + tab_contents()->GetRenderProcessHost()->GetID() == resource.render_process_host_id && tab_contents()->render_view_host()->routing_id() == resource.render_view_id && @@ -421,7 +421,7 @@ void ClientSideDetectionHost::MaybeShowPhishingWarning(GURL phishing_url, resource.is_subresource = false; resource.threat_type = SafeBrowsingService::CLIENT_SIDE_PHISHING_URL; resource.render_process_host_id = - tab_contents()->GetRenderProcessHost()->id(); + tab_contents()->GetRenderProcessHost()->GetID(); resource.render_view_id = tab_contents()->render_view_host()->routing_id(); if (!sb_service_->IsWhitelisted(resource)) { diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 82d9429..c9d64db 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -265,7 +265,8 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness { virtual ~BogusClient() {} }; resource.client = new BogusClient(); - resource.render_process_host_id = contents()->GetRenderProcessHost()->id(); + resource.render_process_host_id = contents()->GetRenderProcessHost()-> + GetID(); resource.render_view_id = contents()->render_view_host()->routing_id(); csd_host_->OnSafeBrowsingHit(resource); delete resource.client; @@ -412,7 +413,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneShowInterstitial) { EXPECT_FALSE(resource.is_subresource); EXPECT_EQ(SafeBrowsingService::CLIENT_SIDE_PHISHING_URL, resource.threat_type); - EXPECT_EQ(contents()->GetRenderProcessHost()->id(), + EXPECT_EQ(contents()->GetRenderProcessHost()->GetID(), resource.render_process_host_id); EXPECT_EQ(contents()->render_view_host()->routing_id(), resource.render_view_id); @@ -508,7 +509,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneMultiplePings) { EXPECT_FALSE(resource.is_subresource); EXPECT_EQ(SafeBrowsingService::CLIENT_SIDE_PHISHING_URL, resource.threat_type); - EXPECT_EQ(contents()->GetRenderProcessHost()->id(), + EXPECT_EQ(contents()->GetRenderProcessHost()->GetID(), resource.render_process_host_id); EXPECT_EQ(contents()->render_view_host()->routing_id(), resource.render_view_id); diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc index f92cca5..ab94663 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service.cc @@ -24,10 +24,10 @@ #include "chrome/common/safe_browsing/client_model.pb.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/url_fetcher.h" #include "crypto/sha2.h" #include "googleurl/src/gurl.h" @@ -214,15 +214,16 @@ void ClientSideDetectionService::Observe( // Model might not be ready or maybe there was an error. return; } - SendModelToProcess(content::Source<RenderProcessHost>(source).ptr()); + SendModelToProcess( + content::Source<content::RenderProcessHost>(source).ptr()); } void ClientSideDetectionService::SendModelToProcess( - RenderProcessHost* process) { + content::RenderProcessHost* process) { // The ClientSideDetectionService is enabled if _any_ active profile has // SafeBrowsing turned on. Here we check the profile for each renderer // process and only send the model to those that have SafeBrowsing enabled. - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); std::string model; if (profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { VLOG(2) << "Sending phishing model to RenderProcessHost @" << process; @@ -235,7 +236,8 @@ void ClientSideDetectionService::SendModelToProcess( } void ClientSideDetectionService::SendModelToRenderers() { - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { SendModelToProcess(i.GetCurrentValue()); } diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h index 7ca7566..a41a710 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.h +++ b/chrome/browser/safe_browsing/client_side_detection_service.h @@ -35,13 +35,16 @@ #include "googleurl/src/gurl.h" #include "net/base/net_util.h" -class RenderProcessHost; class SafeBrowsingService; namespace base { class TimeDelta; } +namespace content { +class RenderProcessHost; +} + namespace net { class URLRequestContextGetter; class URLRequestStatus; @@ -234,7 +237,7 @@ class ClientSideDetectionService : public content::URLFetcherDelegate, bool InitializePrivateNetworks(); // Send the model to the given renderer. - void SendModelToProcess(RenderProcessHost* process); + void SendModelToProcess(content::RenderProcessHost* process); // Same as above but sends the model to all rendereres. void SendModelToRenderers(); diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc index 024fe9c..0731980 100644 --- a/chrome/browser/safe_browsing/malware_details_unittest.cc +++ b/chrome/browser/safe_browsing/malware_details_unittest.cc @@ -217,7 +217,8 @@ class MalwareDetailsTest : public ChromeRenderViewHostTestHarness { resource->url = url; resource->is_subresource = is_subresource; resource->threat_type = SafeBrowsingService::URL_MALWARE; - resource->render_process_host_id = contents()->GetRenderProcessHost()->id(); + resource->render_process_host_id = contents()->GetRenderProcessHost()-> + GetID(); resource->render_view_id = contents()->render_view_host()->routing_id(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 12f10a4..c398aa1 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -171,7 +171,8 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness, resource->url = url; resource->is_subresource = is_subresource; resource->threat_type = SafeBrowsingService::URL_MALWARE; - resource->render_process_host_id = contents()->GetRenderProcessHost()->id(); + resource->render_process_host_id = contents()->GetRenderProcessHost()-> + GetID(); resource->render_view_id = contents()->render_view_host()->routing_id(); } diff --git a/chrome/browser/search_engines/search_provider_install_state_message_filter.cc b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc index c961c01..1b1701a 100644 --- a/chrome/browser/search_engines/search_provider_install_state_message_filter.cc +++ b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc @@ -8,10 +8,10 @@ #include "base/logging.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" using content::BrowserThread; @@ -23,10 +23,11 @@ SearchProviderInstallStateMessageFilter( : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), provider_data_(profile->GetWebDataService(Profile::EXPLICIT_ACCESS), content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::Source<RenderProcessHost>( - RenderProcessHost::FromID(render_process_id))), + content::Source<content::RenderProcessHost>( + content::RenderProcessHost::FromID( + render_process_id))), is_off_the_record_(profile->IsOffTheRecord()) { - // This is initialized by BrowserRenderProcessHost. Do not add any non-trivial + // This is initialized by RenderProcessHostImpl. Do not add any non-trivial // initialization here. Instead do it lazily when required. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } diff --git a/chrome/browser/sidebar/sidebar_container.cc b/chrome/browser/sidebar/sidebar_container.cc index d428971..4467006 100644 --- a/chrome/browser/sidebar/sidebar_container.cc +++ b/chrome/browser/sidebar/sidebar_container.cc @@ -11,12 +11,12 @@ #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/extension_sidebar_defaults.h" #include "chrome/common/extensions/extension_sidebar_utils.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/browser/spellchecker/spellcheck_host.h b/chrome/browser/spellchecker/spellcheck_host.h index a439aa3..38daccd 100644 --- a/chrome/browser/spellchecker/spellcheck_host.h +++ b/chrome/browser/spellchecker/spellcheck_host.h @@ -18,8 +18,11 @@ namespace base { class WaitableEvent; } -class Profile; +namespace content { class RenderProcessHost; +} + +class Profile; class SpellCheckHostMetrics; class SpellCheckProfileProvider; @@ -72,7 +75,7 @@ class SpellCheckHost { // Pass the renderer some basic intialization information. Note that the // renderer will not load Hunspell until it needs to. - virtual void InitForRenderer(RenderProcessHost* process) = 0; + virtual void InitForRenderer(content::RenderProcessHost* process) = 0; // Adds the given word to the custom words list and inform renderer of the // update. diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.cc b/chrome/browser/spellchecker/spellcheck_host_impl.cc index c0cd19b..2c2d923 100644 --- a/chrome/browser/spellchecker/spellcheck_host_impl.cc +++ b/chrome/browser/spellchecker/spellcheck_host_impl.cc @@ -23,9 +23,9 @@ #include "chrome/common/pref_names.h" #include "chrome/common/spellcheck_common.h" #include "chrome/common/spellcheck_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/url_fetcher.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request_context_getter.h" @@ -162,12 +162,12 @@ void SpellCheckHostImpl::UnsetProfile() { registrar_.RemoveAll(); } -void SpellCheckHostImpl::InitForRenderer(RenderProcessHost* process) { +void SpellCheckHostImpl::InitForRenderer(content::RenderProcessHost* process) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Bug 103693: SpellCheckHostImpl and SpellCheckProfile should not // depend on Profile interface. - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); if (profile->GetSpellCheckHost() != this) return; @@ -290,9 +290,10 @@ void SpellCheckHostImpl::InformProfileOfInitializationWithCustomWords( if (profile_) profile_->SpellCheckHostInitialized(custom_words); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* process = i.GetCurrentValue(); + content::RenderProcessHost* process = i.GetCurrentValue(); if (process) InitForRenderer(process); } @@ -384,7 +385,8 @@ void SpellCheckHostImpl::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CREATED); - RenderProcessHost* process = content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); InitForRenderer(process); } @@ -478,7 +480,8 @@ bool SpellCheckHostImpl::IsUsingPlatformChecker() const { void SpellCheckHostImpl::AddWordComplete(const std::string& word) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); } diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.h b/chrome/browser/spellchecker/spellcheck_host_impl.h index 758a821..4ff371d 100644 --- a/chrome/browser/spellchecker/spellcheck_host_impl.h +++ b/chrome/browser/spellchecker/spellcheck_host_impl.h @@ -54,7 +54,7 @@ class SpellCheckHostImpl : public SpellCheckHost, // SpellCheckHost implementation virtual void UnsetProfile() OVERRIDE; - virtual void InitForRenderer(RenderProcessHost* process) OVERRIDE; + virtual void InitForRenderer(content::RenderProcessHost* process) OVERRIDE; virtual void AddWord(const std::string& word) OVERRIDE; virtual const base::PlatformFile& GetDictionaryFile() const OVERRIDE; virtual const std::string& GetLanguage() const OVERRIDE; diff --git a/chrome/browser/spellchecker/spellcheck_message_filter.cc b/chrome/browser/spellchecker/spellcheck_message_filter.cc index 26cec72..622995e 100644 --- a/chrome/browser/spellchecker/spellcheck_message_filter.cc +++ b/chrome/browser/spellchecker/spellcheck_message_filter.cc @@ -10,7 +10,7 @@ #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" #include "chrome/common/spellcheck_messages.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -93,10 +93,11 @@ void SpellCheckMessageFilter::OnPlatformRequestTextCheck( } void SpellCheckMessageFilter::OnSpellCheckerRequestDictionary() { - RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(render_process_id_); if (!host) return; // Teardown. - Profile* profile = Profile::FromBrowserContext(host->browser_context()); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); // The renderer has requested that we initialize its spellchecker. This should // generally only be called once per session, as after the first call, all // future renderers will be passed the initialization information on startup @@ -115,11 +116,12 @@ void SpellCheckMessageFilter::OnSpellCheckerRequestDictionary() { void SpellCheckMessageFilter::OnNotifyChecked(const string16& word, bool misspelled) { - RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(render_process_id_); if (!host) return; // Teardown. // Delegates to SpellCheckHost which tracks the stats of our spellchecker. - Profile* profile = Profile::FromBrowserContext(host->browser_context()); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost(); if (spellcheck_host && spellcheck_host->GetMetrics()) spellcheck_host->GetMetrics()->RecordCheckedWordStats(word, misspelled); diff --git a/chrome/browser/spellchecker/spellcheck_profile_unittest.cc b/chrome/browser/spellchecker/spellcheck_profile_unittest.cc index f82f0a9..fc4b53d 100644 --- a/chrome/browser/spellchecker/spellcheck_profile_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_profile_unittest.cc @@ -18,7 +18,7 @@ namespace { class MockSpellCheckHost : public SpellCheckHost { public: MOCK_METHOD0(UnsetProfile, void()); - MOCK_METHOD1(InitForRenderer, void(RenderProcessHost* process)); + MOCK_METHOD1(InitForRenderer, void(content::RenderProcessHost* process)); MOCK_METHOD1(AddWord, void(const std::string& word)); MOCK_CONST_METHOD0(GetDictionaryFile, const base::PlatformFile&()); MOCK_CONST_METHOD0(GetCustomWords, diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 4cda4bf..07f285e 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -108,7 +108,7 @@ std::string SSLBlockingPage::GetHTMLContents() { void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { const net::SSLInfo& ssl_info = handler_->ssl_info(); int cert_id = CertStore::GetInstance()->StoreCert( - ssl_info.cert, tab()->render_view_host()->process()->id()); + ssl_info.cert, tab()->render_view_host()->process()->GetID()); entry->ssl().set_security_style( content::SECURITY_STYLE_AUTHENTICATION_BROKEN); diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 1f66777..704c22a 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -31,7 +31,6 @@ #include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_widget_fullscreen_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" @@ -42,6 +41,7 @@ #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/webui/web_ui.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/common/view_messages.h" #include "net/base/network_change_notifier.h" @@ -118,7 +118,7 @@ RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( // Ensure that we're trying to open this from the extension's process. extensions::ProcessMap* process_map = extensions_service->process_map(); if (!site->GetProcess() || - !process_map->Contains(extension->id(), site->GetProcess()->id())) { + !process_map->Contains(extension->id(), site->GetProcess()->GetID())) { return NULL; } @@ -189,7 +189,8 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( } RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget( - int route_id, WebKit::WebPopupType popup_type, RenderProcessHost* process) { + int route_id, WebKit::WebPopupType popup_type, + content::RenderProcessHost* process) { RenderWidgetHost* widget_host = new RenderWidgetHost(process, route_id); RenderWidgetHostView* widget_view = @@ -203,7 +204,7 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget( RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewFullscreenWidget( - int route_id, RenderProcessHost* process) { + int route_id, content::RenderProcessHost* process) { RenderWidgetFullscreenHost* fullscreen_widget_host = new RenderWidgetFullscreenHost(process, route_id); RenderWidgetHostView* widget_view = @@ -334,7 +335,7 @@ RenderWidgetHostView* WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( RenderViewHost* rvh) { Profile* profile = Profile::FromBrowserContext( - rvh->process()->browser_context()); + rvh->process()->GetBrowserContext()); PrefService* prefs = profile->GetPrefs(); WebPreferences web_prefs; @@ -538,7 +539,7 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( DCHECK(!web_prefs.default_encoding.empty()); if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( - rvh->process()->id())) { + rvh->process()->GetID())) { web_prefs.loads_images_automatically = true; web_prefs.javascript_enabled = true; } diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h index 0ebc16a..4c9ec02 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -20,7 +20,6 @@ class BackgroundContents; class Profile; -class RenderProcessHost; class RenderViewHost; class RenderViewHostDelegate; class RenderWidgetHost; @@ -31,6 +30,7 @@ struct ViewHostMsg_CreateWindow_Params; namespace content { class BrowserContext; +class RenderProcessHost; } // Provides helper methods that provide common implementations of some @@ -57,10 +57,10 @@ class RenderViewHostDelegateViewHelper : public content::NotificationObserver { // GetCreatedWidget. RenderWidgetHostView* CreateNewWidget(int route_id, WebKit::WebPopupType popup_type, - RenderProcessHost* process); + content::RenderProcessHost* process); RenderWidgetHostView* CreateNewFullscreenWidget( - int route_id, RenderProcessHost* process); + int route_id, content::RenderProcessHost* process); // Finds the new RenderWidgetHost and returns it. Note that this can only be // called once as this call also removes it from the internal map. diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 5eca928..c9731b1 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -25,13 +25,13 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/user_metrics.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" namespace { @@ -1139,12 +1139,12 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { // Construct a map of processes to the number of associated tabs that are // closing. - std::map<RenderProcessHost*, size_t> processes; + std::map<content::RenderProcessHost*, size_t> processes; for (size_t i = 0; i < indices.size(); ++i) { TabContentsWrapper* detached_contents = GetContentsAt(indices[i]); - RenderProcessHost* process = + content::RenderProcessHost* process = detached_contents->tab_contents()->GetRenderProcessHost(); - std::map<RenderProcessHost*, size_t>::iterator iter = + std::map<content::RenderProcessHost*, size_t>::iterator iter = processes.find(process); if (iter == processes.end()) { processes[process] = 1; @@ -1154,7 +1154,7 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, } // Try to fast shutdown the tabs that can close. - for (std::map<RenderProcessHost*, size_t>::iterator iter = + for (std::map<content::RenderProcessHost*, size_t>::iterator iter = processes.begin(); iter != processes.end(); ++iter) { iter->first->FastShutdownForPageCount(iter->second); diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index 635097c..9267058 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -1747,7 +1747,7 @@ TEST_F(TabStripModelTest, FastShutdown) { // On a mock RPH this checks whether we *attempted* fast shutdown. // A real RPH would reject our attempt since there is an unload handler. EXPECT_TRUE(contents1->tab_contents()-> - GetRenderProcessHost()->fast_shutdown_started()); + GetRenderProcessHost()->FastShutdownStarted()); EXPECT_EQ(2, tabstrip.count()); delegate.set_run_unload_listener(false); @@ -1770,7 +1770,7 @@ TEST_F(TabStripModelTest, FastShutdown) { tabstrip.CloseTabContentsAt(1, TabStripModel::CLOSE_NONE); EXPECT_FALSE(contents1->tab_contents()-> - GetRenderProcessHost()->fast_shutdown_started()); + GetRenderProcessHost()->FastShutdownStarted()); EXPECT_EQ(1, tabstrip.count()); tabstrip.CloseAllTabs(); diff --git a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc index 2db029f..ae5b401 100644 --- a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc @@ -12,10 +12,10 @@ #include "chrome/browser/notifications/balloon_host.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/common/chrome_notification_types.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 24f1644..42e0fc1 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -42,11 +42,11 @@ #include "chrome/common/url_constants.h" #include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/render_message_filter.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -272,7 +272,7 @@ string16 TaskManagerTabContentsResource::GetTitle() const { tab_contents_->profile()->GetExtensionService(); extensions::ProcessMap* process_map = extension_service->process_map(); bool is_app = extension_service->IsInstalledApp(url) && - process_map->Contains(contents->GetRenderProcessHost()->id()); + process_map->Contains(contents->GetRenderProcessHost()->GetID()); int message_id = GetMessagePrefixID( is_app, @@ -567,8 +567,8 @@ TaskManagerBackgroundContentsResourceProvider::GetResource( for (Resources::iterator i = resources_.begin(); i != resources_.end(); i++) { TabContents* tab = i->first->tab_contents(); - if (tab->render_view_host()->process()->id() == render_process_host_id && - tab->render_view_host()->routing_id() == routing_id) { + if (tab->render_view_host()->process()->GetID() == render_process_host_id + && tab->render_view_host()->routing_id() == routing_id) { return i->second; } } diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index ad4cbc4..502d70a 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -293,7 +293,8 @@ void TranslateManager::Observe(int type, base::Bind( &TranslateManager::InitiateTranslationPosted, weak_method_factory_.GetWeakPtr(), - controller->tab_contents()->render_view_host()->process()->id(), + controller->tab_contents()->render_view_host()->process()-> + GetID(), controller->tab_contents()->render_view_host()->routing_id(), helper->language_state().original_language())); break; @@ -572,7 +573,7 @@ void TranslateManager::TranslatePage(TabContents* tab_contents, // script. Once it is downloaded we'll do the translate. RenderViewHost* rvh = tab_contents->render_view_host(); PendingRequest request; - request.render_process_id = rvh->process()->id(); + request.render_process_id = rvh->process()->GetID(); request.render_view_id = rvh->routing_id(); request.page_id = entry->page_id(); request.source_lang = source_lang; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index ea340c7..4c52ac1 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -2506,7 +2506,7 @@ void Browser::EnumerateDirectoryHelper(TabContents* tab, int request_id, const FilePath& path) { ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); - if (!policy->CanReadDirectory(tab->render_view_host()->process()->id(), + if (!policy->CanReadDirectory(tab->render_view_host()->process()->GetID(), path)) { return; } diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 135c0c2..c2d035e 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -39,7 +39,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" @@ -98,7 +98,8 @@ std::wstring WindowCaptionFromPageTitle(std::wstring page_title) { // Returns the number of active RenderProcessHosts. int CountRenderProcessHosts() { int result = 0; - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) ++result; return result; @@ -371,7 +372,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); TabContents* oldtab = browser()->GetSelectedTabContents(); - RenderProcessHost* process = oldtab->render_view_host()->process(); + content::RenderProcessHost* process = oldtab->render_view_host()->process(); // Now open a tab to a blank page, set its opener to null, and redirect it // cross-site. @@ -402,7 +403,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { newtab->controller().GetLastCommittedEntry()->url().spec()); // Popup window should not be in the opener's process. - RenderProcessHost* popup_process = newtab->render_view_host()->process(); + content::RenderProcessHost* popup_process = + newtab->render_view_host()->process(); EXPECT_NE(process, popup_process); // Now open a tab to a blank page, set its opener to null, and use a @@ -435,7 +437,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { newtab2->controller().GetLastCommittedEntry()->url().spec()); // This popup window should also not be in the opener's process. - RenderProcessHost* popup_process2 = newtab2->render_view_host()->process(); + content::RenderProcessHost* popup_process2 = + newtab2->render_view_host()->process(); EXPECT_NE(process, popup_process2); } @@ -457,7 +460,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); TabContents* oldtab = browser()->GetSelectedTabContents(); - RenderProcessHost* process = oldtab->render_view_host()->process(); + content::RenderProcessHost* process = oldtab->render_view_host()->process(); // Now open a tab to a blank page, set its opener to null, and redirect it // cross-site. @@ -487,7 +490,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { newtab->controller().GetLastCommittedEntry()->url().spec()); // Popup window should still be in the opener's process. - RenderProcessHost* popup_process = newtab->render_view_host()->process(); + content::RenderProcessHost* popup_process = + newtab->render_view_host()->process(); EXPECT_EQ(process, popup_process); // Same thing if the current tab tries to navigate itself. @@ -506,7 +510,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { oldtab->controller().GetLastCommittedEntry()->url().spec()); // Original window should still be in the original process. - RenderProcessHost* new_process = newtab->render_view_host()->process(); + content::RenderProcessHost* new_process = + newtab->render_view_host()->process(); EXPECT_EQ(process, new_process); } @@ -517,10 +522,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RenderIdleTime) { ui_test_utils::NavigateToURL(browser(), ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), FilePath(kTitle1File))); - RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); for (; !it.IsAtEnd(); it.Advance()) { base::TimeDelta renderer_td = - it.GetCurrentValue()->get_child_process_idle_time(); + it.GetCurrentValue()->GetChildProcessIdleTime(); base::TimeDelta browser_td = base::TimeTicks::Now() - start; EXPECT_TRUE(browser_td >= renderer_td); } diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index ea4f60d..52ac775 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -19,10 +19,10 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #if defined(OS_MACOSX) @@ -72,7 +72,8 @@ class BrowserActivityObserver : public content::NotificationObserver { // Counts the number of active RenderProcessHosts and logs them. void LogRenderProcessHostCount() const { int hosts_count = 0; - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) ++hosts_count; UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 0003ae1..3e5e38e 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -16,9 +16,9 @@ #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/logging_chrome.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc index f00a32b..b3668f4 100644 --- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc @@ -13,9 +13,9 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/logging_chrome.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index b381a03..972647f 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -589,7 +589,7 @@ void TabContentsWrapper::RenderViewCreated(RenderViewHost* render_view_host) { void TabContentsWrapper::DidBecomeSelected() { WebCacheManager::GetInstance()->ObserveActivity( - tab_contents()->GetRenderProcessHost()->id()); + tab_contents()->GetRenderProcessHost()->GetID()); } bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index 0b75aa6..c128e19 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -12,9 +12,9 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/logging_chrome.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -61,7 +61,7 @@ class HungPagesTableModel : public views::GroupTableModel { // Returns the first RenderProcessHost, or NULL if there aren't any // TabContents. - RenderProcessHost* GetRenderProcessHost(); + content::RenderProcessHost* GetRenderProcessHost(); // Returns the first RenderViewHost, or NULL if there aren't any TabContents. RenderViewHost* GetRenderViewHost(); @@ -124,7 +124,7 @@ HungPagesTableModel::HungPagesTableModel(Delegate* delegate) HungPagesTableModel::~HungPagesTableModel() { } -RenderProcessHost* HungPagesTableModel::GetRenderProcessHost() { +content::RenderProcessHost* HungPagesTableModel::GetRenderProcessHost() { return tab_observers_.empty() ? NULL : tab_observers_[0]->tab_contents()->GetRenderProcessHost(); } diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc index 8ec3234..c22f9c5 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc @@ -12,13 +12,13 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_factory.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" +#include "content/public/browser/render_process_host.h" #include "ui/gfx/screen.h" #include "views/focus/focus_manager.h" #include "views/focus/view_storage.h" diff --git a/chrome/browser/ui/webui/media/media_internals_proxy.cc b/chrome/browser/ui/webui/media/media_internals_proxy.cc index 928a019..5ee0eeb 100644 --- a/chrome/browser/ui/webui/media/media_internals_proxy.cc +++ b/chrome/browser/ui/webui/media/media_internals_proxy.cc @@ -10,8 +10,8 @@ #include "chrome/browser/media/media_internals.h" #include "chrome/browser/ui/webui/media/media_internals_handler.h" #include "content/public/browser/notification_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -37,9 +37,10 @@ void MediaInternalsProxy::Observe(int type, const content::NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); - RenderProcessHost* process = content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); CallJavaScriptFunctionOnUIThread("media.onRendererTerminated", - base::Value::CreateIntegerValue(process->id())); + base::Value::CreateIntegerValue(process->GetID())); } void MediaInternalsProxy::Attach(MediaInternalsMessageHandler* handler) { diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc index 8894e6f..39571e2 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -36,7 +36,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { // doesn't cause us to kill the process. See http://crbug.com/104258. IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { // Set max renderers to 1 to force running out of processes. - RenderProcessHost::SetMaxRendererProcessCountForTest(1); + content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); // Start server for simple page. ASSERT_TRUE(test_server()->Start()); diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.cc b/chrome/browser/ui/webui/options/extension_settings_handler.cc index 668495f..56a4a86 100644 --- a/chrome/browser/ui/webui/options/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc @@ -777,9 +777,9 @@ void ExtensionSettingsHandler::GetActivePagesForExtensionProcess( continue; GURL url = host->delegate()->GetURL(); - RenderProcessHost* process = host->process(); + content::RenderProcessHost* process = host->process(); result->push_back( - ExtensionPage(url, process->id(), host->routing_id(), - process->browser_context()->IsOffTheRecord())); + ExtensionPage(url, process->GetID(), host->routing_id(), + process->GetBrowserContext()->IsOffTheRecord())); } } diff --git a/chrome/browser/visitedlink/visitedlink_event_listener.cc b/chrome/browser/visitedlink/visitedlink_event_listener.cc index a15dbe4..da41bba 100644 --- a/chrome/browser/visitedlink/visitedlink_event_listener.cc +++ b/chrome/browser/visitedlink/visitedlink_event_listener.cc @@ -7,10 +7,10 @@ #include "base/shared_memory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" using base::Time; using base::TimeDelta; @@ -31,7 +31,7 @@ static const unsigned kVisitedLinkBufferThreshold = 50; // As opposed to the VisitedLinkEventListener, which coalesces to // reduce the rate of messages being sent to render processes, this class // ensures that the updates occur only when explicitly requested. This is -// used for BrowserRenderProcessHost to only send Add/Reset link events to the +// used for RenderProcessHostImpl to only send Add/Reset link events to the // renderers when their tabs are visible and the corresponding RenderViews are // created. class VisitedLinkUpdater { @@ -42,7 +42,8 @@ class VisitedLinkUpdater { // Informs the renderer about a new visited link table. void SendVisitedLinkTable(base::SharedMemory* table_memory) { - RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(render_process_id_); if (!process) return; // Happens in tests base::SharedMemoryHandle handle_for_process; @@ -77,7 +78,8 @@ class VisitedLinkUpdater { // Sends visited link update messages: a list of links whose visited state // changed or reset of visited state for all links. void Update() { - RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(render_process_id_); if (!process) return; // Happens in tests @@ -124,8 +126,10 @@ void VisitedLinkEventListener::NewTable(base::SharedMemory* table_memory) { // Send to all RenderProcessHosts. for (Updaters::iterator i = updaters_.begin(); i != updaters_.end(); ++i) { // Make sure to not send to incognito renderers. - RenderProcessHost* process = RenderProcessHost::FromID(i->first); - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(i->first); + Profile* profile = Profile::FromBrowserContext( + process->GetBrowserContext()); VisitedLinkMaster* master = profile->GetVisitedLinkMaster(); if (master && master->shared_memory() == table_memory) i->second->SendVisitedLinkTable(table_memory); @@ -168,14 +172,14 @@ void VisitedLinkEventListener::Observe( const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* profile = - Profile::FromBrowserContext(process->browser_context()); + Profile::FromBrowserContext(process->GetBrowserContext()); if (!profile_->IsSameProfile(profile)) return; - updaters_[process->id()] = - make_linked_ptr(new VisitedLinkUpdater(process->id())); + updaters_[process->GetID()] = + make_linked_ptr(new VisitedLinkUpdater(process->GetID())); // Initialize support for visited links. Send the renderer process its // initial set of visited links. @@ -183,21 +187,22 @@ void VisitedLinkEventListener::Observe( if (!master) return; - updaters_[process->id()]->SendVisitedLinkTable(master->shared_memory()); + updaters_[process->GetID()]->SendVisitedLinkTable( + master->shared_memory()); break; } case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); - if (updaters_.count(process->id())) { - updaters_.erase(process->id()); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); + if (updaters_.count(process->GetID())) { + updaters_.erase(process->GetID()); } break; } case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: { RenderWidgetHost* widget = content::Source<RenderWidgetHost>(source).ptr(); - int child_id = widget->process()->id(); + int child_id = widget->process()->GetID(); if (updaters_.count(child_id)) updaters_[child_id]->Update(); break; diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc index 43e93a1..487c73d 100644 --- a/chrome/browser/visitedlink/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink/visitedlink_unittest.cc @@ -18,7 +18,7 @@ #include "chrome/renderer/visitedlink_slave.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/test/test_browser_thread.h" @@ -495,12 +495,12 @@ class VisitCountingProfile : public TestingProfile { scoped_ptr<VisitedLinkMaster> visited_link_master_; }; -// Stub out as little as possible, borrowing from BrowserRenderProcessHost. -class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { +// Stub out as little as possible, borrowing from RenderProcessHost. +class VisitRelayingRenderProcessHost : public RenderProcessHostImpl { public: explicit VisitRelayingRenderProcessHost( content::BrowserContext* browser_context) - : BrowserRenderProcessHost(browser_context) { + : RenderProcessHostImpl(browser_context) { content::NotificationService::current()->Notify( content::NOTIFICATION_RENDERER_PROCESS_CREATED, content::Source<RenderProcessHost>(this), @@ -509,7 +509,7 @@ class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { virtual ~VisitRelayingRenderProcessHost() { content::NotificationService::current()->Notify( content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::Source<RenderProcessHost>(this), + content::Source<content::RenderProcessHost>(this), content::NotificationService::NoDetails()); } @@ -532,7 +532,7 @@ class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { virtual bool Send(IPC::Message* msg) { VisitCountingProfile* counting_profile = static_cast<VisitCountingProfile*>( - Profile::FromBrowserContext(browser_context())); + Profile::FromBrowserContext(GetBrowserContext())); if (msg->type() == ChromeViewMsg_VisitedLink_Add::ID) { void* iter = NULL; @@ -556,11 +556,11 @@ class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { }; class VisitedLinkRenderProcessHostFactory - : public RenderProcessHostFactory { + : public content::RenderProcessHostFactory { public: VisitedLinkRenderProcessHostFactory() - : RenderProcessHostFactory() {} - virtual RenderProcessHost* CreateRenderProcessHost( + : content::RenderProcessHostFactory() {} + virtual content::RenderProcessHost* CreateRenderProcessHost( content::BrowserContext* browser_context) const OVERRIDE { return new VisitRelayingRenderProcessHost(browser_context); } diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 02a2d7a..b26c80b 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -29,10 +29,10 @@ #include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "content/renderer/mock_content_renderer_client.h" #include "content/test/test_browser_thread.h" #include "net/base/mock_host_resolver.h" @@ -106,7 +106,7 @@ void InProcessBrowserTest::SetUp() { // Single-process mode is not set in BrowserMain, so process it explicitly, // and set up renderer. if (command_line->HasSwitch(switches::kSingleProcess)) { - RenderProcessHost::set_run_renderer_in_process(true); + content::RenderProcessHost::set_run_renderer_in_process(true); single_process_renderer_client_.reset( new content::MockContentRendererClient); content::GetContentClient()->set_renderer( diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 5097b05..aa35f0f 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -41,12 +41,12 @@ #include "chrome/test/test_navigation_observer.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_manager.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -505,11 +505,11 @@ AppModalDialog* WaitForAppModalDialog() { } void CrashTab(TabContents* tab) { - RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = tab->render_view_host()->process(); base::KillProcess(rph->GetHandle(), 0, false); TestNotificationObserver observer; RegisterAndWait(&observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::Source<RenderProcessHost>(rph)); + content::Source<content::RenderProcessHost>(rph)); } void WaitForFocusChange(TabContents* tab_contents) { diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index bce7023..81d6c0b 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -48,8 +48,8 @@ #include "chrome_frame/test/win_event_receiver.h" #include "chrome_frame/utils.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/notification_service_impl.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/content_client.h" #include "content/public/common/content_paths.h" #include "testing/gtest/include/gtest/gtest.h" @@ -268,7 +268,7 @@ void FakeExternalTab::Initialize() { DCHECK(g_browser_process); g_browser_process->SetApplicationLocale("en-US"); - RenderProcessHost::set_run_renderer_in_process(true); + content::RenderProcessHost::set_run_renderer_in_process(true); browser_process_->local_state()->RegisterBooleanPref( prefs::kMetricsReportingEnabled, false); diff --git a/content/browser/cert_store.cc b/content/browser/cert_store.cc index b6501c4..594f0bc 100644 --- a/content/browser/cert_store.cc +++ b/content/browser/cert_store.cc @@ -8,7 +8,7 @@ #include <functional> #include "base/stl_util.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" @@ -154,7 +154,8 @@ void CertStore::Observe(int type, const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED || type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED); - RenderProcessHost* rph = content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* rph = + content::Source<content::RenderProcessHost>(source).ptr(); DCHECK(rph); - RemoveCertsForRenderProcesHost(rph->id()); + RemoveCertsForRenderProcesHost(rph->GetID()); } diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc index a70d1c6..1a85e0b 100644 --- a/content/browser/child_process_security_policy_browsertest.cc +++ b/content/browser/child_process_security_policy_browsertest.cc @@ -11,8 +11,8 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc index 99dc4d0..53467b2 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.cc +++ b/content/browser/debugger/render_view_devtools_agent_host.cc @@ -8,7 +8,7 @@ #include "base/lazy_instance.h" #include "content/browser/debugger/devtools_manager.h" #include "content/browser/debugger/render_view_devtools_agent_host.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" @@ -64,12 +64,13 @@ void RenderViewDevToolsAgentHost::NotifyClientClosing() { content::NotificationService::current()->Notify( content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, content::Source<content::BrowserContext>( - render_view_host_->site_instance()->GetProcess()->browser_context()), + render_view_host_->site_instance()->GetProcess()-> + GetBrowserContext()), content::Details<RenderViewHost>(render_view_host_)); } int RenderViewDevToolsAgentHost::GetRenderProcessId() { - return render_view_host_->process()->id(); + return render_view_host_->process()->GetID(); } RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 62dd7e8..f1a7309 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -25,7 +25,6 @@ #include "content/browser/download/download_stats.h" #include "content/browser/download/download_status_updater.h" #include "content/browser/download/interrupt_reasons.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" @@ -34,6 +33,7 @@ #include "content/public/browser/download_manager_delegate.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -730,7 +730,7 @@ void DownloadManagerImpl::DownloadUrlToFile(const GURL& url, BrowserThread::IO, FROM_HERE, base::Bind(&BeginDownload, URLParams(url, referrer), save_info, resource_dispatcher_host, - RenderParams(tab_contents->GetRenderProcessHost()->id(), + RenderParams(tab_contents->GetRenderProcessHost()->GetID(), tab_contents->render_view_host()->routing_id()), &tab_contents->browser_context()->GetResourceContext())); } diff --git a/content/browser/download/download_request_handle.cc b/content/browser/download/download_request_handle.cc index 638006e..4f6b967 100644 --- a/content/browser/download/download_request_handle.cc +++ b/content/browser/download/download_request_handle.cc @@ -67,10 +67,10 @@ DownloadManager* DownloadRequestHandle::GetDownloadManager() const { RenderViewHost* rvh = RenderViewHost::FromID(child_id_, render_view_id_); if (rvh == NULL) return NULL; - RenderProcessHost* rph = rvh->process(); + content::RenderProcessHost* rph = rvh->process(); if (rph == NULL) return NULL; - content::BrowserContext* context = rph->browser_context(); + content::BrowserContext* context = rph->GetBrowserContext(); if (context == NULL) return NULL; return context->GetDownloadManager(); diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc index 4dc70b2..7a63009 100644 --- a/content/browser/download/mhtml_generation_manager.cc +++ b/content/browser/download/mhtml_generation_manager.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/platform_file.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" @@ -36,7 +36,7 @@ void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents, int job_id = id_counter++; Job job; job.file_path = file; - job.process_id = tab_contents->GetRenderProcessHost()->id(); + job.process_id = tab_contents->GetRenderProcessHost()->GetID(); job.routing_id = tab_contents->render_view_host()->routing_id(); id_to_job_[job_id] = job; diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index bc96e89..9abb497 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -25,7 +25,7 @@ #include "content/browser/download/save_file.h" #include "content/browser/download/save_file_manager.h" #include "content/browser/download/save_item.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -129,7 +129,7 @@ SavePackage::SavePackage(TabContents* tab_contents, save_type_(save_type), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(tab_contents->GetRenderProcessHost()->id()), + tab_id_(tab_contents->GetRenderProcessHost()->GetID()), unique_id_(g_save_package_id++), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { DCHECK(page_url_.is_valid()); @@ -155,7 +155,7 @@ SavePackage::SavePackage(TabContents* tab_contents) save_type_(SAVE_TYPE_UNKNOWN), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(tab_contents->GetRenderProcessHost()->id()), + tab_id_(tab_contents->GetRenderProcessHost()->GetID()), unique_id_(g_save_package_id++), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { DCHECK(page_url_.is_valid()); @@ -653,7 +653,7 @@ void SavePackage::CheckFinish() { file_manager_, final_names, dir, - tab_contents()->GetRenderProcessHost()->id(), + tab_contents()->GetRenderProcessHost()->GetID(), tab_contents()->render_view_host()->routing_id(), id())); } @@ -801,7 +801,7 @@ void SavePackage::SaveNextFile(bool process_all_remaining_items) { save_item->Start(); file_manager_->SaveURL(save_item->url(), save_item->referrer(), - tab_contents()->GetRenderProcessHost()->id(), + tab_contents()->GetRenderProcessHost()->GetID(), routing_id(), save_item->save_source(), save_item->full_path(), diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc index 8458b3a..af23aea 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.cc +++ b/content/browser/geolocation/geolocation_dispatcher_host.cc @@ -11,7 +11,7 @@ #include "content/browser/geolocation/geolocation_permission_context.h" #include "content/browser/geolocation/geolocation_provider.h" #include "content/browser/renderer_host/render_message_filter.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/common/geolocation_messages.h" #include "content/common/geoposition.h" diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index de484b3..e734f79 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -12,7 +12,7 @@ #include "base/process_util.h" #include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/gpu/gpu_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/gpu/gpu_messages.h" diff --git a/content/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc index cec946a..b827433 100644 --- a/content/browser/host_zoom_map.cc +++ b/content/browser/host_zoom_map.cc @@ -9,7 +9,7 @@ #include "base/string_piece.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" @@ -128,7 +128,7 @@ void HostZoomMap::Observe( int render_view_id = content::Source<RenderViewHost>(source)->routing_id(); int render_process_id = - content::Source<RenderViewHost>(source)->process()->id(); + content::Source<RenderViewHost>(source)->process()->GetID(); for (size_t i = 0; i < temporary_zoom_levels_.size(); ++i) { if (temporary_zoom_levels_[i].render_process_id == render_process_id && diff --git a/content/browser/mach_broker_mac.cc b/content/browser/mach_broker_mac.cc index b604f48..09f3e75 100644 --- a/content/browser/mach_broker_mac.cc +++ b/content/browser/mach_broker_mac.cc @@ -12,7 +12,7 @@ #include "base/stringprintf.h" #include "base/sys_string_conversions.h" #include "base/threading/platform_thread.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/child_process_info.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" @@ -211,11 +211,12 @@ void MachBroker::Observe(int type, switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: handle = - content::Details<RenderProcessHost::RendererClosedDetails>(details)-> - handle; + content::Details<content::RenderProcessHost::RendererClosedDetails>( + details)->handle; break; case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: - handle = content::Source<RenderProcessHost>(source)->GetHandle(); + handle = content::Source<content::RenderProcessHost>(source)-> + GetHandle(); break; case content::NOTIFICATION_CHILD_PROCESS_CRASHED: case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index 8af17b3..79c8404 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -42,8 +42,8 @@ void MockContentBrowserClient::RenderViewHostCreated( RenderViewHost* render_view_host) { } -void MockContentBrowserClient::BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) { +void MockContentBrowserClient::RenderProcessHostCreated( + RenderProcessHost* host) { } void MockContentBrowserClient::PluginProcessHostCreated( diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index cdc8406..2fcd957 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -30,8 +30,8 @@ class MockContentBrowserClient : public ContentBrowserClient { TabContents* tab_contents) OVERRIDE; virtual void RenderViewHostCreated( RenderViewHost* render_view_host) OVERRIDE; - virtual void BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) OVERRIDE; + virtual void RenderProcessHostCreated( + RenderProcessHost* host) OVERRIDE; virtual void PluginProcessHostCreated(PluginProcessHost* host) OVERRIDE; virtual WebUIFactory* GetWebUIFactory() OVERRIDE; virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, diff --git a/content/browser/net/browser_online_state_observer.cc b/content/browser/net/browser_online_state_observer.cc index 2b0ccd8..348f8ba 100644 --- a/content/browser/net/browser_online_state_observer.cc +++ b/content/browser/net/browser_online_state_observer.cc @@ -4,8 +4,8 @@ #include "content/browser/net/browser_online_state_observer.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/common/view_messages.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "net/base/network_change_notifier.h" BrowserOnlineStateObserver::BrowserOnlineStateObserver() { @@ -17,7 +17,8 @@ BrowserOnlineStateObserver::~BrowserOnlineStateObserver() { } void BrowserOnlineStateObserver::OnOnlineStateChanged(bool online) { - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); !it.IsAtEnd(); it.Advance()) { it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged(online)); } diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc index b4b47f5..1655987 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service.cc @@ -19,7 +19,7 @@ #include "content/browser/plugin_loader_posix.h" #include "content/browser/plugin_service_filter.h" #include "content/browser/ppapi_plugin_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/resource_context.h" #include "content/browser/utility_process_host.h" @@ -573,10 +573,11 @@ void PluginService::Observe(int type, void PluginService::PurgePluginListCache( content::BrowserContext* browser_context, bool reload_pages) { - for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + for (content::RenderProcessHost::iterator it = + content::RenderProcessHost::AllHostsIterator(); !it.IsAtEnd(); it.Advance()) { - RenderProcessHost* host = it.GetCurrentValue(); - if (!browser_context || host->browser_context() == browser_context) + content::RenderProcessHost* host = it.GetCurrentValue(); + if (!browser_context || host->GetBrowserContext() == browser_context) host->Send(new ViewMsg_PurgePluginListCache(reload_pages)); } } diff --git a/content/browser/renderer_host/backing_store.h b/content/browser/renderer_host/backing_store.h index ef4dd8e..d17a7b9 100644 --- a/content/browser/renderer_host/backing_store.h +++ b/content/browser/renderer_host/backing_store.h @@ -21,6 +21,10 @@ namespace gfx { class Rect; } +namespace content { +class RenderProcessHost; +} + namespace skia { class PlatformCanvas; } @@ -47,7 +51,7 @@ class CONTENT_EXPORT BackingStore { // the time it returns, in which case it will set |scheduled_callback| to // true and will call |callback| when completed. virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_gtk.cc b/content/browser/renderer_host/backing_store_gtk.cc index efae772..06d2e66 100644 --- a/content/browser/renderer_host/backing_store_gtk.cc +++ b/content/browser/renderer_host/backing_store_gtk.cc @@ -25,7 +25,7 @@ #include "base/memory/singleton.h" #include "base/metrics/histogram.h" #include "base/time.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/x/x11_util.h" @@ -328,7 +328,7 @@ void BackingStoreGtk::PaintRectWithoutXrender( } void BackingStoreGtk::PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_gtk.h b/content/browser/renderer_host/backing_store_gtk.h index b69862e..cede176 100644 --- a/content/browser/renderer_host/backing_store_gtk.h +++ b/content/browser/renderer_host/backing_store_gtk.h @@ -19,6 +19,7 @@ class Point; class Rect; } // namespace gfx + typedef struct _GdkDrawable GdkDrawable; class CONTENT_EXPORT BackingStoreGtk : public BackingStore { @@ -58,7 +59,7 @@ class CONTENT_EXPORT BackingStoreGtk : public BackingStore { // BackingStore implementation. virtual size_t MemorySize() OVERRIDE; virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_mac.h b/content/browser/renderer_host/backing_store_mac.h index ed6801d..06031c2 100644 --- a/content/browser/renderer_host/backing_store_mac.h +++ b/content/browser/renderer_host/backing_store_mac.h @@ -25,7 +25,7 @@ class BackingStoreMac : public BackingStore { // BackingStore implementation. virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_mac.mm b/content/browser/renderer_host/backing_store_mac.mm index df5ee9e..b9972a7 100644 --- a/content/browser/renderer_host/backing_store_mac.mm +++ b/content/browser/renderer_host/backing_store_mac.mm @@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "skia/ext/platform_canvas.h" @@ -39,7 +39,7 @@ BackingStoreMac::~BackingStoreMac() { } void BackingStoreMac::PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_skia.cc b/content/browser/renderer_host/backing_store_skia.cc index ff2cc41..300e4fe 100644 --- a/content/browser/renderer_host/backing_store_skia.cc +++ b/content/browser/renderer_host/backing_store_skia.cc @@ -4,7 +4,7 @@ #include "content/browser/renderer_host/backing_store_skia.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/canvas.h" @@ -42,7 +42,7 @@ size_t BackingStoreSkia::MemorySize() { } void BackingStoreSkia::PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_skia.h b/content/browser/renderer_host/backing_store_skia.h index da3a81d..b713a84 100644 --- a/content/browser/renderer_host/backing_store_skia.h +++ b/content/browser/renderer_host/backing_store_skia.h @@ -18,6 +18,10 @@ class Point; class Canvas; } +namespace content { +class RenderProcessHost; +} + // A backing store that uses skia. This is a temporary backing store used by // RenderWidgetHostViewViews. In time, only GPU rendering will be used for // RWHVV, and then this backing store will be removed. @@ -35,7 +39,7 @@ class BackingStoreSkia : public BackingStore { // BackingStore implementation. virtual size_t MemorySize() OVERRIDE; virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_win.cc b/content/browser/renderer_host/backing_store_win.cc index df99136..632a32d 100644 --- a/content/browser/renderer_host/backing_store_win.cc +++ b/content/browser/renderer_host/backing_store_win.cc @@ -5,7 +5,7 @@ #include "content/browser/renderer_host/backing_store_win.h" #include "base/command_line.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/public/common/content_switches.h" #include "skia/ext/platform_canvas.h" @@ -114,7 +114,7 @@ size_t BackingStoreWin::MemorySize() { } void BackingStoreWin::PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/backing_store_win.h b/content/browser/renderer_host/backing_store_win.h index 6690cc2..bf0e408 100644 --- a/content/browser/renderer_host/backing_store_win.h +++ b/content/browser/renderer_host/backing_store_win.h @@ -24,7 +24,7 @@ class BackingStoreWin : public BackingStore { // BackingStore implementation. virtual size_t MemorySize() OVERRIDE; virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/mock_render_process_host.cc b/content/browser/renderer_host/mock_render_process_host.cc index 685789d..c6a680d 100644 --- a/content/browser/renderer_host/mock_render_process_host.cc +++ b/content/browser/renderer_host/mock_render_process_host.cc @@ -4,24 +4,46 @@ #include "content/browser/renderer_host/mock_render_process_host.h" +#include "base/lazy_instance.h" +#include "base/message_loop.h" +#include "base/time.h" #include "content/browser/child_process_security_policy.h" +#include "content/common/child_process_info.h" +#include "content/public/browser/notification_service.h" +#include "content/public/browser/notification_types.h" + +// This map is the global list of all renderer processes and is defined in +// render_process_host_impl.cc +// TODO(ananta) +// Clean up this dependency in a subsequent CL. +extern base::LazyInstance< + IDMap<content::RenderProcessHost>, + base::LeakyLazyInstanceTraits<IDMap<content::RenderProcessHost> > > + g_all_hosts; MockRenderProcessHost::MockRenderProcessHost( content::BrowserContext* browser_context) - : RenderProcessHost(browser_context), - transport_dib_(NULL), + : transport_dib_(NULL), bad_msg_count_(0), - factory_(NULL) { + factory_(NULL), + id_(ChildProcessInfo::GenerateChildProcessUniqueId()), + browser_context_(browser_context), + max_page_id_(-1), + fast_shutdown_started_(false) { // Child process security operations can't be unit tested unless we add // ourselves as an existing child process. - ChildProcessSecurityPolicy::GetInstance()->Add(id()); + ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); + g_all_hosts.Get().AddWithID(this, GetID()); } MockRenderProcessHost::~MockRenderProcessHost() { - ChildProcessSecurityPolicy::GetInstance()->Remove(id()); + ChildProcessSecurityPolicy::GetInstance()->Remove(GetID()); delete transport_dib_; if (factory_) factory_->Remove(this); + // In unit tests, Release() might not have been called. + if (g_all_hosts.Get().Lookup(GetID())) + g_all_hosts.Get().Remove(GetID()); } void MockRenderProcessHost::EnableSendQueue() { @@ -70,7 +92,6 @@ int MockRenderProcessHost::VisibleWidgetCount() const { void MockRenderProcessHost::AddWord(const string16& word) { } - bool MockRenderProcessHost::FastShutdownIfPossible() { // We aren't actually going to do anything, but set |fast_shutdown_started_| // to true so that tests know we've been called. @@ -78,6 +99,10 @@ bool MockRenderProcessHost::FastShutdownIfPossible() { return true; } +bool MockRenderProcessHost::FastShutdownStarted() const { + return fast_shutdown_started_; +} + void MockRenderProcessHost::DumpHandles() { } @@ -116,6 +141,92 @@ void MockRenderProcessHost::SetCompositingSurface( gfx::PluginWindowHandle compositing_surface) { } +int MockRenderProcessHost::GetID() const { + return id_; +} + +bool MockRenderProcessHost::HasConnection() const { + return true; +} + +void MockRenderProcessHost::SetIgnoreInputEvents(bool ignore_input_events) { +} + +bool MockRenderProcessHost::IgnoreInputEvents() const { + return false; +} + +void MockRenderProcessHost::Attach(IPC::Channel::Listener* listener, + int routing_id) { + listeners_.AddWithID(listener, routing_id); +} + +void MockRenderProcessHost::Release(int listener_id) { + listeners_.Remove(listener_id); + Cleanup(); +} + +void MockRenderProcessHost::Cleanup() { + if (listeners_.IsEmpty()) { + content::NotificationService::current()->Notify( + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, + content::Source<RenderProcessHost>(this), + content::NotificationService::NoDetails()); + MessageLoop::current()->DeleteSoon(FROM_HERE, this); + g_all_hosts.Get().Remove(GetID()); + } +} + +void MockRenderProcessHost::ReportExpectingClose(int32 listener_id) { +} + +void MockRenderProcessHost::AddPendingView() { +} + +void MockRenderProcessHost::RemovePendingView() { +} + +void MockRenderProcessHost::SetSuddenTerminationAllowed(bool allowed) { +} + +bool MockRenderProcessHost::SuddenTerminationAllowed() const { + return true; +} + +IPC::Channel::Listener* MockRenderProcessHost::GetListenerByID( + int routing_id) { + return listeners_.Lookup(routing_id); +} + +void MockRenderProcessHost::UpdateMaxPageID(int32 page_id) { + if (page_id > max_page_id_) + max_page_id_ = page_id; +} + +content::BrowserContext* MockRenderProcessHost::GetBrowserContext() const { + return browser_context_; +} + +IPC::ChannelProxy* MockRenderProcessHost::GetChannel() { + return NULL; +} + +bool MockRenderProcessHost::FastShutdownForPageCount(size_t count) { + if (listeners_.size() == count) + return FastShutdownIfPossible(); + return false; +} + +base::TimeDelta MockRenderProcessHost::GetChildProcessIdleTime() const { + return base::TimeDelta::FromMilliseconds(0); +} + +content::RenderProcessHost::listeners_iterator + MockRenderProcessHost::ListenersIterator() { + IDMap<IPC::Channel::Listener> listeners; + return listeners_iterator(&listeners); +} + bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { return false; } @@ -134,8 +245,9 @@ MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { } } -RenderProcessHost* MockRenderProcessHostFactory::CreateRenderProcessHost( - content::BrowserContext* browser_context) const { +content::RenderProcessHost* + MockRenderProcessHostFactory::CreateRenderProcessHost( + content::BrowserContext* browser_context) const { MockRenderProcessHost* host = new MockRenderProcessHost(browser_context); if (host) { processes_.push_back(host); diff --git a/content/browser/renderer_host/mock_render_process_host.h b/content/browser/renderer_host/mock_render_process_host.h index 77aa067..9e8c49e 100644 --- a/content/browser/renderer_host/mock_render_process_host.h +++ b/content/browser/renderer_host/mock_render_process_host.h @@ -8,7 +8,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_vector.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_process_host_factory.h" #include "ipc/ipc_test_sink.h" class MockRenderProcessHostFactory; @@ -16,7 +17,7 @@ class TransportDIB; // A mock render process host that has no corresponding renderer process. All // IPC messages are sent into the message sink for inspection by tests. -class MockRenderProcessHost : public RenderProcessHost { +class MockRenderProcessHost : public content::RenderProcessHost { public: explicit MockRenderProcessHost(content::BrowserContext* browser_context); virtual ~MockRenderProcessHost(); @@ -47,13 +48,34 @@ class MockRenderProcessHost : public RenderProcessHost { virtual void WidgetHidden() OVERRIDE; virtual int VisibleWidgetCount() const OVERRIDE; virtual void AddWord(const string16& word); - virtual bool FastShutdownIfPossible() OVERRIDE; - virtual void DumpHandles() OVERRIDE; - virtual base::ProcessHandle GetHandle() OVERRIDE; - virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) OVERRIDE; + virtual bool FastShutdownIfPossible(); + virtual bool FastShutdownStarted() const; + virtual void DumpHandles(); + virtual base::ProcessHandle GetHandle(); + virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); virtual void SetCompositingSurface( int render_widget_id, gfx::PluginWindowHandle compositing_surface) OVERRIDE; + virtual int GetID() const OVERRIDE; + virtual bool HasConnection() const OVERRIDE; + virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; + virtual bool IgnoreInputEvents() const OVERRIDE; + virtual void Attach(IPC::Channel::Listener* listener, + int routing_id) OVERRIDE; + virtual void Release(int listener_id) OVERRIDE; + virtual void Cleanup() OVERRIDE; + virtual void ReportExpectingClose(int32 listener_id) OVERRIDE; + virtual void AddPendingView() OVERRIDE; + virtual void RemovePendingView() OVERRIDE; + virtual void SetSuddenTerminationAllowed(bool allowed) OVERRIDE; + virtual bool SuddenTerminationAllowed() const OVERRIDE; + virtual void UpdateMaxPageID(int32 page_id) OVERRIDE; + virtual IPC::Channel::Listener* GetListenerByID(int routing_id) OVERRIDE; + virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; + virtual IPC::ChannelProxy* GetChannel() OVERRIDE; + virtual listeners_iterator ListenersIterator() OVERRIDE; + virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; + virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; // IPC::Channel::Sender via RenderProcessHost. virtual bool Send(IPC::Message* msg) OVERRIDE; @@ -74,16 +96,22 @@ class MockRenderProcessHost : public RenderProcessHost { TransportDIB* transport_dib_; int bad_msg_count_; const MockRenderProcessHostFactory* factory_; + int id_; + content::BrowserContext* browser_context_; + int32 max_page_id_; + + IDMap<IPC::Channel::Listener> listeners_; + bool fast_shutdown_started_; DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); }; -class MockRenderProcessHostFactory : public RenderProcessHostFactory { +class MockRenderProcessHostFactory : public content::RenderProcessHostFactory { public: MockRenderProcessHostFactory(); virtual ~MockRenderProcessHostFactory(); - virtual RenderProcessHost* CreateRenderProcessHost( + virtual content::RenderProcessHost* CreateRenderProcessHost( content::BrowserContext* browser_context) const OVERRIDE; // Removes the given MockRenderProcessHost from the MockRenderProcessHost list diff --git a/content/browser/renderer_host/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper_file_message_filter.cc index 5c84a8c..9e437e5 100644 --- a/content/browser/renderer_host/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper_file_message_filter.cc @@ -11,7 +11,7 @@ #include "base/process_util.h" #include "content/browser/browser_context.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/pepper_file_messages.h" #include "content/public/browser/browser_thread.h" #include "ipc/ipc_platform_file.h" diff --git a/content/browser/renderer_host/pepper_message_filter.cc b/content/browser/renderer_host/pepper_message_filter.cc index d916511..4aa1c47 100644 --- a/content/browser/renderer_host/pepper_message_filter.cc +++ b/content/browser/renderer_host/pepper_message_filter.cc @@ -21,8 +21,8 @@ #include "base/threading/worker_pool.h" #include "base/values.h" #include "content/browser/font_list_async.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/resource_context.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/pepper_messages.h" #include "content/public/browser/browser_thread.h" #include "net/base/address_list.h" diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 41ee2cf..3c08ac0 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -22,8 +22,8 @@ #include "content/browser/plugin_service.h" #include "content/browser/plugin_service_filter.h" #include "content/browser/ppapi_plugin_process_host.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/media/media_observer.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_widget_helper.h" #include "content/browser/resource_context.h" diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc deleted file mode 100644 index c405961..0000000 --- a/content/browser/renderer_host/render_process_host.cc +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/renderer_host/render_process_host.h" - -#include "base/command_line.h" -#include "base/lazy_instance.h" -#include "base/rand_util.h" -#include "base/sys_info.h" -#include "content/browser/browser_main.h" -#include "content/browser/child_process_security_policy.h" -#include "content/browser/webui/web_ui_factory.h" -#include "content/common/child_process_info.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" -#include "content/public/common/content_constants.h" -#include "content/public/common/content_switches.h" - -using content::BrowserThread; - -namespace { - -size_t max_renderer_count_override = 0; - -size_t GetMaxRendererProcessCount() { - if (max_renderer_count_override) - return max_renderer_count_override; - - // Defines the maximum number of renderer processes according to the - // amount of installed memory as reported by the OS. The table - // values are calculated by assuming that you want the renderers to - // use half of the installed ram and assuming that each tab uses - // ~40MB, however the curve is not linear but piecewise linear with - // interleaved slopes of 3 and 2. - // If you modify this table you need to adjust browser\browser_uitest.cc - // to match the expected number of processes. - - static const size_t kMaxRenderersByRamTier[] = { - 3, // less than 256MB - 6, // 256MB - 9, // 512MB - 12, // 768MB - 14, // 1024MB - 18, // 1280MB - 20, // 1536MB - 22, // 1792MB - 24, // 2048MB - 26, // 2304MB - 29, // 2560MB - 32, // 2816MB - 35, // 3072MB - 38, // 3328MB - 40 // 3584MB - }; - - static size_t max_count = 0; - if (!max_count) { - size_t memory_tier = base::SysInfo::AmountOfPhysicalMemoryMB() / 256; - if (memory_tier >= arraysize(kMaxRenderersByRamTier)) - max_count = content::kMaxRendererProcessCount; - else - max_count = kMaxRenderersByRamTier[memory_tier]; - } - return max_count; -} - -// Returns true if the given host is suitable for launching a new view -// associated with the given browser context. -static bool IsSuitableHost(RenderProcessHost* host, - content::BrowserContext* browser_context, - const GURL& site_url) { - if (host->browser_context() != browser_context) - return false; - - if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(host->id()) != - content::WebUIFactory::Get()->HasWebUIScheme(site_url)) - return false; - - return content::GetContentClient()->browser()->IsSuitableHost(host, site_url); -} - -// the global list of all renderer processes -base::LazyInstance<IDMap<RenderProcessHost>, - base::LeakyLazyInstanceTraits<IDMap<RenderProcessHost> > > - g_all_hosts = LAZY_INSTANCE_INITIALIZER; - -} // namespace - -// static -bool RenderProcessHost::run_renderer_in_process_ = false; - -// static -void RenderProcessHost::SetMaxRendererProcessCountForTest(size_t count) { - max_renderer_count_override = count; -} - -RenderProcessHost::RenderProcessHost(content::BrowserContext* browser_context) - : max_page_id_(-1), - fast_shutdown_started_(false), - deleting_soon_(false), - pending_views_(0), - id_(ChildProcessInfo::GenerateChildProcessUniqueId()), - browser_context_(browser_context), - sudden_termination_allowed_(true), - ignore_input_events_(false) { - CHECK(!content::ExitedMainMessageLoop()); - g_all_hosts.Get().AddWithID(this, id()); - g_all_hosts.Get().set_check_on_null_data(true); - // Initialize |child_process_activity_time_| to a reasonable value. - mark_child_process_activity_time(); -} - -RenderProcessHost::~RenderProcessHost() { - // In unit tests, Release() might not have been called. - if (g_all_hosts.Get().Lookup(id())) - g_all_hosts.Get().Remove(id()); -} - -bool RenderProcessHost::HasConnection() const { - return channel_.get() != NULL; -} - -void RenderProcessHost::Attach(IPC::Channel::Listener* listener, - int routing_id) { - listeners_.AddWithID(listener, routing_id); -} - -void RenderProcessHost::Release(int listener_id) { - DCHECK(listeners_.Lookup(listener_id) != NULL); - listeners_.Remove(listener_id); - - // Make sure that all associated resource requests are stopped. - CancelResourceRequests(listener_id); - -#if defined(OS_WIN) - // Dump the handle table if handle auditing is enabled. - const CommandLine& browser_command_line = - *CommandLine::ForCurrentProcess(); - if (browser_command_line.HasSwitch(switches::kAuditHandles) || - browser_command_line.HasSwitch(switches::kAuditAllHandles)) { - DumpHandles(); - - // We wait to close the channels until the child process has finished - // dumping handles and sends us ChildProcessHostMsg_DumpHandlesDone. - return; - } -#endif - Cleanup(); -} - -void RenderProcessHost::Cleanup() { - // When no other owners of this object, we can delete ourselves - if (listeners_.IsEmpty()) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::Source<RenderProcessHost>(this), - content::NotificationService::NoDetails()); - MessageLoop::current()->DeleteSoon(FROM_HERE, this); - deleting_soon_ = true; - // It's important not to wait for the DeleteTask to delete the channel - // proxy. Kill it off now. That way, in case the profile is going away, the - // rest of the objects attached to this RenderProcessHost start going - // away first, since deleting the channel proxy will post a - // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. - channel_.reset(); - - // Remove ourself from the list of renderer processes so that we can't be - // reused in between now and when the Delete task runs. - g_all_hosts.Get().Remove(id()); - } -} - -void RenderProcessHost::ReportExpectingClose(int32 listener_id) { - listeners_expecting_close_.insert(listener_id); -} - -void RenderProcessHost::AddPendingView() { - pending_views_++; -} - -void RenderProcessHost::RemovePendingView() { - DCHECK(pending_views_); - pending_views_--; -} - -void RenderProcessHost::UpdateMaxPageID(int32 page_id) { - if (page_id > max_page_id_) - max_page_id_ = page_id; -} - -bool RenderProcessHost::FastShutdownForPageCount(size_t count) { - if (listeners_.size() == count) - return FastShutdownIfPossible(); - return false; -} - -// static -RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return iterator(g_all_hosts.Pointer()); -} - -// static -RenderProcessHost* RenderProcessHost::FromID(int render_process_id) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return g_all_hosts.Get().Lookup(render_process_id); -} - -// static -bool RenderProcessHost::ShouldTryToUseExistingProcessHost() { - size_t renderer_process_count = g_all_hosts.Get().size(); - - // NOTE: Sometimes it's necessary to create more render processes than - // GetMaxRendererProcessCount(), for instance when we want to create - // a renderer process for a browser context that has no existing - // renderers. This is OK in moderation, since the - // GetMaxRendererProcessCount() is conservative. - - return run_renderer_in_process() || - (renderer_process_count >= GetMaxRendererProcessCount()); -} - -// static -RenderProcessHost* RenderProcessHost::GetExistingProcessHost( - content::BrowserContext* browser_context, - const GURL& site_url) { - // First figure out which existing renderers we can use. - std::vector<RenderProcessHost*> suitable_renderers; - suitable_renderers.reserve(g_all_hosts.Get().size()); - - iterator iter(AllHostsIterator()); - while (!iter.IsAtEnd()) { - if (run_renderer_in_process() || - IsSuitableHost(iter.GetCurrentValue(), browser_context, site_url)) - suitable_renderers.push_back(iter.GetCurrentValue()); - - iter.Advance(); - } - - // Now pick a random suitable renderer, if we have any. - if (!suitable_renderers.empty()) { - int suitable_count = static_cast<int>(suitable_renderers.size()); - int random_index = base::RandInt(0, suitable_count - 1); - return suitable_renderers[random_index]; - } - - return NULL; -} diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc index e15f7309..3d25b02 100644 --- a/content/browser/renderer_host/render_process_host_browsertest.cc +++ b/content/browser/renderer_host/render_process_host_browsertest.cc @@ -7,7 +7,7 @@ #include "base/command_line.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/test_url_constants.h" #include "content/public/common/content_switches.h" @@ -17,7 +17,8 @@ RenderProcessHostTest::RenderProcessHostTest() { } int RenderProcessHostTest::RenderProcessHostCount() { - RenderProcessHost::iterator hosts = RenderProcessHost::AllHostsIterator(); + content::RenderProcessHost::iterator hosts = + content::RenderProcessHost::AllHostsIterator(); int count = 0; while (!hosts.IsAtEnd()) { if (hosts.GetCurrentValue()->HasConnection()) @@ -29,7 +30,7 @@ int RenderProcessHostTest::RenderProcessHostCount() { IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { // Set max renderers to 1 to force running out of processes. - RenderProcessHost::SetMaxRendererProcessCountForTest(1); + content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); parsed_command_line.AppendSwitch(switches::kProcessPerTab); @@ -89,15 +90,15 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { // in a process of that type, even if that means creating a new process. IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { // Set max renderers to 1 to force running out of processes. - RenderProcessHost::SetMaxRendererProcessCountForTest(1); + content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); int tab_count = 1; int host_count = 1; TabContents* tab1 = NULL; TabContents* tab2 = NULL; - RenderProcessHost* rph1 = NULL; - RenderProcessHost* rph2 = NULL; - RenderProcessHost* rph3 = NULL; + content::RenderProcessHost* rph1 = NULL; + content::RenderProcessHost* rph2 = NULL; + content::RenderProcessHost* rph3 = NULL; #if defined(TOUCH_UI) ++host_count; // For the touch keyboard. diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/render_process_host_impl.cc index 3cb6b5c..cd5f9b4b 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -5,7 +5,7 @@ // Represents the browser side of the browser <--> renderer communication // channel. There will be one RenderProcessHost per renderer process. -#include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include <algorithm> #include <limits> @@ -20,18 +20,22 @@ #include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/platform_file.h" +#include "base/rand_util.h" #include "base/stl_util.h" #include "base/string_util.h" +#include "base/sys_info.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "content/browser/appcache/appcache_dispatcher_host.h" #include "content/browser/browser_child_process_host.h" #include "content/browser/browser_context.h" +#include "content/browser/browser_main.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/device_orientation/message_filter.h" #include "content/browser/download/mhtml_generation_manager.h" @@ -68,6 +72,7 @@ #include "content/browser/speech/speech_input_dispatcher_host.h" #include "content/browser/trace_message_filter.h" #include "content/browser/user_metrics.h" +#include "content/browser/webui/web_ui_factory.h" #include "content/browser/worker_host/worker_message_filter.h" #include "content/common/child_process_info.h" #include "content/common/child_process_messages.h" @@ -77,6 +82,7 @@ #include "content/common/resource_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" #include "content/renderer/render_process_impl.h" @@ -183,21 +189,103 @@ class RendererURLRequestContextSelector scoped_refptr<net::URLRequestContextGetter> media_request_context_; }; +size_t max_renderer_count_override = 0; + +size_t GetMaxRendererProcessCount() { + if (max_renderer_count_override) + return max_renderer_count_override; + + // Defines the maximum number of renderer processes according to the + // amount of installed memory as reported by the OS. The table + // values are calculated by assuming that you want the renderers to + // use half of the installed ram and assuming that each tab uses + // ~40MB, however the curve is not linear but piecewise linear with + // interleaved slopes of 3 and 2. + // If you modify this table you need to adjust browser\browser_uitest.cc + // to match the expected number of processes. + + static const size_t kMaxRenderersByRamTier[] = { + 3, // less than 256MB + 6, // 256MB + 9, // 512MB + 12, // 768MB + 14, // 1024MB + 18, // 1280MB + 20, // 1536MB + 22, // 1792MB + 24, // 2048MB + 26, // 2304MB + 29, // 2560MB + 32, // 2816MB + 35, // 3072MB + 38, // 3328MB + 40 // 3584MB + }; + + static size_t max_count = 0; + if (!max_count) { + size_t memory_tier = base::SysInfo::AmountOfPhysicalMemoryMB() / 256; + if (memory_tier >= arraysize(kMaxRenderersByRamTier)) + max_count = content::kMaxRendererProcessCount; + else + max_count = kMaxRenderersByRamTier[memory_tier]; + } + return max_count; +} + +// Returns true if the given host is suitable for launching a new view +// associated with the given browser context. +static bool IsSuitableHost(content::RenderProcessHost* host, + content::BrowserContext* browser_context, + const GURL& site_url) { + if (host->GetBrowserContext() != browser_context) + return false; + + if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( + host->GetID()) != + content::WebUIFactory::Get()->HasWebUIScheme(site_url)) + return false; + + return content::GetContentClient()->browser()->IsSuitableHost(host, site_url); +} + } // namespace -BrowserRenderProcessHost::BrowserRenderProcessHost( +// the global list of all renderer processes +base::LazyInstance< + IDMap<content::RenderProcessHost>, + base::LeakyLazyInstanceTraits<IDMap<content::RenderProcessHost> > > + g_all_hosts = LAZY_INSTANCE_INITIALIZER; + +// static +bool g_run_renderer_in_process_ = false; + +// static +void content::RenderProcessHost::SetMaxRendererProcessCountForTest( + size_t count) { + max_renderer_count_override = count; +} + +RenderProcessHostImpl::RenderProcessHostImpl( content::BrowserContext* browser_context) - : RenderProcessHost(browser_context), + : max_page_id_(-1), + fast_shutdown_started_(false), + deleting_soon_(false), + pending_views_(0), visible_widgets_(0), backgrounded_(true), ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( FROM_HERE, base::TimeDelta::FromSeconds(5), - this, &BrowserRenderProcessHost::ClearTransportDIBCache)), + this, &RenderProcessHostImpl::ClearTransportDIBCache)), accessibility_enabled_(false), - is_initialized_(false) { + is_initialized_(false), + id_(ChildProcessInfo::GenerateChildProcessUniqueId()), + browser_context_(browser_context), + sudden_termination_allowed_(true), + ignore_input_events_(false) { widget_helper_ = new RenderWidgetHelper(); - ChildProcessSecurityPolicy::GetInstance()->Add(id()); + ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); // Grant most file permissions to this renderer. // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and @@ -205,7 +293,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost( // requests them. // This is for the filesystem sandbox. ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( - id(), browser_context->GetPath().Append( + GetID(), browser_context->GetPath().Append( fileapi::SandboxMountPointProvider::kNewFileSystemDirectory), base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_CREATE | @@ -222,26 +310,31 @@ BrowserRenderProcessHost::BrowserRenderProcessHost( // This is so that we can read and move stuff out of the old filesystem // sandbox. ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( - id(), browser_context->GetPath().Append( + GetID(), browser_context->GetPath().Append( fileapi::SandboxMountPointProvider::kOldFileSystemDirectory), base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); // This is so that we can rename the old sandbox out of the way so that we // know we've taken care of it. ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( - id(), browser_context->GetPath().Append( + GetID(), browser_context->GetPath().Append( fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE); - // Note: When we create the BrowserRenderProcessHost, it's technically + CHECK(!content::ExitedMainMessageLoop()); + g_all_hosts.Get().AddWithID(this, GetID()); + g_all_hosts.Get().set_check_on_null_data(true); + // Initialize |child_process_activity_time_| to a reasonable value. + mark_child_process_activity_time(); + // Note: When we create the RenderProcessHostImpl, it's technically // backgrounded, because it has no visible listeners. But the process // doesn't actually exist yet, so we'll Background it later, after // creation. } -BrowserRenderProcessHost::~BrowserRenderProcessHost() { - ChildProcessSecurityPolicy::GetInstance()->Remove(id()); +RenderProcessHostImpl::~RenderProcessHostImpl() { + ChildProcessSecurityPolicy::GetInstance()->Remove(GetID()); // We may have some unsent messages at this point, but that's OK. channel_.reset(); @@ -251,13 +344,15 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() { } ClearTransportDIBCache(); + if (g_all_hosts.Get().Lookup(GetID())) + g_all_hosts.Get().Remove(GetID()); } -void BrowserRenderProcessHost::EnableSendQueue() { +void RenderProcessHostImpl::EnableSendQueue() { is_initialized_ = false; } -bool BrowserRenderProcessHost::Init(bool is_accessibility_enabled) { +bool RenderProcessHostImpl::Init(bool is_accessibility_enabled) { // calling Init() more than once does nothing, this makes it more convenient // for the view host which may not be sure in some cases if (channel_.get()) @@ -295,7 +390,8 @@ bool BrowserRenderProcessHost::Init(bool is_accessibility_enabled) { BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); // Call the embedder first so that their IPC filters have priority. - content::GetContentClient()->browser()->BrowserRenderProcessHostCreated(this); + content::GetContentClient()->browser()->RenderProcessHostCreated( + this); CreateMessageFilters(); @@ -350,110 +446,115 @@ bool BrowserRenderProcessHost::Init(bool is_accessibility_enabled) { return true; } -void BrowserRenderProcessHost::CreateMessageFilters() { +void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr<RenderMessageFilter> render_message_filter( new RenderMessageFilter( - id(), + GetID(), PluginService::GetInstance(), - browser_context(), - browser_context()->GetRequestContextForRenderProcess(id()), + GetBrowserContext(), + GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), widget_helper_)); channel_->AddFilter(render_message_filter); ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( - id(), ChildProcessInfo::RENDER_PROCESS, - &browser_context()->GetResourceContext(), - new RendererURLRequestContextSelector(browser_context(), id()), + GetID(), ChildProcessInfo::RENDER_PROCESS, + &GetBrowserContext()->GetResourceContext(), + new RendererURLRequestContextSelector(GetBrowserContext(), GetID()), content::GetContentClient()->browser()->GetResourceDispatcherHost()); channel_->AddFilter(resource_message_filter); channel_->AddFilter(new AudioInputRendererHost( - &browser_context()->GetResourceContext())); + &GetBrowserContext()->GetResourceContext())); channel_->AddFilter( - new AudioRendererHost(&browser_context()->GetResourceContext())); + new AudioRendererHost(&GetBrowserContext()->GetResourceContext())); channel_->AddFilter( - new VideoCaptureHost(&browser_context()->GetResourceContext())); + new VideoCaptureHost(&GetBrowserContext()->GetResourceContext())); channel_->AddFilter( - new AppCacheDispatcherHost(browser_context()->GetAppCacheService(), - id())); + new AppCacheDispatcherHost(GetBrowserContext()->GetAppCacheService(), + GetID())); channel_->AddFilter(new ClipboardMessageFilter()); channel_->AddFilter( - new DOMStorageMessageFilter(id(), browser_context()->GetWebKitContext())); + new DOMStorageMessageFilter(GetID(), + GetBrowserContext()->GetWebKitContext())); channel_->AddFilter( - new IndexedDBDispatcherHost(id(), browser_context()->GetWebKitContext())); + new IndexedDBDispatcherHost(GetID(), + GetBrowserContext()->GetWebKitContext())); channel_->AddFilter( GeolocationDispatcherHost::New( - id(), browser_context()->GetGeolocationPermissionContext())); - channel_->AddFilter(new GpuMessageFilter(id(), widget_helper_.get())); + GetID(), GetBrowserContext()->GetGeolocationPermissionContext())); + channel_->AddFilter(new GpuMessageFilter(GetID(), widget_helper_.get())); channel_->AddFilter(new media_stream::MediaStreamDispatcherHost( - &browser_context()->GetResourceContext(), id())); - channel_->AddFilter(new PepperFileMessageFilter(id(), browser_context())); + &GetBrowserContext()->GetResourceContext(), GetID())); + channel_->AddFilter(new PepperFileMessageFilter(GetID(), + GetBrowserContext())); channel_->AddFilter( - new PepperMessageFilter(&browser_context()->GetResourceContext())); + new PepperMessageFilter(&GetBrowserContext()->GetResourceContext())); channel_->AddFilter(new speech_input::SpeechInputDispatcherHost( - id(), browser_context()->GetRequestContext(), - browser_context()->GetSpeechInputPreferences())); + GetID(), GetBrowserContext()->GetRequestContext(), + GetBrowserContext()->GetSpeechInputPreferences())); channel_->AddFilter( - new FileSystemDispatcherHost(browser_context()->GetRequestContext(), - browser_context()->GetFileSystemContext())); + new FileSystemDispatcherHost( + GetBrowserContext()->GetRequestContext(), + GetBrowserContext()->GetFileSystemContext())); channel_->AddFilter(new device_orientation::MessageFilter()); channel_->AddFilter( - new BlobMessageFilter(id(), browser_context()->GetBlobStorageContext())); - channel_->AddFilter(new FileUtilitiesMessageFilter(id())); + new BlobMessageFilter(GetID(), + GetBrowserContext()->GetBlobStorageContext())); + channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); channel_->AddFilter(new MimeRegistryMessageFilter()); channel_->AddFilter(new DatabaseMessageFilter( - browser_context()->GetDatabaseTracker())); + GetBrowserContext()->GetDatabaseTracker())); #if defined(OS_MACOSX) - channel_->AddFilter(new TextInputClientMessageFilter(id())); + channel_->AddFilter(new TextInputClientMessageFilter(GetID())); #endif SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( - new RendererURLRequestContextSelector(browser_context(), id()), - &browser_context()->GetResourceContext()); + new RendererURLRequestContextSelector(GetBrowserContext(), GetID()), + &GetBrowserContext()->GetResourceContext()); channel_->AddFilter(socket_stream_dispatcher_host); channel_->AddFilter( new WorkerMessageFilter( - id(), - &browser_context()->GetResourceContext(), + GetID(), + &GetBrowserContext()->GetResourceContext(), content::GetContentClient()->browser()->GetResourceDispatcherHost(), base::Bind(&RenderWidgetHelper::GetNextRoutingID, base::Unretained(widget_helper_.get())))); #if defined(ENABLE_P2P_APIS) channel_->AddFilter(new content::P2PSocketDispatcherHost( - &browser_context()->GetResourceContext())); + &GetBrowserContext()->GetResourceContext())); #endif channel_->AddFilter(new TraceMessageFilter()); channel_->AddFilter(new ResolveProxyMsgHelper( - browser_context()->GetRequestContextForRenderProcess(id()))); + GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); channel_->AddFilter(new QuotaDispatcherHost( - id(), browser_context()->GetQuotaManager(), + GetID(), GetBrowserContext()->GetQuotaManager(), content::GetContentClient()->browser()->CreateQuotaPermissionContext())); } -int BrowserRenderProcessHost::GetNextRoutingID() { +int RenderProcessHostImpl::GetNextRoutingID() { return widget_helper_->GetNextRoutingID(); } -void BrowserRenderProcessHost::UpdateAndSendMaxPageID(int32 page_id) { +void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { if (page_id > max_page_id_) Send(new ViewMsg_SetNextPageID(page_id + 1)); UpdateMaxPageID(page_id); } -void BrowserRenderProcessHost::CancelResourceRequests(int render_widget_id) { +void RenderProcessHostImpl::CancelResourceRequests(int render_widget_id) { widget_helper_->CancelResourceRequests(render_widget_id); } -void BrowserRenderProcessHost::CrossSiteSwapOutACK( +void RenderProcessHostImpl::CrossSiteSwapOutACK( const ViewMsg_SwapOut_Params& params) { widget_helper_->CrossSiteSwapOutACK(params); } -bool BrowserRenderProcessHost::WaitForUpdateMsg( +bool RenderProcessHostImpl::WaitForUpdateMsg( int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) { @@ -465,7 +566,7 @@ bool BrowserRenderProcessHost::WaitForUpdateMsg( return widget_helper_->WaitForUpdateMsg(render_widget_id, max_delay, msg); } -void BrowserRenderProcessHost::ReceivedBadMessage() { +void RenderProcessHostImpl::ReceivedBadMessage() { if (run_renderer_in_process()) { // In single process mode it is better if we don't suicide but just // crash. @@ -476,14 +577,14 @@ void BrowserRenderProcessHost::ReceivedBadMessage() { false); } -void BrowserRenderProcessHost::WidgetRestored() { +void RenderProcessHostImpl::WidgetRestored() { // Verify we were properly backgrounded. DCHECK_EQ(backgrounded_, (visible_widgets_ == 0)); visible_widgets_++; SetBackgrounded(false); } -void BrowserRenderProcessHost::WidgetHidden() { +void RenderProcessHostImpl::WidgetHidden() { // On startup, the browser will call Hide if (backgrounded_) return; @@ -497,11 +598,11 @@ void BrowserRenderProcessHost::WidgetHidden() { } } -int BrowserRenderProcessHost::VisibleWidgetCount() const { +int RenderProcessHostImpl::VisibleWidgetCount() const { return visible_widgets_; } -void BrowserRenderProcessHost::AppendRendererCommandLine( +void RenderProcessHostImpl::AppendRendererCommandLine( CommandLine* command_line) const { // Pass the process type first, so it shows first in process listings. command_line->AppendSwitchASCII(switches::kProcessType, @@ -530,7 +631,7 @@ void BrowserRenderProcessHost::AppendRendererCommandLine( } content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( - command_line, id()); + command_line, GetID()); // Appending disable-gpu-feature switches due to software rendering list. GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); @@ -538,7 +639,7 @@ void BrowserRenderProcessHost::AppendRendererCommandLine( gpu_data_manager->AppendRendererCommandLine(command_line); } -void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( +void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( const CommandLine& browser_cmd, CommandLine* renderer_cmd) const { // Propagate the following switches to the renderer command line (along @@ -636,13 +737,13 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( arraysize(kSwitchNames)); // Disable databases in incognito mode. - if (browser_context()->IsOffTheRecord() && + if (GetBrowserContext()->IsOffTheRecord() && !browser_cmd.HasSwitch(switches::kDisableDatabases)) { renderer_cmd->AppendSwitch(switches::kDisableDatabases); } } -base::ProcessHandle BrowserRenderProcessHost::GetHandle() { +base::ProcessHandle RenderProcessHostImpl::GetHandle() { // child_process_launcher_ is null either because we're in single process // mode, we have done fast termination, or the process has crashed. if (run_renderer_in_process() || !child_process_launcher_.get()) @@ -654,7 +755,7 @@ base::ProcessHandle BrowserRenderProcessHost::GetHandle() { return child_process_launcher_->GetHandle(); } -bool BrowserRenderProcessHost::FastShutdownIfPossible() { +bool RenderProcessHostImpl::FastShutdownIfPossible() { if (run_renderer_in_process()) return false; // Single process mode can't do fast shutdown. @@ -671,7 +772,7 @@ bool BrowserRenderProcessHost::FastShutdownIfPossible() { // while we're shutting down, so there's a small race here. Given that // the window is small, it's unlikely that the web page has much // state that will be lost by not calling its unload handlers properly. - if (!sudden_termination_allowed()) + if (!SuddenTerminationAllowed()) return false; // Store the handle before it gets changed. @@ -681,7 +782,7 @@ bool BrowserRenderProcessHost::FastShutdownIfPossible() { return true; } -void BrowserRenderProcessHost::DumpHandles() { +void RenderProcessHostImpl::DumpHandles() { #if defined(OS_WIN) Send(new ChildProcessMsg_DumpHandles()); return; @@ -691,7 +792,7 @@ void BrowserRenderProcessHost::DumpHandles() { } // This is a platform specific function for mapping a transport DIB given its id -TransportDIB* BrowserRenderProcessHost::MapTransportDIB( +TransportDIB* RenderProcessHostImpl::MapTransportDIB( TransportDIB::Id dib_id) { #if defined(OS_WIN) // On Windows we need to duplicate the handle from the remote process @@ -707,7 +808,7 @@ TransportDIB* BrowserRenderProcessHost::MapTransportDIB( #endif // defined(OS_POSIX) } -TransportDIB* BrowserRenderProcessHost::GetTransportDIB( +TransportDIB* RenderProcessHostImpl::GetTransportDIB( TransportDIB::Id dib_id) { if (!TransportDIB::is_valid_id(dib_id)) return NULL; @@ -745,19 +846,19 @@ TransportDIB* BrowserRenderProcessHost::GetTransportDIB( return dib; } -void BrowserRenderProcessHost::ClearTransportDIBCache() { +void RenderProcessHostImpl::ClearTransportDIBCache() { STLDeleteContainerPairSecondPointers( cached_dibs_.begin(), cached_dibs_.end()); cached_dibs_.clear(); } -void BrowserRenderProcessHost::SetCompositingSurface( +void RenderProcessHostImpl::SetCompositingSurface( int render_widget_id, gfx::PluginWindowHandle compositing_surface) { widget_helper_->SetCompositingSurface(render_widget_id, compositing_surface); } -bool BrowserRenderProcessHost::Send(IPC::Message* msg) { +bool RenderProcessHostImpl::Send(IPC::Message* msg) { if (!channel_.get()) { if (!is_initialized_) { queued_messages_.push(msg); @@ -776,7 +877,7 @@ bool BrowserRenderProcessHost::Send(IPC::Message* msg) { return channel_->Send(msg); } -bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { // If we're about to be deleted, or have initiated the fast shutdown sequence, // we ignore incoming messages. @@ -787,7 +888,7 @@ bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { // Dispatch control messages. bool msg_is_ok = true; - IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) + IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok) IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, OnShutdownRequest) IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, @@ -826,7 +927,7 @@ bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { return listener->OnMessageReceived(msg); } -void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) { +void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { #if defined(IPC_MESSAGE_LOG_ENABLED) Send(new ChildProcessMsg_SetIPCLoggingEnabled( IPC::Logging::GetInstance()->Enabled())); @@ -837,7 +938,7 @@ void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) { Send(new ChildProcessMsg_AskBeforeShutdown()); } -void BrowserRenderProcessHost::OnChannelError() { +void RenderProcessHostImpl::OnChannelError() { if (!channel_.get()) return; @@ -866,7 +967,7 @@ void BrowserRenderProcessHost::OnChannelError() { } // Called when the renderer process handle has been signaled. -void BrowserRenderProcessHost::OnWaitableEventSignaled( +void RenderProcessHostImpl::OnWaitableEventSignaled( base::WaitableEvent* waitable_event) { #if defined (OS_WIN) base::ProcessHandle handle = GetHandle(); @@ -878,7 +979,197 @@ void BrowserRenderProcessHost::OnWaitableEventSignaled( #endif } -void BrowserRenderProcessHost::ProcessDied(base::ProcessHandle handle, +content::BrowserContext* RenderProcessHostImpl::GetBrowserContext() const { + return browser_context_; +} + +int RenderProcessHostImpl::GetID() const { + return id_; +} + +bool RenderProcessHostImpl::HasConnection() const { + return channel_.get() != NULL; +} + +IPC::Channel::Listener* RenderProcessHostImpl::GetListenerByID( + int routing_id) { + return listeners_.Lookup(routing_id); +} + +void RenderProcessHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { + ignore_input_events_ = ignore_input_events; +} + +bool RenderProcessHostImpl::IgnoreInputEvents() const { + return ignore_input_events_; +} + +void RenderProcessHostImpl::Attach(IPC::Channel::Listener* listener, + int routing_id) { + listeners_.AddWithID(listener, routing_id); +} + +void RenderProcessHostImpl::Release(int listener_id) { + DCHECK(listeners_.Lookup(listener_id) != NULL); + listeners_.Remove(listener_id); + + // Make sure that all associated resource requests are stopped. + CancelResourceRequests(listener_id); + +#if defined(OS_WIN) + // Dump the handle table if handle auditing is enabled. + const CommandLine& browser_command_line = + *CommandLine::ForCurrentProcess(); + if (browser_command_line.HasSwitch(switches::kAuditHandles) || + browser_command_line.HasSwitch(switches::kAuditAllHandles)) { + DumpHandles(); + + // We wait to close the channels until the child process has finished + // dumping handles and sends us ChildProcessHostMsg_DumpHandlesDone. + return; + } +#endif + Cleanup(); +} + +void RenderProcessHostImpl::Cleanup() { + // When no other owners of this object, we can delete ourselves + if (listeners_.IsEmpty()) { + content::NotificationService::current()->Notify( + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, + content::Source<RenderProcessHost>(this), + content::NotificationService::NoDetails()); + MessageLoop::current()->DeleteSoon(FROM_HERE, this); + deleting_soon_ = true; + // It's important not to wait for the DeleteTask to delete the channel + // proxy. Kill it off now. That way, in case the profile is going away, the + // rest of the objects attached to this RenderProcessHost start going + // away first, since deleting the channel proxy will post a + // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. + channel_.reset(); + + // Remove ourself from the list of renderer processes so that we can't be + // reused in between now and when the Delete task runs. + g_all_hosts.Get().Remove(GetID()); + } +} + +void RenderProcessHostImpl::ReportExpectingClose(int32 listener_id) { + listeners_expecting_close_.insert(listener_id); +} + +void RenderProcessHostImpl::AddPendingView() { + pending_views_++; +} + +void RenderProcessHostImpl::RemovePendingView() { + DCHECK(pending_views_); + pending_views_--; +} + +void RenderProcessHostImpl::UpdateMaxPageID(int32 page_id) { + if (page_id > max_page_id_) + max_page_id_ = page_id; +} + +void RenderProcessHostImpl::SetSuddenTerminationAllowed(bool enabled) { + sudden_termination_allowed_ = enabled; +} + +bool RenderProcessHostImpl::SuddenTerminationAllowed() const { + return sudden_termination_allowed_; +} + +base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { + return base::TimeTicks::Now() - child_process_activity_time_; +} + +IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() { + return channel_.get(); +} + +content::RenderProcessHost::listeners_iterator + RenderProcessHostImpl::ListenersIterator() { + return listeners_iterator(&listeners_); +} + +bool RenderProcessHostImpl::FastShutdownForPageCount(size_t count) { + if (listeners_.size() == count) + return FastShutdownIfPossible(); + return false; +} + +bool RenderProcessHostImpl::FastShutdownStarted() const { + return fast_shutdown_started_; +} + +// static +bool content::RenderProcessHost::run_renderer_in_process() { + return g_run_renderer_in_process_; +} + +void content::RenderProcessHost::set_run_renderer_in_process(bool value) { + g_run_renderer_in_process_ = value; +} + +content::RenderProcessHost::iterator + content::RenderProcessHost::AllHostsIterator() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + return iterator(g_all_hosts.Pointer()); +} + +// static +content::RenderProcessHost* content::RenderProcessHost::FromID( + int render_process_id) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + return g_all_hosts.Get().Lookup(render_process_id); +} + +// static +bool content::RenderProcessHost::ShouldTryToUseExistingProcessHost() { + size_t renderer_process_count = g_all_hosts.Get().size(); + + // NOTE: Sometimes it's necessary to create more render processes than + // GetMaxRendererProcessCount(), for instance when we want to create + // a renderer process for a browser context that has no existing + // renderers. This is OK in moderation, since the + // GetMaxRendererProcessCount() is conservative. + + return run_renderer_in_process() || + (renderer_process_count >= GetMaxRendererProcessCount()); +} + +// static +content::RenderProcessHost* + content::RenderProcessHost::GetExistingProcessHost( + content::BrowserContext* browser_context, + const GURL& site_url) { + // First figure out which existing renderers we can use. + std::vector<content::RenderProcessHost*> suitable_renderers; + suitable_renderers.reserve(g_all_hosts.Get().size()); + + iterator iter(AllHostsIterator()); + while (!iter.IsAtEnd()) { + if (run_renderer_in_process() || + IsSuitableHost( + iter.GetCurrentValue(), + browser_context, site_url)) + suitable_renderers.push_back(iter.GetCurrentValue()); + + iter.Advance(); + } + + // Now pick a random suitable renderer, if we have any. + if (!suitable_renderers.empty()) { + int suitable_count = static_cast<int>(suitable_renderers.size()); + int random_index = base::RandInt(0, suitable_count - 1); + return suitable_renderers[random_index]; + } + + return NULL; +} + +void RenderProcessHostImpl::ProcessDied(base::ProcessHandle handle, base::TerminationStatus status, int exit_code, bool was_alive) { @@ -912,7 +1203,7 @@ void BrowserRenderProcessHost::ProcessDied(base::ProcessHandle handle, // TODO(darin): clean this up } -void BrowserRenderProcessHost::OnShutdownRequest() { +void RenderProcessHostImpl::OnShutdownRequest() { // Don't shutdown if there are pending RenderViews being swapped back in. if (pending_views_) return; @@ -927,15 +1218,15 @@ void BrowserRenderProcessHost::OnShutdownRequest() { Send(new ChildProcessMsg_Shutdown()); } -void BrowserRenderProcessHost::OnDumpHandlesDone() { - Cleanup(); +void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { + SetSuddenTerminationAllowed(enabled); } -void BrowserRenderProcessHost::SuddenTerminationChanged(bool enabled) { - set_sudden_termination_allowed(enabled); +void RenderProcessHostImpl::OnDumpHandlesDone() { + Cleanup(); } -void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) { +void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { // Note: we always set the backgrounded_ value. If the process is NULL // (and hence hasn't been created yet), we will set the process priority // later when we create the process. @@ -957,7 +1248,7 @@ void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) { child_process_launcher_->SetProcessBackgrounded(backgrounded); } -void BrowserRenderProcessHost::OnProcessLaunched() { +void RenderProcessHostImpl::OnProcessLaunched() { // No point doing anything, since this object will be destructed soon. We // especially don't want to send the RENDERER_PROCESS_CREATED notification, // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to @@ -995,18 +1286,18 @@ void BrowserRenderProcessHost::OnProcessLaunched() { } } -void BrowserRenderProcessHost::OnUserMetricsRecordAction( +void RenderProcessHostImpl::OnUserMetricsRecordAction( const std::string& action) { UserMetrics::RecordComputedAction(action); } -void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { +void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { // Only honor the request if appropriate persmissions are granted. - if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) + if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) content::GetContentClient()->browser()->OpenItem(path); } -void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, int64 data_size) { +void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> MHTMLGenerated(job_id, data_size); } diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/render_process_host_impl.h index fd023f6..053f5c9b 100644 --- a/content/browser/renderer_host/browser_render_process_host.h +++ b/content/browser/renderer_host/render_process_host_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ -#define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ +#ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ +#define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ #pragma once #include <map> @@ -16,7 +16,8 @@ #include "base/timer.h" #include "content/browser/child_process_launcher.h" #include "content/common/content_export.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" +#include "ipc/ipc_channel_proxy.h" #include "ui/gfx/surface/transport_dib.h" class CommandLine; @@ -41,22 +42,21 @@ class WaitableEvent; // keeps a list of RenderView (renderer) and TabContents (browser) which // are correlated with IDs. This way, the Views and the corresponding ViewHosts // communicate through the two process objects. -class CONTENT_EXPORT BrowserRenderProcessHost - : public RenderProcessHost, +class CONTENT_EXPORT RenderProcessHostImpl + : public content::RenderProcessHost, public ChildProcessLauncher::Client, public base::WaitableEventWatcher::Delegate { public: - explicit BrowserRenderProcessHost(content::BrowserContext* browser_context); - virtual ~BrowserRenderProcessHost(); + explicit RenderProcessHostImpl(content::BrowserContext* browser_context); + virtual ~RenderProcessHostImpl(); // RenderProcessHost implementation (public portion). virtual void EnableSendQueue() OVERRIDE; virtual bool Init(bool is_accessibility_enabled) OVERRIDE; virtual int GetNextRoutingID() OVERRIDE; - virtual void UpdateAndSendMaxPageID(int32 page_id) OVERRIDE; virtual void CancelResourceRequests(int render_widget_id) OVERRIDE; - virtual void CrossSiteSwapOutACK( - const ViewMsg_SwapOut_Params& params) OVERRIDE; + virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) + OVERRIDE; virtual bool WaitForUpdateMsg(int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) OVERRIDE; @@ -71,6 +71,28 @@ class CONTENT_EXPORT BrowserRenderProcessHost virtual void SetCompositingSurface( int render_widget_id, gfx::PluginWindowHandle compositing_surface) OVERRIDE; + virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; + virtual int GetID() const OVERRIDE; + virtual bool HasConnection() const OVERRIDE; + virtual void UpdateMaxPageID(int32 page_id) OVERRIDE; + virtual IPC::Channel::Listener* GetListenerByID(int routing_id) OVERRIDE; + virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; + virtual bool IgnoreInputEvents() const OVERRIDE; + virtual void Attach(IPC::Channel::Listener* listener, int routing_id) + OVERRIDE; + virtual void Release(int listener_id) OVERRIDE; + virtual void Cleanup() OVERRIDE; + virtual void ReportExpectingClose(int32 listener_id) OVERRIDE; + virtual void AddPendingView() OVERRIDE; + virtual void RemovePendingView() OVERRIDE; + virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE; + virtual bool SuddenTerminationAllowed() const OVERRIDE; + virtual IPC::ChannelProxy* GetChannel() OVERRIDE; + virtual listeners_iterator ListenersIterator() OVERRIDE; + virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; + virtual bool FastShutdownStarted() const OVERRIDE; + virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; + virtual void UpdateAndSendMaxPageID(int32 page_id) OVERRIDE; // IPC::Channel::Sender via RenderProcessHost. virtual bool Send(IPC::Message* msg) OVERRIDE; @@ -87,6 +109,35 @@ class CONTENT_EXPORT BrowserRenderProcessHost virtual void OnWaitableEventSignaled( base::WaitableEvent* waitable_event) OVERRIDE; + // Call this function when it is evident that the child process is actively + // performing some operation, for example if we just received an IPC message. + void mark_child_process_activity_time() { + child_process_activity_time_ = base::TimeTicks::Now(); + } + + protected: + // A proxy for our IPC::Channel that lives on the IO thread (see + // browser_process.h) + scoped_ptr<IPC::ChannelProxy> channel_; + + // The registered listeners. When this list is empty or all NULL, we should + // delete ourselves + IDMap<IPC::Channel::Listener> listeners_; + + // The maximum page ID we've ever seen from the renderer process. + int32 max_page_id_; + + // True if fast shutdown has been performed on this RPH. + bool fast_shutdown_started_; + + // True if we've posted a DeleteTask and will be deleted soon. + bool deleting_soon_; + + // The count of currently swapped out but pending RenderViews. We have + // started to swap these in, so the renderer process should not exit if + // this count is non-zero. + int32 pending_views_; + private: friend class VisitRelayingRenderProcessHost; @@ -135,6 +186,7 @@ class CONTENT_EXPORT BrowserRenderProcessHost // A map of transport DIB ids to cached TransportDIBs std::map<TransportDIB::Id, TransportDIB*> cached_dibs_; + enum { // This is the maximum size of |cached_dibs_| MAX_MAPPED_TRANSPORT_DIBS = 3, @@ -145,7 +197,7 @@ class CONTENT_EXPORT BrowserRenderProcessHost void ClearTransportDIBCache(); // This is used to clear our cache five seconds after the last use. - base::DelayTimer<BrowserRenderProcessHost> cached_dibs_cleaner_; + base::DelayTimer<RenderProcessHostImpl> cached_dibs_cleaner_; // Used in single-process mode. scoped_ptr<RendererMainThread> in_process_renderer_; @@ -171,7 +223,30 @@ class CONTENT_EXPORT BrowserRenderProcessHost base::WaitableEventWatcher child_process_watcher_; #endif - DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); + // The globally-unique identifier for this RPH. + int id_; + + content::BrowserContext* browser_context_; + + // set of listeners that expect the renderer process to close + std::set<int> listeners_expecting_close_; + + // True if the process can be shut down suddenly. If this is true, then we're + // sure that all the RenderViews in the process can be shutdown suddenly. If + // it's false, then specific RenderViews might still be allowed to be shutdown + // suddenly by checking their SuddenTerminationAllowed() flag. This can occur + // if one tab has an unload event listener but another tab in the same process + // doesn't. + bool sudden_termination_allowed_; + + // Set to true if we shouldn't send input events. We actually do the + // filtering for this at the render widget level. + bool ignore_input_events_; + + // Records the last time we regarded the child process active. + base::TimeTicks child_process_activity_time_; + + DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); }; -#endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ +#endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index dd1ebc0..a0edc68 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -23,7 +23,7 @@ #include "content/browser/host_zoom_map.h" #include "content/browser/in_process_webkit/session_storage_namespace.h" #include "content/browser/power_save_blocker.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_widget_host.h" @@ -88,7 +88,8 @@ base::i18n::TextDirection WebTextDirectionToChromeTextDirection( // static RenderViewHost* RenderViewHost::FromID(int render_process_id, int render_view_id) { - RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); + content::RenderProcessHost* process = + content::RenderProcessHost::FromID(render_process_id); if (!process) return NULL; RenderWidgetHost* widget = static_cast<RenderWidgetHost*>( @@ -122,7 +123,7 @@ RenderViewHost::RenderViewHost(SiteInstance* instance, render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { if (!session_storage_namespace_) { session_storage_namespace_ = new SessionStorageNamespace( - process()->browser_context()->GetWebKitContext()); + process()->GetBrowserContext()->GetWebKitContext()); } DCHECK(instance_); @@ -153,7 +154,7 @@ RenderViewHost::~RenderViewHost() { // Be sure to clean up any leftover state from cross-site requests. CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( - process()->id(), routing_id(), false); + process()->GetID(), routing_id(), false); } bool RenderViewHost::CreateRenderView(const string16& frame_name) { @@ -166,7 +167,7 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { if (!process()->Init(renderer_accessible())) return false; DCHECK(process()->HasConnection()); - DCHECK(process()->browser_context()); + DCHECK(process()->GetBrowserContext()); renderer_initialized_ = true; @@ -176,7 +177,7 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { ViewMsg_New_Params params; params.parent_window = GetNativeViewId(); params.renderer_preferences = - delegate_->GetRendererPrefs(process()->browser_context()); + delegate_->GetRendererPrefs(process()->GetBrowserContext()); params.web_preferences = delegate_->GetWebkitPrefs(); params.view_id = routing_id(); params.session_storage_namespace_id = session_storage_namespace_->id(); @@ -202,12 +203,12 @@ bool RenderViewHost::IsRenderViewLive() const { void RenderViewHost::SyncRendererPrefs() { Send(new ViewMsg_SetRendererPrefs(routing_id(), delegate_->GetRendererPrefs( - process()->browser_context()))); + process()->GetBrowserContext()))); } void RenderViewHost::Navigate(const ViewMsg_Navigate_Params& params) { ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL( - process()->id(), params.url); + process()->GetID(), params.url); ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(routing_id(), params); @@ -330,7 +331,7 @@ void RenderViewHost::SwapOut(int new_render_process_host_id, StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); ViewMsg_SwapOut_Params params; - params.closing_process_id = process()->id(); + params.closing_process_id = process()->GetID(); params.closing_route_id = routing_id(); params.new_render_process_host_id = new_render_process_host_id; params.new_request_id = new_request_id; @@ -392,7 +393,7 @@ void RenderViewHost::ClosePageIgnoringUnloadEvents() { void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id) { CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( - process()->id(), routing_id(), has_pending_request); + process()->GetID(), routing_id(), has_pending_request); pending_request_id_ = request_id; } @@ -408,17 +409,17 @@ void RenderViewHost::DragTargetDragEnter( // Grant the renderer the ability to load the drop_data. ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); - policy->GrantRequestURL(process()->id(), drop_data.url); + policy->GrantRequestURL(process()->GetID(), drop_data.url); for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); iter != drop_data.filenames.end(); ++iter) { FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); - policy->GrantRequestURL(process()->id(), + policy->GrantRequestURL(process()->GetID(), net::FilePathToFileURL(path)); - policy->GrantReadFile(process()->id(), path); + policy->GrantReadFile(process()->GetID(), path); // Allow dragged directories to be enumerated by the child process. // Note that we can't tell a file from a directory at this point. - policy->GrantReadDirectory(process()->id(), path); + policy->GrantReadDirectory(process()->GetID(), path); } Send(new DragMsg_TargetDragEnter(routing_id(), drop_data, client_pt, screen_pt, operations_allowed)); @@ -521,7 +522,7 @@ Value* RenderViewHost::ExecuteJavascriptAndGetValue(const string16& frame_xpath, void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg, bool success, const string16& user_input) { - process()->set_ignore_input_events(false); + process()->SetIgnoreInputEvents(false); bool is_waiting = is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; if (is_waiting) @@ -567,7 +568,7 @@ void RenderViewHost::DragSourceSystemDragEnded() { void RenderViewHost::AllowBindings(int bindings_flags) { if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) { ChildProcessSecurityPolicy::GetInstance()->GrantWebUIBindings( - process()->id()); + process()->GetID()); } enabled_bindings_ |= bindings_flags; @@ -610,7 +611,7 @@ void RenderViewHost::FilesSelectedInChooser( for (std::vector<FilePath>::const_iterator file = files.begin(); file != files.end(); ++file) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( - process()->id(), *file, permissions); + process()->GetID(), *file, permissions); } Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); } @@ -622,7 +623,7 @@ void RenderViewHost::DirectoryEnumerationFinished( for (std::vector<FilePath>::const_iterator file = files.begin(); file != files.end(); ++file) { ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( - process()->id(), *file); + process()->GetID(), *file); } Send(new ViewMsg_EnumerateDirectoryResponse(routing_id(), request_id, @@ -637,7 +638,7 @@ void RenderViewHost::LoadStateChanged(const GURL& url, } bool RenderViewHost::SuddenTerminationAllowed() const { - return sudden_termination_allowed_ || process()->sudden_termination_allowed(); + return sudden_termination_allowed_ || process()->SuddenTerminationAllowed(); } /////////////////////////////////////////////////////////////////////////////// @@ -883,7 +884,7 @@ void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) { if (is_waiting_for_unload_ack_) return; - const int renderer_id = process()->id(); + const int renderer_id = process()->GetID(); ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); // Without this check, an evil renderer can trick the browser into creating @@ -985,7 +986,7 @@ void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) { // Validate the URLs in |params|. If the renderer can't request the URLs // directly, don't show them in the context menu. ContextMenuParams validated_params(params); - int renderer_id = process()->id(); + int renderer_id = process()->GetID(); ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); @@ -1010,7 +1011,7 @@ void RenderViewHost::OnMsgOpenURL(const GURL& url, int64 source_frame_id) { GURL validated_url(url); FilterURL(ChildProcessSecurityPolicy::GetInstance(), - process()->id(), &validated_url); + process()->GetID(), &validated_url); delegate_->RequestOpenURL( validated_url, referrer, disposition, source_frame_id); @@ -1058,7 +1059,7 @@ void RenderViewHost::OnMsgRunJavaScriptMessage( IPC::Message* reply_msg) { // While a JS message dialog is showing, tabs in the same process shouldn't // process input events. - process()->set_ignore_input_events(true); + process()->SetIgnoreInputEvents(true); StopHangMonitorTimeout(); delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url, flags, reply_msg, @@ -1070,7 +1071,7 @@ void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, IPC::Message* reply_msg) { // While a JS before unload dialog is showing, tabs in the same process // shouldn't process input events. - process()->set_ignore_input_events(true); + process()->SetIgnoreInputEvents(true); StopHangMonitorTimeout(); delegate_->RunBeforeUnloadConfirm(this, message, reply_msg); } @@ -1092,8 +1093,8 @@ void RenderViewHost::OnMsgStartDragging( // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar. if (!drag_url.SchemeIs(chrome::kJavaScriptScheme)) - FilterURL(policy, process()->id(), &drag_url); - FilterURL(policy, process()->id(), &html_base_url); + FilterURL(policy, process()->GetID(), &drag_url); + FilterURL(policy, process()->GetID(), &html_base_url); if (drag_url != drop_data.url || html_base_url != drop_data.html_base_url) { WebDropData drop_data_copy = drop_data; @@ -1410,14 +1411,16 @@ void RenderViewHost::OnDidZoomURL(double zoom_level, bool remember, const GURL& url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - HostZoomMap* host_zoom_map = process()->browser_context()->GetHostZoomMap(); + HostZoomMap* host_zoom_map = process()->GetBrowserContext()-> + GetHostZoomMap(); if (remember) { host_zoom_map->SetZoomLevel(net::GetHostOrSpecFromURL(url), zoom_level); // Notify renderers from this browser context. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* render_process_host = i.GetCurrentValue(); - if (render_process_host->browser_context()->GetHostZoomMap()-> + content::RenderProcessHost* render_process_host = i.GetCurrentValue(); + if (render_process_host->GetBrowserContext()->GetHostZoomMap()-> GetOriginal() == host_zoom_map) { render_process_host->Send( new ViewMsg_SetZoomLevelForCurrentURL(url, zoom_level)); @@ -1425,7 +1428,7 @@ void RenderViewHost::OnDidZoomURL(double zoom_level, } } else { host_zoom_map->SetTemporaryZoomLevel( - process()->id(), routing_id(), zoom_level); + process()->GetID(), routing_id(), zoom_level); } } @@ -1454,7 +1457,7 @@ void RenderViewHost::OnMediaNotification(int64 player_cookie, void RenderViewHost::OnRequestDesktopNotificationPermission( const GURL& source_origin, int callback_context) { content::GetContentClient()->browser()->RequestDesktopNotificationPermission( - source_origin, callback_context, process()->id(), routing_id()); + source_origin, callback_context, process()->GetID(), routing_id()); } void RenderViewHost::OnShowDesktopNotification( @@ -1469,12 +1472,12 @@ void RenderViewHost::OnShowDesktopNotification( } content::GetContentClient()->browser()->ShowDesktopNotification( - params, process()->id(), routing_id(), false); + params, process()->GetID(), routing_id(), false); } void RenderViewHost::OnCancelDesktopNotification(int notification_id) { content::GetContentClient()->browser()->CancelDesktopNotification( - process()->id(), routing_id(), notification_id); + process()->GetID(), routing_id(), notification_id); } #if defined(OS_MACOSX) diff --git a/content/browser/renderer_host/render_widget_fullscreen_host.cc b/content/browser/renderer_host/render_widget_fullscreen_host.cc index 4fbd140..ecadaf7 100644 --- a/content/browser/renderer_host/render_widget_fullscreen_host.cc +++ b/content/browser/renderer_host/render_widget_fullscreen_host.cc @@ -5,6 +5,6 @@ #include "content/browser/renderer_host/render_widget_fullscreen_host.h" RenderWidgetFullscreenHost::RenderWidgetFullscreenHost( - RenderProcessHost* process, int routing_id) + content::RenderProcessHost* process, int routing_id) : RenderWidgetHost(process, routing_id) { } diff --git a/content/browser/renderer_host/render_widget_fullscreen_host.h b/content/browser/renderer_host/render_widget_fullscreen_host.h index 63b7070..7904e07 100644 --- a/content/browser/renderer_host/render_widget_fullscreen_host.h +++ b/content/browser/renderer_host/render_widget_fullscreen_host.h @@ -10,7 +10,8 @@ class CONTENT_EXPORT RenderWidgetFullscreenHost : public RenderWidgetHost { public: - RenderWidgetFullscreenHost(RenderProcessHost* process, int routing_id); + RenderWidgetFullscreenHost(content::RenderProcessHost* process, + int routing_id); }; #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_FULLSCREEN_HOST_H_ diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index b5e5ccd..9228e0f 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/eintr_wrapper.h" #include "base/threading/thread.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/common/view_messages.h" @@ -194,7 +194,8 @@ void RenderWidgetHelper::OnDispatchUpdateMsg(UpdateMsgProxy* proxy) { OnDiscardUpdateMsg(proxy); // It is reasonable for the host to no longer exist. - RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(render_process_id_); if (host) host->OnMessageReceived(proxy->message); } diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 323a102..706cc2c 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -16,7 +16,7 @@ #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_manager.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_helper.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/user_metrics.h" @@ -76,7 +76,7 @@ bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event, /////////////////////////////////////////////////////////////////////////////// // RenderWidgetHost -RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process, +RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process, int routing_id) : renderer_initialized_(false), renderer_accessible_(false), @@ -264,7 +264,7 @@ void RenderWidgetHost::WasHidden() { GpuProcessHost::SendOnIO( 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, - new GpuMsg_VisibilityChanged(routing_id_, process()->id(), false)); + new GpuMsg_VisibilityChanged(routing_id_, process()->GetID(), false)); // Tell the RenderProcessHost we were hidden. process_->WidgetHidden(); @@ -300,7 +300,7 @@ void RenderWidgetHost::WasRestored() { GpuProcessHost::SendOnIO( 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, - new GpuMsg_VisibilityChanged(routing_id_, process()->id(), true)); + new GpuMsg_VisibilityChanged(routing_id_, process()->GetID(), true)); process_->WidgetRestored(); @@ -547,7 +547,7 @@ void RenderWidgetHost::StopHangMonitorTimeout() { void RenderWidgetHost::ForwardMouseEvent(const WebMouseEvent& mouse_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardMouseEvent"); - if (ignore_input_events_ || process_->ignore_input_events()) + if (ignore_input_events_ || process_->IgnoreInputEvents()) return; // Avoid spamming the renderer with mouse move events. It is important @@ -582,7 +582,7 @@ void RenderWidgetHost::OnMouseActivate() { void RenderWidgetHost::ForwardWheelEvent( const WebMouseWheelEvent& wheel_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardWheelEvent"); - if (ignore_input_events_ || process_->ignore_input_events()) + if (ignore_input_events_ || process_->IgnoreInputEvents()) return; // If there's already a mouse wheel event waiting to be sent to the renderer, @@ -617,7 +617,7 @@ void RenderWidgetHost::ForwardWheelEvent( void RenderWidgetHost::ForwardGestureEvent( const WebKit::WebGestureEvent& gesture_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardWheelEvent"); - if (ignore_input_events_ || process_->ignore_input_events()) + if (ignore_input_events_ || process_->IgnoreInputEvents()) return; ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), false); @@ -626,7 +626,7 @@ void RenderWidgetHost::ForwardGestureEvent( void RenderWidgetHost::ForwardKeyboardEvent( const NativeWebKeyboardEvent& key_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardKeyboardEvent"); - if (ignore_input_events_ || process_->ignore_input_events()) + if (ignore_input_events_ || process_->IgnoreInputEvents()) return; if (key_event.type == WebKeyboardEvent::Char && @@ -692,7 +692,7 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event, if (!process_->HasConnection()) return; - DCHECK(!process_->ignore_input_events()); + DCHECK(!process_->IgnoreInputEvents()); IPC::Message* message = new ViewMsg_HandleInputEvent(routing_id_); message->WriteData( @@ -718,7 +718,7 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event, void RenderWidgetHost::ForwardTouchEvent( const WebKit::WebTouchEvent& touch_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardTouchEvent"); - if (ignore_input_events_ || process_->ignore_input_events()) + if (ignore_input_events_ || process_->IgnoreInputEvents()) return; if (touch_event.type == WebInputEvent::TouchMove && diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h index c282cc3..610588a 100644 --- a/content/browser/renderer_host/render_widget_host.h +++ b/content/browser/renderer_host/render_widget_host.h @@ -31,7 +31,6 @@ class BackingStore; struct EditCommand; -class RenderProcessHost; class RenderWidgetHostView; class TransportDIB; struct ViewHostMsg_UpdateRect_Params; @@ -41,6 +40,10 @@ namespace base { class TimeTicks; } +namespace content { +class RenderProcessHost; +} + namespace gfx { class Rect; } @@ -144,7 +147,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener, // routing_id can be MSG_ROUTING_NONE, in which case the next available // routing id is taken from the RenderProcessHost. - RenderWidgetHost(RenderProcessHost* process, int routing_id); + RenderWidgetHost(content::RenderProcessHost* process, int routing_id); virtual ~RenderWidgetHost(); // Gets/Sets the View of this RenderWidgetHost. Can be NULL, e.g. if the @@ -154,7 +157,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener, void SetView(RenderWidgetHostView* view); RenderWidgetHostView* view() const { return view_; } - RenderProcessHost* process() const { return process_; } + content::RenderProcessHost* process() const { return process_; } int routing_id() const { return routing_id_; } bool renderer_accessible() { return renderer_accessible_; } @@ -620,7 +623,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener, // Created during construction but initialized during Init*(). Therefore, it // is guaranteed never to be NULL, but its channel may be NULL if the // renderer crashed, so you must always check that. - RenderProcessHost* process_; + content::RenderProcessHost* process_; // Stores random bits of data for others to associate with this object. PropertyBag property_bag_; diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index a0b5245..d90a4dd 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -145,7 +145,7 @@ class TestView : public TestRenderWidgetHostView { class MockRenderWidgetHost : public RenderWidgetHost { public: - MockRenderWidgetHost(RenderProcessHost* process, int routing_id) + MockRenderWidgetHost(content::RenderProcessHost* process, int routing_id) : RenderWidgetHost(process, routing_id), prehandle_keyboard_event_(false), prehandle_keyboard_event_called_(false), diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h index ac2cac7..f44a076 100644 --- a/content/browser/renderer_host/render_widget_host_view.h +++ b/content/browser/renderer_host/render_widget_host_view.h @@ -27,12 +27,15 @@ #include "ui/gfx/surface/transport_dib.h" class BackingStore; -class RenderProcessHost; class RenderWidgetHost; class WebCursor; struct NativeWebKeyboardEvent; struct ViewHostMsg_AccessibilityNotification_Params; +namespace content { +class RenderProcessHost; +} + namespace gfx { class Rect; class Size; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 6fae1a3..39ddf3d 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -25,7 +25,7 @@ #include "content/browser/plugin_process_host.h" #import "content/browser/renderer_host/accelerated_plugin_view_mac.h" #include "content/browser/renderer_host/backing_store_mac.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #import "content/browser/renderer_host/render_widget_host_view_mac_delegate.h" #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h" @@ -929,7 +929,7 @@ void RenderWidgetHostViewMac::AcknowledgeSwapBuffers( // because |GpuProcessHost::Get()| can only be called there. // Currently, this is never called for plugins. if (render_widget_host_) { - DCHECK_EQ(render_widget_host_->process()->id(), renderer_id); + DCHECK_EQ(render_widget_host_->process()->GetID(), renderer_id); // |render_widget_host_->routing_id()| and |route_id| are usually not // equal: The former identifies the channel from the RWH in the browser // process to the corresponding render widget in the renderer process, while diff --git a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm index c81cc83..d053200 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm @@ -71,7 +71,7 @@ namespace { // Create a RenderWidget for which we can filter messages. class RenderWidgetHostEditCommandCounter : public RenderWidgetHost { public: - RenderWidgetHostEditCommandCounter(RenderProcessHost* process, + RenderWidgetHostEditCommandCounter(content::RenderProcessHost* process, int routing_id) : RenderWidgetHost(process, routing_id), edit_command_message_count_(0) { diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 59257b0..99cf505 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -22,7 +22,7 @@ #include "content/browser/plugin_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_win.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" @@ -1911,8 +1911,8 @@ void RenderWidgetHostViewWin::Observe( // Get the RenderProcessHost that posted this notification, and exit // if it's not the one associated with this host view. - RenderProcessHost* render_process_host = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* render_process_host = + content::Source<content::RenderProcessHost>(source).ptr(); DCHECK(render_process_host); if (!render_widget_host_ || render_process_host != render_widget_host_->process()) diff --git a/content/browser/renderer_host/test_backing_store.cc b/content/browser/renderer_host/test_backing_store.cc index f45d35a..4f14eb9 100644 --- a/content/browser/renderer_host/test_backing_store.cc +++ b/content/browser/renderer_host/test_backing_store.cc @@ -13,7 +13,7 @@ TestBackingStore::~TestBackingStore() { } void TestBackingStore::PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/test_backing_store.h b/content/browser/renderer_host/test_backing_store.h index 5dbfa3f..05da4e6 100644 --- a/content/browser/renderer_host/test_backing_store.h +++ b/content/browser/renderer_host/test_backing_store.h @@ -16,7 +16,7 @@ class TestBackingStore : public BackingStore { // BackingStore implementation. virtual void PaintToBackingStore( - RenderProcessHost* process, + content::RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects, diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 5bbe3170..abad243 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -258,7 +258,7 @@ void TestRenderWidgetHostView::UnlockMouse() { } TestRenderViewHostFactory::TestRenderViewHostFactory( - RenderProcessHostFactory* rph_factory) + content::RenderProcessHostFactory* rph_factory) : render_process_host_factory_(rph_factory) { RenderViewHostFactory::RegisterFactory(this); } @@ -268,7 +268,7 @@ TestRenderViewHostFactory::~TestRenderViewHostFactory() { } void TestRenderViewHostFactory::set_render_process_host_factory( - RenderProcessHostFactory* rph_factory) { + content::RenderProcessHostFactory* rph_factory) { render_process_host_factory_ = rph_factory; } diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index 5a64703..27468dd 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -19,6 +19,7 @@ namespace content { class BrowserContext; +class RenderProcessHostFactory; } namespace gfx { @@ -262,11 +263,12 @@ class TestRenderViewHost : public RenderViewHost { // registered at a time, you can only have one of these objects at a time. class TestRenderViewHostFactory : public RenderViewHostFactory { public: - explicit TestRenderViewHostFactory(RenderProcessHostFactory* rph_factory); + explicit TestRenderViewHostFactory( + content::RenderProcessHostFactory* rph_factory); virtual ~TestRenderViewHostFactory(); virtual void set_render_process_host_factory( - RenderProcessHostFactory* rph_factory); + content::RenderProcessHostFactory* rph_factory); virtual RenderViewHost* CreateRenderViewHost( SiteInstance* instance, RenderViewHostDelegate* delegate, @@ -281,7 +283,7 @@ class TestRenderViewHostFactory : public RenderViewHostFactory { // Instead, we set it right before we create a new RenderViewHost, which // happens before the RenderProcessHost is created. This way, the instance // has the correct factory and creates our special RenderProcessHosts. - RenderProcessHostFactory* render_process_host_factory_; + content::RenderProcessHostFactory* render_process_host_factory_; DISALLOW_COPY_AND_ASSIGN(TestRenderViewHostFactory); }; diff --git a/content/browser/renderer_host/text_input_client_mac_unittest.mm b/content/browser/renderer_host/text_input_client_mac_unittest.mm index 58552d6..d3dd7be 100644 --- a/content/browser/renderer_host/text_input_client_mac_unittest.mm +++ b/content/browser/renderer_host/text_input_client_mac_unittest.mm @@ -9,7 +9,7 @@ #include "base/threading/thread.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/renderer_host/mock_render_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/text_input_client_message_filter.h" #include "content/common/text_input_client_messages.h" @@ -129,7 +129,7 @@ TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) { base::Unretained(service()), kPreviousValue)); scoped_refptr<TextInputClientMessageFilter> filter( - new TextInputClientMessageFilter(widget()->process()->id())); + new TextInputClientMessageFilter(widget()->process()->GetID())); scoped_ptr<IPC::Message> message( new TextInputClientReplyMsg_GotCharacterIndexForPoint( widget()->routing_id(), kNotFoundValue)); diff --git a/content/browser/site_instance.cc b/content/browser/site_instance.cc index 4cb5759..50672ef 100644 --- a/content/browser/site_instance.cc +++ b/content/browser/site_instance.cc @@ -5,11 +5,12 @@ #include "content/browser/site_instance.h" #include "content/browser/browsing_instance.h" -#include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/webui/web_ui_factory.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host_factory.h" #include "content/public/common/url_constants.h" #include "net/base/registry_controlled_domain.h" @@ -55,7 +56,7 @@ bool SiteInstance::HasProcess() const { return (process_ != NULL); } -RenderProcessHost* SiteInstance::GetProcess() { +content::RenderProcessHost* SiteInstance::GetProcess() { // TODO(erikkay) It would be nice to ensure that the renderer type had been // properly set before we get here. The default tab creation case winds up // with no site set at this point, so it will default to TYPE_NORMAL. This @@ -66,8 +67,8 @@ RenderProcessHost* SiteInstance::GetProcess() { // Create a new process if ours went away or was reused. if (!process_) { // See if we should reuse an old process - if (RenderProcessHost::ShouldTryToUseExistingProcessHost()) - process_ = RenderProcessHost::GetExistingProcessHost( + if (content::RenderProcessHost::ShouldTryToUseExistingProcessHost()) + process_ = content::RenderProcessHost::GetExistingProcessHost( browsing_instance_->browser_context(), site_); // Otherwise (or if that fails), create a new one. @@ -77,7 +78,7 @@ RenderProcessHost* SiteInstance::GetProcess() { browsing_instance_->browser_context()); } else { process_ = - new BrowserRenderProcessHost(browsing_instance_->browser_context()); + new RenderProcessHostImpl(browsing_instance_->browser_context()); } } @@ -224,7 +225,8 @@ void SiteInstance::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); - RenderProcessHost* rph = content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* rph = + content::Source<content::RenderProcessHost>(source).ptr(); if (rph == process_) process_ = NULL; } diff --git a/content/browser/site_instance.h b/content/browser/site_instance.h index 7bf15f5..057ed59 100644 --- a/content/browser/site_instance.h +++ b/content/browser/site_instance.h @@ -6,7 +6,7 @@ #define CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ #pragma once -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/content_export.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -16,6 +16,7 @@ class BrowsingInstance; namespace content { class BrowserContext; +class RenderProcessHostFactory; } /////////////////////////////////////////////////////////////////////////////// @@ -67,7 +68,8 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance>, // The factory must outlive the SiteInstance; ownership is not transferred. It // may be NULL, in which case the default BrowserRenderProcessHost will be // created (this is the behavior if you don't call this function). - void set_render_process_host_factory(RenderProcessHostFactory* rph_factory) { + void set_render_process_host_factory( + content::RenderProcessHostFactory* rph_factory) { render_process_host_factory_ = rph_factory; } @@ -84,7 +86,7 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance>, // Returns the current process being used to render pages in this // SiteInstance. If the process has crashed or otherwise gone away, then // this method will create a new process and update our host ID accordingly. - RenderProcessHost* GetProcess(); + content::RenderProcessHost* GetProcess(); // Set / Get the web site that this SiteInstance is rendering pages for. // This includes the scheme and registered domain, but not the port. If the @@ -183,13 +185,13 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance>, // Factory for new RenderProcessHosts, not owned by this class. NULL indiactes // that the default BrowserRenderProcessHost should be created. - const RenderProcessHostFactory* render_process_host_factory_; + const content::RenderProcessHostFactory* render_process_host_factory_; // Current RenderProcessHost that is rendering pages for this SiteInstance. // This pointer will only change once the RenderProcessHost is destructed. It // will still remain the same even if the process crashes, since in that // scenario the RenderProcessHost remains the same. - RenderProcessHost* process_; + content::RenderProcessHost* process_; // The current max_page_id in the SiteInstance's RenderProcessHost. If the // rendering process dies, its replacement should start issuing page IDs that diff --git a/content/browser/site_instance_unittest.cc b/content/browser/site_instance_unittest.cc index 4559d8b..5763e2c 100644 --- a/content/browser/site_instance_unittest.cc +++ b/content/browser/site_instance_unittest.cc @@ -9,7 +9,7 @@ #include "content/browser/browsing_instance.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/mock_content_browser_client.h" -#include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" @@ -68,9 +68,9 @@ class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient { url == GURL(chrome::kAboutCrashURL); } - virtual bool IsSuitableHost(RenderProcessHost* process_host, + virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& site_url) OVERRIDE { - return (privileged_process_id_ == process_host->id()) == + return (privileged_process_id_ == process_host->GetID()) == site_url.SchemeIs(kPrivilegedScheme); } @@ -295,7 +295,7 @@ TEST_F(SiteInstanceTest, UpdateMaxPageID) { TEST_F(SiteInstanceTest, GetProcess) { // Ensure that GetProcess returns a process. scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); - scoped_ptr<RenderProcessHost> host1; + scoped_ptr<content::RenderProcessHost> host1; scoped_refptr<SiteInstance> instance( SiteInstance::CreateSiteInstance(browser_context.get())); host1.reset(instance->GetProcess()); @@ -304,7 +304,7 @@ TEST_F(SiteInstanceTest, GetProcess) { // Ensure that GetProcess creates a new process. scoped_refptr<SiteInstance> instance2( SiteInstance::CreateSiteInstance(browser_context.get())); - scoped_ptr<RenderProcessHost> host2(instance2->GetProcess()); + scoped_ptr<content::RenderProcessHost> host2(instance2->GetProcess()); EXPECT_TRUE(host2.get() != NULL); EXPECT_NE(host1.get(), host2.get()); } @@ -514,8 +514,8 @@ TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { // browsing_instances will be deleted when their SiteInstances are deleted } -static SiteInstance* CreateSiteInstance(RenderProcessHostFactory* factory, - const GURL& url) { +static SiteInstance* CreateSiteInstance( + content::RenderProcessHostFactory* factory, const GURL& url) { SiteInstance* instance = SiteInstance::CreateSiteInstanceForURL(NULL, url); instance->set_render_process_host_factory(factory); return instance; @@ -537,13 +537,13 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { scoped_refptr<SiteInstance> extension1_instance( CreateSiteInstance(&rph_factory, GURL(kPrivilegedScheme + std::string("://foo/bar")))); - SetPrivilegedProcessId(extension1_instance->GetProcess()->id()); + SetPrivilegedProcessId(extension1_instance->GetProcess()->GetID()); scoped_refptr<SiteInstance> extension2_instance( CreateSiteInstance(&rph_factory, GURL(kPrivilegedScheme + std::string("://baz/bar")))); - scoped_ptr<RenderProcessHost> extension_host( + scoped_ptr<content::RenderProcessHost> extension_host( extension1_instance->GetProcess()); EXPECT_EQ(extension1_instance->GetProcess(), extension2_instance->GetProcess()); @@ -551,12 +551,13 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { // Create some WebUI instances and make sure they share a process. scoped_refptr<SiteInstance> webui1_instance(CreateSiteInstance(&rph_factory, GURL(chrome::kChromeUIScheme + std::string("://newtab")))); - policy->GrantWebUIBindings(webui1_instance->GetProcess()->id()); + policy->GrantWebUIBindings(webui1_instance->GetProcess()->GetID()); scoped_refptr<SiteInstance> webui2_instance( CreateSiteInstance(&rph_factory, GURL(chrome::kChromeUIScheme + std::string("://history")))); - scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess()); + scoped_ptr<content::RenderProcessHost> dom_host( + webui1_instance->GetProcess()); EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess()); // Make sure none of differing privilege processes are mixed. diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc index 3b17d950..c6b40c3 100644 --- a/content/browser/ssl/ssl_policy.cc +++ b/content/browser/ssl/ssl_policy.cc @@ -10,7 +10,7 @@ #include "base/memory/singleton.h" #include "base/string_piece.h" #include "base/string_util.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/ssl/ssl_cert_error_handler.h" @@ -93,7 +93,7 @@ void SSLPolicy::DidRunInsecureContent(NavigationEntry* entry, return; backend_->HostRanInsecureContent(GURL(security_origin).host(), - site_instance->GetProcess()->id()); + site_instance->GetProcess()->GetID()); } void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) { @@ -145,8 +145,8 @@ void SSLPolicy::UpdateEntry(NavigationEntry* entry, TabContents* tab_contents) { // necessarily have site instances. Without a process, the entry can't // possibly have insecure content. See bug http://crbug.com/12423. if (site_instance && - backend_->DidHostRunInsecureContent(entry->url().host(), - site_instance->GetProcess()->id())) { + backend_->DidHostRunInsecureContent( + entry->url().host(), site_instance->GetProcess()->GetID())) { entry->ssl().set_security_style( content::SECURITY_STYLE_AUTHENTICATION_BROKEN); entry->ssl().set_ran_insecure_content(); diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 112c7c1..957aecd 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -11,7 +11,7 @@ #include "base/string_util.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -141,7 +141,7 @@ InterstitialPage::InterstitialPage(TabContents* tab, enabled_(true), action_taken_(NO_ACTION), render_view_host_(NULL), - original_child_id_(tab->render_view_host()->process()->id()), + original_child_id_(tab->render_view_host()->process()->GetID()), original_rvh_id_(tab->render_view_host()->routing_id()), should_revert_tab_title_(false), tab_was_loading_(false), @@ -285,7 +285,7 @@ void InterstitialPage::Observe(int type, // closed); make sure we clear the blocked requests. RenderViewHost* rvh = static_cast<RenderViewHost*>( content::Source<RenderWidgetHost>(source).ptr()); - DCHECK(rvh->process()->id() == original_child_id_ && + DCHECK(rvh->process()->GetID() == original_child_id_ && rvh->routing_id() == original_rvh_id_); TakeActionOnResourceDispatcher(CANCEL); } diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 593933a..5fccef9 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -167,7 +167,7 @@ bool RenderViewHostManager::ShouldCloseTabOnUnresponsiveRenderer() { // CrossSiteResourceHandler will already be cleaned up.) ViewMsg_SwapOut_Params params; params.new_render_process_host_id = - pending_render_view_host_->process()->id(); + pending_render_view_host_->process()->GetID(); params.new_request_id = pending_request_id; current_host()->process()->CrossSiteSwapOutACK(params); } @@ -194,7 +194,7 @@ void RenderViewHostManager::DidNavigateMainFrame( // then we still need to swap out the old RVH first and run its unload // handler. OK for that to happen in the background. if (pending_render_view_host_->GetPendingRequestId() == -1) { - OnCrossSiteResponse(pending_render_view_host_->process()->id(), + OnCrossSiteResponse(pending_render_view_host_->process()->GetID(), pending_render_view_host_->routing_id()); } @@ -231,7 +231,7 @@ void RenderViewHostManager::RendererAbortedProvisionalLoad( } void RenderViewHostManager::RendererProcessClosing( - RenderProcessHost* render_process_host) { + content::RenderProcessHost* render_process_host) { // Remove any swapped out RVHs from this process, so that we don't try to // swap them back in while the process is exiting. Start by finding them, // since there could be more than one. @@ -320,7 +320,8 @@ void RenderViewHostManager::Observe( const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_CLOSING: - RendererProcessClosing(content::Source<RenderProcessHost>(source).ptr()); + RendererProcessClosing( + content::Source<content::RenderProcessHost>(source).ptr()); break; default: diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h index 8a35bcb..8a744bc 100644 --- a/content/browser/tab_contents/render_view_host_manager.h +++ b/content/browser/tab_contents/render_view_host_manager.h @@ -237,7 +237,7 @@ class CONTENT_EXPORT RenderViewHostManager // Called when a renderer process is starting to close. We should not // schedule new navigations in its swapped out RenderViewHosts after this. - void RendererProcessClosing(RenderProcessHost* render_process_host); + void RendererProcessClosing(content::RenderProcessHost* render_process_host); // Our delegate, not owned by us. Guaranteed non-NULL. Delegate* delegate_; diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 03a6ed4..d926eec 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -22,7 +22,7 @@ #include "content/browser/in_process_webkit/session_storage_namespace.h" #include "content/browser/load_from_memory_cache_details.h" #include "content/browser/load_notification_details.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -326,7 +326,7 @@ void TabContents::RunFileChooser( delegate()->RunFileChooser(this, params); } -RenderProcessHost* TabContents::GetRenderProcessHost() const { +content::RenderProcessHost* TabContents::GetRenderProcessHost() const { if (render_manager_.current_host()) return render_manager_.current_host()->process(); else @@ -846,7 +846,7 @@ double TabContents::GetZoomLevel() const { double zoom_level; if (temporary_zoom_settings_) { zoom_level = zoom_map->GetTemporaryZoomLevel( - GetRenderProcessHost()->id(), render_view_host()->routing_id()); + GetRenderProcessHost()->GetID(), render_view_host()->routing_id()); } else { GURL url; NavigationEntry* active_entry = controller().GetActiveEntry(); @@ -914,7 +914,7 @@ void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); GURL validated_url(url); render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), - GetRenderProcessHost()->id(), &validated_url); + GetRenderProcessHost()->GetID(), &validated_url); RenderViewHost* rvh = render_manager_.pending_render_view_host() ? @@ -963,7 +963,7 @@ void TabContents::OnDidFailProvisionalLoadWithError( << ", frame_id: " << params.frame_id; GURL validated_url(params.url); render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), - GetRenderProcessHost()->id(), &validated_url); + GetRenderProcessHost()->GetID(), &validated_url); if (net::ERR_ABORTED == params.error_code) { // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. @@ -1045,7 +1045,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache( &cert_id, &cert_status, &security_bits, &connection_status); - LoadFromMemoryCacheDetails details(url, GetRenderProcessHost()->id(), + LoadFromMemoryCacheDetails details(url, GetRenderProcessHost()->GetID(), cert_id, cert_status); content::NotificationService::current()->Notify( diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index d64cbaa..1256c30 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -111,7 +111,7 @@ class CONTENT_EXPORT TabContents : public PageNavigator, // Return the currently active RenderProcessHost and RenderViewHost. Each of // these may change over time. - RenderProcessHost* GetRenderProcessHost() const; + content::RenderProcessHost* GetRenderProcessHost() const; RenderViewHost* render_view_host() const { return render_manager_.current_host(); } diff --git a/content/browser/webui/web_ui.cc b/content/browser/webui/web_ui.cc index 2096194..5febef8 100644 --- a/content/browser/webui/web_ui.cc +++ b/content/browser/webui/web_ui.cc @@ -11,7 +11,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" @@ -72,7 +72,7 @@ void WebUI::OnWebUISend(const GURL& source_url, const std::string& message, const ListValue& args) { if (!ChildProcessSecurityPolicy::GetInstance()-> - HasWebUIBindings(tab_contents_->GetRenderProcessHost()->id())) { + HasWebUIBindings(tab_contents_->GetRenderProcessHost()->GetID())) { NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; return; } diff --git a/content/content_browser.gypi b/content/content_browser.gypi index eb822ba..5525bc7 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -39,6 +39,8 @@ 'public/browser/notification_source.h', 'public/browser/notification_types.h', 'public/browser/plugin_data_remover.h', + 'public/browser/render_process_host.h', + 'public/browser/render_process_host_factory.h', 'public/browser/resource_dispatcher_host_delegate.h', 'browser/accessibility/browser_accessibility.cc', 'browser/accessibility/browser_accessibility.h', @@ -341,8 +343,6 @@ 'browser/renderer_host/backing_store_gtk.h', 'browser/renderer_host/blob_message_filter.cc', 'browser/renderer_host/blob_message_filter.h', - 'browser/renderer_host/browser_render_process_host.cc', - 'browser/renderer_host/browser_render_process_host.h', 'browser/renderer_host/buffered_resource_handler.cc', 'browser/renderer_host/buffered_resource_handler.h', 'browser/renderer_host/clipboard_message_filter.cc', @@ -420,8 +420,8 @@ 'browser/renderer_host/render_message_filter.cc', 'browser/renderer_host/render_message_filter.h', 'browser/renderer_host/render_message_filter_win.cc', - 'browser/renderer_host/render_process_host.cc', - 'browser/renderer_host/render_process_host.h', + 'browser/renderer_host/render_process_host_impl.cc', + 'browser/renderer_host/render_process_host_impl.h', 'browser/renderer_host/render_sandbox_host_linux.cc', 'browser/renderer_host/render_sandbox_host_linux.h', 'browser/renderer_host/render_view_host.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index fe9a227..34668f3 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -46,8 +46,8 @@ 'browser/mock_content_browser_client.h', 'browser/mock_resource_context.cc', 'browser/mock_resource_context.h', - 'browser/net/url_request_abort_on_end_job.cc', - 'browser/net/url_request_abort_on_end_job.h', + 'browser/net/url_request_abort_on_end_job.cc', + 'browser/net/url_request_abort_on_end_job.h', 'browser/renderer_host/dummy_resource_handler.cc', 'browser/renderer_host/dummy_resource_handler.h', 'browser/renderer_host/media/mock_media_observer.cc', diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index bc4c32a..4704334 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -15,7 +15,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresenter.h" class AccessTokenStore; -class BrowserRenderProcessHost; class BrowserURLHandler; class CommandLine; class DevToolsManager; @@ -24,7 +23,6 @@ class GURL; class MHTMLGenerationManager; class PluginProcessHost; class QuotaPermissionContext; -class RenderProcessHost; class RenderViewHost; class RenderWidgetHost; class RenderWidgetHostView; @@ -42,6 +40,7 @@ namespace content { class BrowserMainParts; struct MainFunctionParams; struct ShowDesktopNotificationHostMsgParams; +class RenderProcessHost; } namespace crypto { @@ -108,11 +107,11 @@ class ContentBrowserClient { // Notifies that a new RenderHostView has been created. virtual void RenderViewHostCreated(RenderViewHost* render_view_host) = 0; - // Notifies that a BrowserRenderProcessHost has been created. This is called - // before the content layer adds its own BrowserMessageFilters, so that the + // Notifies that a RenderProcessHost has been created. This is called before + // the content layer adds its own BrowserMessageFilters, so that the // embedder's IPC filters have priority. - virtual void BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) = 0; + virtual void RenderProcessHostCreated( + content::RenderProcessHost* host) = 0; // Notifies that a PluginProcessHost has been created. This is called // before the content layer adds its own message filters, so that the @@ -138,7 +137,7 @@ class ContentBrowserClient { // Returns whether a new view for a given |site_url| can be launched in a // given |process_host|. - virtual bool IsSuitableHost(RenderProcessHost* process_host, + virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& site_url) = 0; // Called when a site instance is first associated with a process. diff --git a/content/browser/renderer_host/render_process_host.h b/content/public/browser/render_process_host.h index 6003203..194675b 100644 --- a/content/browser/renderer_host/render_process_host.h +++ b/content/public/browser/render_process_host.h @@ -2,19 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ -#define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ -#pragma once - -#include <set> +#ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ +#define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ +#include "base/basictypes.h" #include "base/id_map.h" -#include "base/memory/scoped_ptr.h" #include "base/process.h" #include "base/process_util.h" -#include "base/time.h" #include "content/common/content_export.h" #include "ipc/ipc_channel_proxy.h" +#include "ipc/ipc_message.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/surface/transport_dib.h" @@ -25,17 +22,20 @@ namespace content { class BrowserContext; } -// Virtual interface that represents the browser side of the browser <-> -// renderer communication channel. There will generally be one -// RenderProcessHost per renderer process. -// -// The concrete implementation of this class for normal use is the -// BrowserRenderProcessHost. It may also be implemented by a testing interface -// for mocking purposes. -class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, +namespace base { +class TimeDelta; +} + +namespace content { + +// Interface that represents the browser side of the browser <-> renderer +// communication channel. There will generally be one RenderProcessHost per +// renderer process. +class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender, public IPC::Channel::Listener { public: typedef IDMap<RenderProcessHost>::iterator iterator; + typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; // Details for RENDERER_PROCESS_CLOSED notifications. struct RendererClosedDetails { @@ -54,108 +54,7 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, bool was_alive; }; - explicit RenderProcessHost(content::BrowserContext* browser_context); - virtual ~RenderProcessHost(); - - // Returns the user browser context associated with this renderer process. - content::BrowserContext* browser_context() const { return browser_context_; } - - // Returns the unique ID for this child process. This can be used later in - // a call to FromID() to get back to this object (this is used to avoid - // sending non-threadsafe pointers to other threads). - // - // This ID will be unique for all child processes, including workers, plugins, - // etc. It is generated by ChildProcessInfo. - int id() const { return id_; } - - // Returns true iff channel_ has been set to non-NULL. Use this for checking - // if there is connection or not. Virtual for mocking out for tests. - virtual bool HasConnection() const; - - bool sudden_termination_allowed() const { - return sudden_termination_allowed_; - } - void set_sudden_termination_allowed(bool enabled) { - sudden_termination_allowed_ = enabled; - } - - // Used for refcounting, each holder of this object must Attach and Release - // just like it would for a COM object. This object should be allocated on - // the heap; when no listeners own it any more, it will delete itself. - void Attach(IPC::Channel::Listener* listener, int routing_id); - - // See Attach() - void Release(int listener_id); - - // Schedules the host for deletion and removes it from the all_hosts list. - void Cleanup(); - - // Listeners should call this when they've sent a "Close" message and - // they're waiting for a "Close_ACK", so that if the renderer process - // goes away we'll know that it was intentional rather than a crash. - void ReportExpectingClose(int32 listener_id); - - // Track the count of pending views that are being swapped back in. Called - // by listeners to register and unregister pending views to prevent the - // process from exiting. - void AddPendingView(); - void RemovePendingView(); - - // Allows iteration over this RenderProcessHost's RenderViewHost listeners. - // Use from UI thread only. - typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; - - listeners_iterator ListenersIterator() { - return listeners_iterator(&listeners_); - } - - IPC::Channel::Listener* GetListenerByID(int routing_id) { - return listeners_.Lookup(routing_id); - } - - IPC::ChannelProxy* channel() { return channel_.get(); } - - // Called to inform the render process host of a new "max page id" for a - // render view host. The render process host computes the largest page id - // across all render view hosts and uses the value when it needs to - // initialize a new renderer in place of the current one. - void UpdateMaxPageID(int32 page_id); - - void set_ignore_input_events(bool ignore_input_events) { - ignore_input_events_ = ignore_input_events; - } - bool ignore_input_events() { - return ignore_input_events_; - } - - // Returns how long the child has been idle. The definition of idle - // depends on when a derived class calls mark_child_process_activity_time(). - // This is a rough indicator and its resolution should not be better than - // 10 milliseconds. - base::TimeDelta get_child_process_idle_time() const { - return base::TimeTicks::Now() - child_process_activity_time_; - } - - // Call this function when it is evident that the child process is actively - // performing some operation, for example if we just received an IPC message. - void mark_child_process_activity_time() { - child_process_activity_time_ = base::TimeTicks::Now(); - } - - // Try to shutdown the associated render process as fast as possible, but - // only if |count| matches the number of render widgets that this process - // controls. - bool FastShutdownForPageCount(size_t count); - - bool fast_shutdown_started() { - return fast_shutdown_started_; - } - - // Virtual interface --------------------------------------------------------- - - // Call this to allow queueing of IPC messages that are sent before the - // process is launched. - virtual void EnableSendQueue() = 0; + virtual ~RenderProcessHost() {} // Initialize the new renderer process, returning true on success. This must // be called once before the object can be used, but can be called after @@ -166,9 +65,6 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, // Gets the next available routing id. virtual int GetNextRoutingID() = 0; - // Update the max page ID and send the update to the renderer process as well. - virtual void UpdateAndSendMaxPageID(int32 page_id) = 0; - // Called on the UI thread to cancel any outstanding resource requests for // the specified render widget. virtual void CancelResourceRequests(int render_widget_id) = 0; @@ -180,9 +76,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, virtual void CrossSiteSwapOutACK( const ViewMsg_SwapOut_Params& params) = 0; - // Called on the UI thread to wait for the next UpdateRect message for the - // specified render widget. Returns true if successful, and the msg out- - // param will contain a copy of the received UpdateRect message. + // Called to wait for the next UpdateRect message for the specified render + // widget. Returns true if successful, and the msg out-param will contain a + // copy of the received UpdateRect message. virtual bool WaitForUpdateMsg(int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) = 0; @@ -202,6 +98,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, // Returns True if it was able to do fast shutdown. virtual bool FastShutdownIfPossible() = 0; + // Returns true if fast shutdown was started for the renderer. + virtual bool FastShutdownStarted() const = 0; + // Dump the child process' handle table before shutting down. virtual void DumpHandles() = 0; @@ -231,6 +130,84 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, int render_widget_id, gfx::PluginWindowHandle compositing_surface) = 0; + // Returns the user browser context associated with this renderer process. + virtual content::BrowserContext* GetBrowserContext() const = 0; + + // Returns the unique ID for this child process. This can be used later in + // a call to FromID() to get back to this object (this is used to avoid + // sending non-threadsafe pointers to other threads). + // + // This ID will be unique for all child processes, including workers, plugins, + // etc. It is generated by ChildProcessInfo. + virtual int GetID() const = 0; + + // Called to inform the render process host of a new "max page id" for a + // render view host. The render process host computes the largest page id + // across all render view hosts and uses the value when it needs to + // initialize a new renderer in place of the current one. + virtual void UpdateMaxPageID(int32 page_id) = 0; + + // Returns the listener for the routing id passed in. + virtual IPC::Channel::Listener* GetListenerByID(int routing_id) = 0; + + // Returns true iff channel_ has been set to non-NULL. Use this for checking + // if there is connection or not. Virtual for mocking out for tests. + virtual bool HasConnection() const = 0; + + // Call this to allow queueing of IPC messages that are sent before the + // process is launched. + virtual void EnableSendQueue() = 0; + + // Returns the renderer channel. + virtual IPC::ChannelProxy* GetChannel() = 0; + + virtual listeners_iterator ListenersIterator() = 0; + + // Try to shutdown the associated render process as fast as possible + virtual bool FastShutdownForPageCount(size_t count) = 0; + + // Update the max page ID and send the update to the renderer process as well + virtual void UpdateAndSendMaxPageID(int32 page_id) = 0; + + // TODO(ananta) + // Revisit whether the virtual functions declared from here on need to be + // part of the interface. + virtual void SetIgnoreInputEvents(bool ignore_input_events) = 0; + virtual bool IgnoreInputEvents() const = 0; + + // Used for refcounting, each holder of this object must Attach and Release + // just like it would for a COM object. This object should be allocated on + // the heap; when no listeners own it any more, it will delete itself. + virtual void Attach(IPC::Channel::Listener* listener, int routing_id) = 0; + + // See Attach() + virtual void Release(int listener_id) = 0; + + // Schedules the host for deletion and removes it from the all_hosts list. + virtual void Cleanup() = 0; + + // Listeners should call this when they've sent a "Close" message and + // they're waiting for a "Close_ACK", so that if the renderer process + // goes away we'll know that it was intentional rather than a crash. + virtual void ReportExpectingClose(int32 listener_id) = 0; + + // Track the count of pending views that are being swapped back in. Called + // by listeners to register and unregister pending views to prevent the + // process from exiting. + virtual void AddPendingView() = 0; + virtual void RemovePendingView() = 0; + + // Sets a flag indicating that the process can be abnormally terminated. + virtual void SetSuddenTerminationAllowed(bool allowed) = 0; + // Returns true if the process can be abnormally terminated. + virtual bool SuddenTerminationAllowed() const = 0; + + // Returns how long the child has been idle. The definition of idle + // depends on when a derived class calls mark_child_process_activity_time(). + // This is a rough indicator and its resolution should not be better than + // 10 milliseconds. + virtual base::TimeDelta GetChildProcessIdleTime() const = 0; + // Static management functions ----------------------------------------------- // Flag to run the renderer in process. This is primarily @@ -239,12 +216,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, // to a RenderProcess which is instantiated in the same process // with the Browser. All IPC between the Browser and the // Renderer is the same, it's just not crossing a process boundary. - static bool run_renderer_in_process() { - return run_renderer_in_process_; - } - static void set_run_renderer_in_process(bool value) { - run_renderer_in_process_ = value; - } + + static bool run_renderer_in_process(); + static void set_run_renderer_in_process(bool value); // Allows iteration over all the RenderProcessHosts in the browser. Note // that each host may not be active, and therefore may have NULL channels. @@ -271,67 +245,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Channel::Sender, // count. This is useful for unit testing process limit behaviors. // A value of zero means to use the default heuristic. static void SetMaxRendererProcessCountForTest(size_t count); - - protected: - // A proxy for our IPC::Channel that lives on the IO thread (see - // browser_process.h) - scoped_ptr<IPC::ChannelProxy> channel_; - - // The registered listeners. When this list is empty or all NULL, we should - // delete ourselves - IDMap<IPC::Channel::Listener> listeners_; - - // The maximum page ID we've ever seen from the renderer process. - int32 max_page_id_; - - // True if fast shutdown has been performed on this RPH. - bool fast_shutdown_started_; - - // True if we've posted a DeleteTask and will be deleted soon. - bool deleting_soon_; - - // The count of currently swapped out but pending RenderViews. We have - // started to swap these in, so the renderer process should not exit if - // this count is non-zero. - int32 pending_views_; - - private: - // The globally-unique identifier for this RPH. - int id_; - - content::BrowserContext* browser_context_; - - // set of listeners that expect the renderer process to close - std::set<int> listeners_expecting_close_; - - // True if the process can be shut down suddenly. If this is true, then we're - // sure that all the RenderViews in the process can be shutdown suddenly. If - // it's false, then specific RenderViews might still be allowed to be shutdown - // suddenly by checking their SuddenTerminationAllowed() flag. This can occur - // if one tab has an unload event listener but another tab in the same process - // doesn't. - bool sudden_termination_allowed_; - - // Set to true if we shouldn't send input events. We actually do the - // filtering for this at the render widget level. - bool ignore_input_events_; - - // See getter above. - static bool run_renderer_in_process_; - - // Records the last time we regarded the child process active. - base::TimeTicks child_process_activity_time_; - - DISALLOW_COPY_AND_ASSIGN(RenderProcessHost); }; -// Factory object for RenderProcessHosts. Using this factory allows tests to -// swap out a different one to use a TestRenderProcessHost. -class RenderProcessHostFactory { - public: - virtual ~RenderProcessHostFactory() {} - virtual RenderProcessHost* CreateRenderProcessHost( - content::BrowserContext* browser_context) const = 0; -}; +} // namespace content. + +#endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ -#endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ diff --git a/content/public/browser/render_process_host_factory.h b/content/public/browser/render_process_host_factory.h new file mode 100644 index 0000000..cd8767f --- /dev/null +++ b/content/public/browser/render_process_host_factory.h @@ -0,0 +1,30 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_FACTORY_H_ +#define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_FACTORY_H_ + +#include "base/basictypes.h" +#include "content/common/content_export.h" + +namespace content { +class BrowserContext; +class RenderProcessHost; +} + +namespace content { + +// Factory object for RenderProcessHosts. Using this factory allows tests to +// swap out a different one to use a TestRenderProcessHost. +class RenderProcessHostFactory { + public: + virtual ~RenderProcessHostFactory() {} + virtual RenderProcessHost* CreateRenderProcessHost( + content::BrowserContext* browser_context) const = 0; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_FACTORY_H_ + diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index 923b780..75f37fa 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -56,8 +56,8 @@ void ShellContentBrowserClient::RenderViewHostCreated( RenderViewHost* render_view_host) { } -void ShellContentBrowserClient::BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) { +void ShellContentBrowserClient::RenderProcessHostCreated( + RenderProcessHost* host) { } void ShellContentBrowserClient::PluginProcessHostCreated( diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index 1fde62a..ac4d73b 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -42,8 +42,8 @@ class ShellContentBrowserClient : public ContentBrowserClient TabContents* tab_contents) OVERRIDE; virtual void RenderViewHostCreated( RenderViewHost* render_view_host) OVERRIDE; - virtual void BrowserRenderProcessHostCreated( - BrowserRenderProcessHost* host) OVERRIDE; + virtual void RenderProcessHostCreated( + RenderProcessHost* host) OVERRIDE; virtual void PluginProcessHostCreated(PluginProcessHost* host) OVERRIDE; virtual WebUIFactory* GetWebUIFactory() OVERRIDE; virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, |