Commit c85564ac authored by Luke Halliwell's avatar Luke Halliwell Committed by Commit Bot

[Chromecast] Remove CastContentBrowserClient::PreCreateThreads

Moved to CastBrowserMainParts, per the bug.

Bug: internal b/27811461
Test: none
Change-Id: Ic3fd8f7ed51473e8a61caff62c5caa762af03b84
Reviewed-on: https://chromium-review.googlesource.com/811286Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Luke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522320}
parent 2b55f23a
...@@ -70,6 +70,7 @@ cast_source_set("browser") { ...@@ -70,6 +70,7 @@ cast_source_set("browser") {
if (chromecast_branding == "public") { if (chromecast_branding == "public") {
sources += [ sources += [
"cast_browser_main_parts_simple.cc",
"cast_content_browser_client_simple.cc", "cast_content_browser_client_simple.cc",
"cast_network_delegate_simple.cc", "cast_network_delegate_simple.cc",
"pref_service_helper_simple.cc", "pref_service_helper_simple.cc",
......
...@@ -442,9 +442,6 @@ int CastBrowserMainParts::PreCreateThreads() { ...@@ -442,9 +442,6 @@ int CastBrowserMainParts::PreCreateThreads() {
command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kEnableFeatures),
command_line->GetSwitchValueASCII(switches::kDisableFeatures)); command_line->GetSwitchValueASCII(switches::kDisableFeatures));
// Hook for internal code
cast_browser_process_->browser_client()->PreCreateThreads();
#if defined(USE_AURA) #if defined(USE_AURA)
cast_browser_process_->SetCastScreen(base::WrapUnique(new CastScreen())); cast_browser_process_->SetCastScreen(base::WrapUnique(new CastScreen()));
DCHECK(!display::Screen::GetScreen()); DCHECK(!display::Screen::GetScreen());
......
...@@ -42,6 +42,12 @@ class URLRequestContextFactory; ...@@ -42,6 +42,12 @@ class URLRequestContextFactory;
class CastBrowserMainParts : public content::BrowserMainParts { class CastBrowserMainParts : public content::BrowserMainParts {
public: public:
// Creates an implementation of CastBrowserMainParts. Platform should
// link in an implementation as needed.
static std::unique_ptr<CastBrowserMainParts> Create(
const content::MainFunctionParams& parameters,
URLRequestContextFactory* url_request_context_factory);
// This class does not take ownership of |url_request_content_factory|. // This class does not take ownership of |url_request_content_factory|.
CastBrowserMainParts(const content::MainFunctionParams& parameters, CastBrowserMainParts(const content::MainFunctionParams& parameters,
URLRequestContextFactory* url_request_context_factory); URLRequestContextFactory* url_request_context_factory);
......
// Copyright 2017 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 "chromecast/browser/cast_browser_main_parts.h"
namespace chromecast {
namespace shell {
// static
std::unique_ptr<CastBrowserMainParts> CastBrowserMainParts::Create(
const content::MainFunctionParams& parameters,
URLRequestContextFactory* url_request_context_factory) {
return std::make_unique<CastBrowserMainParts>(parameters,
url_request_context_factory);
}
} // namespace shell
} // namespace chromecast
...@@ -182,8 +182,6 @@ void CastContentBrowserClient::AppendExtraCommandLineSwitches( ...@@ -182,8 +182,6 @@ void CastContentBrowserClient::AppendExtraCommandLineSwitches(
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
} }
void CastContentBrowserClient::PreCreateThreads() {}
std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService( std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
PrefService* pref_service, PrefService* pref_service,
...@@ -282,10 +280,14 @@ bool CastContentBrowserClient::EnableRemoteDebuggingImmediately() { ...@@ -282,10 +280,14 @@ bool CastContentBrowserClient::EnableRemoteDebuggingImmediately() {
content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) { const content::MainFunctionParams& parameters) {
DCHECK(!cast_browser_main_parts_); DCHECK(!cast_browser_main_parts_);
cast_browser_main_parts_ = auto main_parts = CastBrowserMainParts::Create(
new CastBrowserMainParts(parameters, url_request_context_factory_.get()); parameters, url_request_context_factory_.get());
cast_browser_main_parts_ = main_parts.get();
CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this); CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this);
return cast_browser_main_parts_;
// TODO(halliwell): would like to change CreateBrowserMainParts to return
// unique_ptr, then we don't have to release.
return main_parts.release();
} }
void CastContentBrowserClient::RenderProcessWillLaunch( void CastContentBrowserClient::RenderProcessWillLaunch(
......
...@@ -67,9 +67,6 @@ class CastContentBrowserClient : public content::ContentBrowserClient { ...@@ -67,9 +67,6 @@ class CastContentBrowserClient : public content::ContentBrowserClient {
// Appends extra command line arguments before launching a new process. // Appends extra command line arguments before launching a new process.
virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line); virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line);
// Hook for code to run before browser threads created.
virtual void PreCreateThreads();
// Creates and returns the CastService instance for the current process. // Creates and returns the CastService instance for the current process.
// Note: |request_context_getter| might be different than the main request // Note: |request_context_getter| might be different than the main request
// getter accessible via CastBrowserProcess. // getter accessible via CastBrowserProcess.
......
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