diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 19:31:57 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 19:31:57 +0000 |
commit | b4e74ee7fa50d5880f6cfdb6e2d10c8e8bb98cc1 (patch) | |
tree | 40c6afa656bd48496d696790e9d47a4a7df4b315 /content/shell | |
parent | 0a424afc9c94380ecd80967be73cfb684b6ae3f4 (diff) | |
download | chromium_src-b4e74ee7fa50d5880f6cfdb6e2d10c8e8bb98cc1.zip chromium_src-b4e74ee7fa50d5880f6cfdb6e2d10c8e8bb98cc1.tar.gz chromium_src-b4e74ee7fa50d5880f6cfdb6e2d10c8e8bb98cc1.tar.bz2 |
Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a few benefits:
-avoid having each embedder know when to create/destruct these objects, as well as contained objects (i.e. those related to downloads)
-avoid having to tell embedders about specifics of BrowserThread startup/shutdown
-move ResourceDispatcherHost's getter to content where it belongs
Some code (extensions+promos) used the fact that RDH is NULL in unittests as a signal to not use the utility process. I've switches those unittests to set a flag on the objects instead.
I've taken out the DnsParallelism field trial (not used anymore, confirmed with jar) as it was the only thing that caused MetricsService to depend on IOThread initialization, which also depended on MetricsService (through FieldTrials). This two-sided dependency always annoyed me and made the code hard to restructure.
BUG=98716
Review URL: http://codereview.chromium.org/9150016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/shell_browser_main.cc | 22 | ||||
-rw-r--r-- | content/shell/shell_browser_main.h | 8 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.cc | 3 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.h | 2 |
4 files changed, 2 insertions, 33 deletions
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index 24d7149..311b6a0 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -13,7 +13,6 @@ #include "content/browser/download/download_file_manager.h" #include "content/browser/download/save_file_manager.h" #include "content/browser/plugin_service_impl.h" -#include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/shell/shell.h" #include "content/shell/shell_browser_context.h" #include "content/shell/shell_content_browser_client.h" @@ -48,7 +47,6 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { Shell::PlatformInitialize(); net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider); - PluginService::GetInstance()->Init(); Shell::CreateNewWindow(browser_context_.get(), GetStartupURL(), @@ -59,32 +57,12 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { void ShellBrowserMainParts::PostMainMessageLoopRun() { browser_context_.reset(); - - resource_dispatcher_host_->download_file_manager()->Shutdown(); - resource_dispatcher_host_->save_file_manager()->Shutdown(); - resource_dispatcher_host_->Shutdown(); -} - -void ShellBrowserMainParts::PreStopThread(BrowserThread::ID id) { - if (id == BrowserThread::WEBKIT_DEPRECATED) { - resource_dispatcher_host_.reset(); - } } bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { return false; } -ResourceDispatcherHost* ShellBrowserMainParts::GetResourceDispatcherHost() { - if (!resource_dispatcher_host_.get()) { - ResourceQueue::DelegateSet resource_queue_delegates; - resource_dispatcher_host_.reset( - new ResourceDispatcherHost(resource_queue_delegates)); - resource_dispatcher_host_->Initialize(); - } - return resource_dispatcher_host_.get(); -} - ui::Clipboard* ShellBrowserMainParts::GetClipboard() { if (!clipboard_.get()) clipboard_.reset(new ui::Clipboard()); diff --git a/content/shell/shell_browser_main.h b/content/shell/shell_browser_main.h index e842e21..2451761 100644 --- a/content/shell/shell_browser_main.h +++ b/content/shell/shell_browser_main.h @@ -10,8 +10,6 @@ #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_main_parts.h" -class ResourceDispatcherHost; - namespace base { class Thread; } @@ -36,22 +34,16 @@ class ShellBrowserMainParts : public BrowserMainParts { virtual void ToolkitInitialized() OVERRIDE {} virtual void PostMainMessageLoopStart() OVERRIDE {} virtual void PreCreateThreads() OVERRIDE {} - virtual void PreStartThread(BrowserThread::ID id) OVERRIDE {} - virtual void PostStartThread(BrowserThread::ID id) OVERRIDE {} virtual void PreMainMessageLoopRun() OVERRIDE; virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; virtual void PostMainMessageLoopRun() OVERRIDE; - virtual void PreStopThread(BrowserThread::ID id) OVERRIDE; - virtual void PostStopThread(BrowserThread::ID) OVERRIDE {} virtual void PostDestroyThreads() OVERRIDE {} - ResourceDispatcherHost* GetResourceDispatcherHost(); ui::Clipboard* GetClipboard(); private: scoped_ptr<ShellBrowserContext> browser_context_; - scoped_ptr<ResourceDispatcherHost> resource_dispatcher_host_; scoped_ptr<ui::Clipboard> clipboard_; DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index 73e8a5c..904e9ff 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -245,8 +245,7 @@ std::string ShellContentBrowserClient::GetWorkerProcessTitle( return std::string(); } -ResourceDispatcherHost* ShellContentBrowserClient::GetResourceDispatcherHost() { - return shell_browser_main_parts_->GetResourceDispatcherHost(); +void ShellContentBrowserClient::ResourceDispatcherHostCreated() { } ui::Clipboard* ShellContentBrowserClient::GetClipboard() { diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index 44ee7c7..a81c445 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -138,7 +138,7 @@ class ShellContentBrowserClient : public ContentBrowserClient int render_process_id) OVERRIDE; virtual std::string GetWorkerProcessTitle( const GURL& url, const content::ResourceContext& context) OVERRIDE; - virtual ResourceDispatcherHost* GetResourceDispatcherHost() OVERRIDE; + virtual void ResourceDispatcherHostCreated() OVERRIDE; virtual ui::Clipboard* GetClipboard() OVERRIDE; virtual MHTMLGenerationManager* GetMHTMLGenerationManager() OVERRIDE; virtual net::NetLog* GetNetLog() OVERRIDE; |