Commit d9116474 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

content: Remove the "empty" content clients.

These don't appear to be necessary: almost all clients return non-null
pointers from their CreateContent*Client functions, so we can use the
content clients directly. The one exception is the chromecast utility
client whose use of that functionality seems unintentional.

Bug: 855193
Change-Id: I9b835de11dfe37799b30bba7921513438a0d5a9e
Reviewed-on: https://chromium-review.googlesource.com/1157659Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579831}
parent 20f64257
...@@ -9,7 +9,7 @@ namespace shell { ...@@ -9,7 +9,7 @@ namespace shell {
// static // static
std::unique_ptr<CastContentUtilityClient> CastContentUtilityClient::Create() { std::unique_ptr<CastContentUtilityClient> CastContentUtilityClient::Create() {
return std::unique_ptr<CastContentUtilityClient>(); return std::make_unique<CastContentUtilityClient>();
} }
} // namespace shell } // namespace shell
......
...@@ -434,57 +434,30 @@ bool IsRootProcess() { ...@@ -434,57 +434,30 @@ bool IsRootProcess() {
} // namespace } // namespace
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
base::LazyInstance<ContentBrowserClient>::DestructorAtExit
g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER;
#endif // !CHROME_MULTIPLE_DLL_CHILD
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
base::LazyInstance<ContentGpuClient>::DestructorAtExit
g_empty_content_gpu_client = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<ContentRendererClient>::DestructorAtExit
g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<ContentUtilityClient>::DestructorAtExit
g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER;
#endif // !CHROME_MULTIPLE_DLL_BROWSER
class ContentClientInitializer { class ContentClientInitializer {
public: public:
static void Set(const std::string& process_type, static void Set(const std::string& process_type,
ContentMainDelegate* delegate) { ContentMainDelegate* delegate) {
ContentClient* content_client = GetContentClient(); ContentClient* content_client = GetContentClient();
#if !defined(CHROME_MULTIPLE_DLL_CHILD) #if !defined(CHROME_MULTIPLE_DLL_CHILD)
if (process_type.empty()) { if (process_type.empty())
content_client->browser_ = delegate->CreateContentBrowserClient(); content_client->browser_ = delegate->CreateContentBrowserClient();
if (!content_client->browser_)
content_client->browser_ = &g_empty_content_browser_client.Get();
}
#endif // !CHROME_MULTIPLE_DLL_CHILD #endif // !CHROME_MULTIPLE_DLL_CHILD
#if !defined(CHROME_MULTIPLE_DLL_BROWSER) #if !defined(CHROME_MULTIPLE_DLL_BROWSER)
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
if (process_type == switches::kGpuProcess || if (process_type == switches::kGpuProcess ||
cmd->HasSwitch(switches::kSingleProcess) || cmd->HasSwitch(switches::kSingleProcess) ||
(process_type.empty() && cmd->HasSwitch(switches::kInProcessGPU))) { (process_type.empty() && cmd->HasSwitch(switches::kInProcessGPU)))
content_client->gpu_ = delegate->CreateContentGpuClient(); content_client->gpu_ = delegate->CreateContentGpuClient();
if (!content_client->gpu_)
content_client->gpu_ = &g_empty_content_gpu_client.Get();
}
if (process_type == switches::kRendererProcess || if (process_type == switches::kRendererProcess ||
cmd->HasSwitch(switches::kSingleProcess)) { cmd->HasSwitch(switches::kSingleProcess))
content_client->renderer_ = delegate->CreateContentRendererClient(); content_client->renderer_ = delegate->CreateContentRendererClient();
if (!content_client->renderer_)
content_client->renderer_ = &g_empty_content_renderer_client.Get();
}
if (process_type == switches::kUtilityProcess || if (process_type == switches::kUtilityProcess ||
cmd->HasSwitch(switches::kSingleProcess)) { cmd->HasSwitch(switches::kSingleProcess))
content_client->utility_ = delegate->CreateContentUtilityClient(); content_client->utility_ = delegate->CreateContentUtilityClient();
// TODO(scottmg): http://crbug.com/237249 Should be in _child.
if (!content_client->utility_)
content_client->utility_ = &g_empty_content_utility_client.Get();
}
#endif // !CHROME_MULTIPLE_DLL_BROWSER #endif // !CHROME_MULTIPLE_DLL_BROWSER
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment