diff options
author | achaulk <achaulk@chromium.org> | 2015-06-03 14:11:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-03 21:12:07 +0000 |
commit | e33faae1be4ec394528c0f703639e30c4e0bcd7e (patch) | |
tree | 4e9abd9404307497a2eb6402251fd305805896ba | |
parent | 0cd8bc4113543b557f48462d95f35441434e0ffe (diff) | |
download | chromium_src-e33faae1be4ec394528c0f703639e30c4e0bcd7e.zip chromium_src-e33faae1be4ec394528c0f703639e30c4e0bcd7e.tar.gz chromium_src-e33faae1be4ec394528c0f703639e30c4e0bcd7e.tar.bz2 |
Change ownership of OverlayCandidatesOzone object to compositor
We're going to keep per-compositor state in each object now, so sharing
a single object isn't going to work.
Review URL: https://codereview.chromium.org/1152363003
Cr-Commit-Position: refs/heads/master@{#332683}
11 files changed, 28 insertions, 25 deletions
diff --git a/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.cc b/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.cc index a646ac9..7a3c70d 100644 --- a/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.cc +++ b/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.cc @@ -30,9 +30,9 @@ static ui::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( BrowserCompositorOverlayCandidateValidatorOzone:: BrowserCompositorOverlayCandidateValidatorOzone( gfx::AcceleratedWidget widget, - ui::OverlayCandidatesOzone* overlay_candidates) + scoped_ptr<ui::OverlayCandidatesOzone> overlay_candidates) : widget_(widget), - overlay_candidates_(overlay_candidates), + overlay_candidates_(overlay_candidates.Pass()), software_mirror_active_(false) { } diff --git a/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.h b/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.h index 744d864..304daa4 100644 --- a/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.h +++ b/content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.h @@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_COMPOSITOR_OVERLAY_CANDIDATE_VALIDATOR_OZONE_H_ #define CONTENT_BROWSER_COMPOSITOR_OVERLAY_CANDIDATE_VALIDATOR_OZONE_H_ +#include "base/memory/scoped_ptr.h" #include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h" #include "ui/gfx/native_widget_types.h" @@ -19,7 +20,7 @@ class CONTENT_EXPORT BrowserCompositorOverlayCandidateValidatorOzone public: BrowserCompositorOverlayCandidateValidatorOzone( gfx::AcceleratedWidget widget, - ui::OverlayCandidatesOzone* overlay_candidates); + scoped_ptr<ui::OverlayCandidatesOzone> overlay_candidates); ~BrowserCompositorOverlayCandidateValidatorOzone() override; // cc::OverlayCandidateValidator implementation. @@ -30,7 +31,7 @@ class CONTENT_EXPORT BrowserCompositorOverlayCandidateValidatorOzone private: gfx::AcceleratedWidget widget_; - ui::OverlayCandidatesOzone* overlay_candidates_; + scoped_ptr<ui::OverlayCandidatesOzone> overlay_candidates_; bool software_mirror_active_; DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOverlayCandidateValidatorOzone); diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index ec1a28b..68ee72c 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -56,6 +56,7 @@ #elif defined(USE_OZONE) #include "content/browser/compositor/browser_compositor_overlay_candidate_validator_ozone.h" #include "content/browser/compositor/software_output_device_ozone.h" +#include "ui/ozone/public/overlay_candidates_ozone.h" #include "ui/ozone/public/overlay_manager_ozone.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/ozone_switches.h" @@ -161,17 +162,17 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice( scoped_ptr<BrowserCompositorOverlayCandidateValidator> CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { #if defined(USE_OZONE) - ui::OverlayCandidatesOzone* overlay_candidates = + scoped_ptr<ui::OverlayCandidatesOzone> overlay_candidates = ui::OzonePlatform::GetInstance() ->GetOverlayManager() - ->GetOverlayCandidates(widget); + ->CreateOverlayCandidates(widget); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (overlay_candidates && (command_line->HasSwitch(switches::kEnableHardwareOverlays) || command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( new BrowserCompositorOverlayCandidateValidatorOzone( - widget, overlay_candidates)); + widget, overlay_candidates.Pass())); } #endif return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc index 9960484..a80b4fb 100644 --- a/content/browser/compositor/reflector_impl_unittest.cc +++ b/content/browser/compositor/reflector_impl_unittest.cc @@ -62,7 +62,8 @@ CreateTestValidatorOzone() { #if defined(USE_OZONE) return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( new BrowserCompositorOverlayCandidateValidatorOzone( - 0, new TestOverlayCandidatesOzone())); + 0, scoped_ptr<ui::OverlayCandidatesOzone>( + new TestOverlayCandidatesOzone()))); #else return nullptr; #endif // defined(USE_OZONE) diff --git a/ui/ozone/common/stub_overlay_manager.cc b/ui/ozone/common/stub_overlay_manager.cc index d39d4bf..45f8a5f 100644 --- a/ui/ozone/common/stub_overlay_manager.cc +++ b/ui/ozone/common/stub_overlay_manager.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "ui/ozone/common/stub_overlay_manager.h" +#include "ui/ozone/public/overlay_candidates_ozone.h" namespace ui { @@ -12,7 +13,7 @@ StubOverlayManager::StubOverlayManager() { StubOverlayManager::~StubOverlayManager() { } -OverlayCandidatesOzone* StubOverlayManager::GetOverlayCandidates( +scoped_ptr<OverlayCandidatesOzone> StubOverlayManager::CreateOverlayCandidates( gfx::AcceleratedWidget w) { return nullptr; } diff --git a/ui/ozone/common/stub_overlay_manager.h b/ui/ozone/common/stub_overlay_manager.h index ae1610a..ba72ba0 100644 --- a/ui/ozone/common/stub_overlay_manager.h +++ b/ui/ozone/common/stub_overlay_manager.h @@ -15,7 +15,7 @@ class StubOverlayManager : public OverlayManagerOzone { ~StubOverlayManager() override; // OverlayManagerOzone: - OverlayCandidatesOzone* GetOverlayCandidates( + scoped_ptr<OverlayCandidatesOzone> CreateOverlayCandidates( gfx::AcceleratedWidget w) override; bool CanShowPrimaryPlaneAsOverlay() override; diff --git a/ui/ozone/platform/cast/overlay_manager_cast.cc b/ui/ozone/platform/cast/overlay_manager_cast.cc index 28756e2..cb7d641 100644 --- a/ui/ozone/platform/cast/overlay_manager_cast.cc +++ b/ui/ozone/platform/cast/overlay_manager_cast.cc @@ -65,16 +65,15 @@ class OverlayCandidatesCast : public OverlayCandidatesOzone { } // namespace -OverlayManagerCast::OverlayManagerCast() - : candidates_(new OverlayCandidatesCast()) { +OverlayManagerCast::OverlayManagerCast() { } OverlayManagerCast::~OverlayManagerCast() { } -OverlayCandidatesOzone* OverlayManagerCast::GetOverlayCandidates( +scoped_ptr<OverlayCandidatesOzone> OverlayManagerCast::CreateOverlayCandidates( gfx::AcceleratedWidget w) { - return candidates_.get(); + return make_scoped_ptr(new OverlayCandidatesCast()); } bool OverlayManagerCast::CanShowPrimaryPlaneAsOverlay() { diff --git a/ui/ozone/platform/cast/overlay_manager_cast.h b/ui/ozone/platform/cast/overlay_manager_cast.h index 5cc4186..3eb6a81 100644 --- a/ui/ozone/platform/cast/overlay_manager_cast.h +++ b/ui/ozone/platform/cast/overlay_manager_cast.h @@ -16,12 +16,11 @@ class OverlayManagerCast : public OverlayManagerOzone { ~OverlayManagerCast() override; // OverlayManagerOzone: - OverlayCandidatesOzone* GetOverlayCandidates( + scoped_ptr<OverlayCandidatesOzone> CreateOverlayCandidates( gfx::AcceleratedWidget w) override; bool CanShowPrimaryPlaneAsOverlay() override; private: - scoped_ptr<OverlayCandidatesOzone> candidates_; DISALLOW_COPY_AND_ASSIGN(OverlayManagerCast); }; diff --git a/ui/ozone/platform/drm/host/drm_overlay_manager.cc b/ui/ozone/platform/drm/host/drm_overlay_manager.cc index 747c438..7143001 100644 --- a/ui/ozone/platform/drm/host/drm_overlay_manager.cc +++ b/ui/ozone/platform/drm/host/drm_overlay_manager.cc @@ -59,17 +59,18 @@ class SingleOverlay : public OverlayCandidatesOzone { DrmOverlayManager::DrmOverlayManager(bool allow_surfaceless) : allow_surfaceless_(allow_surfaceless) { - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kOzoneTestSingleOverlaySupport)) - candidates_ = make_scoped_ptr(new SingleOverlay()); + is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kOzoneTestSingleOverlaySupport); } DrmOverlayManager::~DrmOverlayManager() { } -OverlayCandidatesOzone* DrmOverlayManager::GetOverlayCandidates( +scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::CreateOverlayCandidates( gfx::AcceleratedWidget w) { - return candidates_.get(); + if (!is_supported_) + return nullptr; + return make_scoped_ptr(new SingleOverlay()); } bool DrmOverlayManager::CanShowPrimaryPlaneAsOverlay() { diff --git a/ui/ozone/platform/drm/host/drm_overlay_manager.h b/ui/ozone/platform/drm/host/drm_overlay_manager.h index e02ee30..91bdd51 100644 --- a/ui/ozone/platform/drm/host/drm_overlay_manager.h +++ b/ui/ozone/platform/drm/host/drm_overlay_manager.h @@ -16,14 +16,13 @@ class DrmOverlayManager : public OverlayManagerOzone { ~DrmOverlayManager() override; // OverlayManagerOzone: - OverlayCandidatesOzone* GetOverlayCandidates( + scoped_ptr<OverlayCandidatesOzone> CreateOverlayCandidates( gfx::AcceleratedWidget w) override; bool CanShowPrimaryPlaneAsOverlay() override; private: bool allow_surfaceless_; - - scoped_ptr<OverlayCandidatesOzone> candidates_; + bool is_supported_; DISALLOW_COPY_AND_ASSIGN(DrmOverlayManager); }; diff --git a/ui/ozone/public/overlay_manager_ozone.h b/ui/ozone/public/overlay_manager_ozone.h index 58fe9c3..5e8d94f 100644 --- a/ui/ozone/public/overlay_manager_ozone.h +++ b/ui/ozone/public/overlay_manager_ozone.h @@ -5,6 +5,7 @@ #ifndef UI_OZONE_PUBLIC_OVERLAY_MANAGER_OZONE_H_ #define UI_OZONE_PUBLIC_OVERLAY_MANAGER_OZONE_H_ +#include "base/memory/scoped_ptr.h" #include "ui/gfx/native_widget_types.h" namespace ui { @@ -18,7 +19,7 @@ class OverlayManagerOzone { virtual ~OverlayManagerOzone() {} // Get the hal struct to check for overlay support. - virtual OverlayCandidatesOzone* GetOverlayCandidates( + virtual scoped_ptr<OverlayCandidatesOzone> CreateOverlayCandidates( gfx::AcceleratedWidget w) = 0; // Returns true if overlays can be shown at z-index 0, replacing the main |