Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1743)

Unified Diff: ui/ozone/platform/drm/host/drm_overlay_manager.cc

Issue 1631073002: Relocate ozone gbm overlay config cache to manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased correctly Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/host/drm_overlay_manager.cc
diff --git a/ui/ozone/platform/drm/host/drm_overlay_manager.cc b/ui/ozone/platform/drm/host/drm_overlay_manager.cc
index ae0a755e3d5d83b8bf81c59ad57090fe859917a8..c699ac3a4f03ab9915e2479ac3426aa7fbea186f 100644
--- a/ui/ozone/platform/drm/host/drm_overlay_manager.cc
+++ b/ui/ozone/platform/drm/host/drm_overlay_manager.cc
@@ -4,34 +4,83 @@
#include "ui/ozone/platform/drm/host/drm_overlay_manager.h"
-#include "base/command_line.h"
#include "ui/gfx/geometry/rect_conversions.h"
+#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
+#include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
#include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h"
+#include "ui/ozone/platform/drm/host/drm_window_host.h"
#include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
#include "ui/ozone/public/overlay_candidates_ozone.h"
-#include "ui/ozone/public/ozone_switches.h"
namespace ui {
DrmOverlayManager::DrmOverlayManager(
DrmGpuPlatformSupportHost* platform_support_host,
- DrmWindowHostManager* manager)
- : platform_support_host_(platform_support_host), window_manager_(manager) {
- is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kOzoneTestSingleOverlaySupport);
-}
+ DrmWindowHostManager* window_manager)
+ : sender_(new OverlayCandidatesIPC(platform_support_host, this)),
+ core_(new DrmOverlayManagerCore(sender_.get(), window_manager)) {}
DrmOverlayManager::~DrmOverlayManager() {
}
scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::CreateOverlayCandidates(
gfx::AcceleratedWidget w) {
- if (!is_supported_)
- return nullptr;
- DrmWindowHost* window = window_manager_->GetWindow(w);
- DCHECK(window);
- return make_scoped_ptr(
- new DrmOverlayCandidatesHost(platform_support_host_, window));
+ return core_->CreateOverlayCandidates(w);
+}
+
+void DrmOverlayManager::OnChannelEstablished(
+ int host_id,
+ scoped_refptr<base::SingleThreadTaskRunner> send_runner,
+ const base::Callback<void(IPC::Message*)>& sender) {
+ core_->ResetCache();
+}
+
+void DrmOverlayManager::OnChannelDestroyed(int host_id) {}
+
+bool DrmOverlayManager::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(DrmOverlayManager, message)
+ IPC_MESSAGE_HANDLER(OzoneHostMsg_OverlayCapabilitiesReceived,
+ OnOverlayResult)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void DrmOverlayManager::ResetCache() {
+ core_->ResetCache();
+}
+
+void DrmOverlayManager::OnOverlayResult(
+ gfx::AcceleratedWidget widget,
+ const std::vector<OverlayCheck_Params>& params) {
+ core_->GpuSentOverlayResult(widget, params);
+}
+
+// TODO(rjkroege): There is a refactoring opportunity in the sender pattern.
+DrmOverlayManager::OverlayCandidatesIPC::OverlayCandidatesIPC(
+ DrmGpuPlatformSupportHost* platform_support,
+ DrmOverlayManager* parent)
+ : platform_support_(platform_support), parent_(parent) {}
+
+DrmOverlayManager::OverlayCandidatesIPC::~OverlayCandidatesIPC() {}
+
+void DrmOverlayManager::OverlayCandidatesIPC::UnregisterHandler() {
+ platform_support_->UnregisterHandler(parent_);
+}
+
+void DrmOverlayManager::OverlayCandidatesIPC::RegisterHandler() {
+ platform_support_->RegisterHandler(parent_);
+}
+
+bool DrmOverlayManager::OverlayCandidatesIPC::IsConnected() {
+ return platform_support_->IsConnected();
+}
+
+bool DrmOverlayManager::OverlayCandidatesIPC::CheckOverlayCapabilities(
+ gfx::AcceleratedWidget widget,
+ const std::vector<OverlayCheck_Params>& new_params) {
+ return platform_support_->Send(
+ new OzoneGpuMsg_CheckOverlayCapabilities(widget, new_params));
}
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/host/drm_overlay_manager.h ('k') | ui/ozone/platform/drm/host/drm_overlay_manager_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698