0

[Chromecast] Remove protected fields from CastService.

Classes that derive from this can choose to store these pointers
in private members, initialized at construction.

Merge-With: eureka-internal/480348

Bug: Internal b/138199589
Test: Build internal chromecast binaries and tests
Change-Id: I84723d6d298c9453d43c92ffd9f05b136d774b43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518715
Auto-Submit: Simeon Anfinrud <sanfin@chromium.org>
Commit-Queue: Luke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: Luke Halliwell (slow) <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824179}
This commit is contained in:
Simeon Anfinrud
2020-11-04 22:20:58 +00:00
committed by Commit Bot
parent ba05b80cf4
commit d781c58a47
5 changed files with 9 additions and 27 deletions

@ -198,8 +198,7 @@ std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService(
PrefService* pref_service,
media::VideoPlaneController* video_plane_controller,
CastWindowManager* window_manager) {
return std::make_unique<CastServiceSimple>(browser_context, pref_service,
window_manager);
return std::make_unique<CastServiceSimple>(browser_context, window_manager);
}
media::VideoModeSwitcher* CastContentBrowserClient::GetVideoModeSwitcher() {

@ -40,10 +40,8 @@ GURL GetStartupURL() {
} // namespace
CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context,
PrefService* pref_service,
CastWindowManager* window_manager)
: CastService(browser_context, pref_service),
web_view_factory_(std::make_unique<CastWebViewFactory>(browser_context)),
: web_view_factory_(std::make_unique<CastWebViewFactory>(browser_context)),
web_service_(std::make_unique<CastWebService>(browser_context,
web_view_factory_.get(),
window_manager)) {

@ -14,6 +14,10 @@
#include "chromecast/service/cast_service.h"
#include "url/gurl.h"
namespace content {
class BrowserContext;
} // namespace content
namespace chromecast {
class CastWebService;
@ -25,7 +29,6 @@ namespace shell {
class CastServiceSimple : public CastService, public CastWebView::Delegate {
public:
CastServiceSimple(content::BrowserContext* browser_context,
PrefService* pref_service,
CastWindowManager* window_manager);
~CastServiceSimple() override;

@ -11,14 +11,8 @@
namespace chromecast {
CastService::CastService(
content::BrowserContext* browser_context,
PrefService* pref_service)
: browser_context_(browser_context),
pref_service_(pref_service),
stopped_(true),
thread_checker_(new base::ThreadChecker()) {
}
CastService::CastService()
: stopped_(true), thread_checker_(new base::ThreadChecker()) {}
CastService::~CastService() {
DCHECK(thread_checker_->CalledOnValidThread());

@ -10,16 +10,10 @@
#include "base/callback.h"
#include "base/macros.h"
class PrefService;
namespace base {
class ThreadChecker;
}
namespace content {
class BrowserContext;
}
namespace chromecast {
class CastService {
@ -38,8 +32,7 @@ class CastService {
virtual void AccessibilityStateChanged(bool enabled);
protected:
CastService(content::BrowserContext* browser_context,
PrefService* pref_service);
CastService();
// Implementation-specific initialization. Initialization of cast service's
// sub-components, and anything that requires IO operations should go here.
@ -60,12 +53,7 @@ class CastService {
// StartInternal() should be finalized here.
virtual void StopInternal() = 0;
content::BrowserContext* browser_context() const { return browser_context_; }
PrefService* pref_service() const { return pref_service_; }
private:
content::BrowserContext* const browser_context_;
PrefService* const pref_service_;
bool stopped_;
const std::unique_ptr<base::ThreadChecker> thread_checker_;