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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" 5 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h"
6 6
7 #include "base/command_line.h"
8 #include "ui/gfx/geometry/rect_conversions.h" 7 #include "ui/gfx/geometry/rect_conversions.h"
8 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
9 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
9 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h" 10 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h"
11 #include "ui/ozone/platform/drm/host/drm_window_host.h"
10 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" 12 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
11 #include "ui/ozone/public/overlay_candidates_ozone.h" 13 #include "ui/ozone/public/overlay_candidates_ozone.h"
12 #include "ui/ozone/public/ozone_switches.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 DrmOverlayManager::DrmOverlayManager( 17 DrmOverlayManager::DrmOverlayManager(
17 DrmGpuPlatformSupportHost* platform_support_host, 18 DrmGpuPlatformSupportHost* platform_support_host,
18 DrmWindowHostManager* manager) 19 DrmWindowHostManager* window_manager)
19 : platform_support_host_(platform_support_host), window_manager_(manager) { 20 : sender_(new OverlayCandidatesIPC(platform_support_host, this)),
20 is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 21 core_(new DrmOverlayManagerCore(sender_.get(), window_manager)) {}
21 switches::kOzoneTestSingleOverlaySupport);
22 }
23 22
24 DrmOverlayManager::~DrmOverlayManager() { 23 DrmOverlayManager::~DrmOverlayManager() {
25 } 24 }
26 25
27 scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::CreateOverlayCandidates( 26 scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::CreateOverlayCandidates(
28 gfx::AcceleratedWidget w) { 27 gfx::AcceleratedWidget w) {
29 if (!is_supported_) 28 return core_->CreateOverlayCandidates(w);
30 return nullptr; 29 }
31 DrmWindowHost* window = window_manager_->GetWindow(w); 30
32 DCHECK(window); 31 void DrmOverlayManager::OnChannelEstablished(
33 return make_scoped_ptr( 32 int host_id,
34 new DrmOverlayCandidatesHost(platform_support_host_, window)); 33 scoped_refptr<base::SingleThreadTaskRunner> send_runner,
34 const base::Callback<void(IPC::Message*)>& sender) {
35 core_->ResetCache();
36 }
37
38 void DrmOverlayManager::OnChannelDestroyed(int host_id) {}
39
40 bool DrmOverlayManager::OnMessageReceived(const IPC::Message& message) {
41 bool handled = true;
42 IPC_BEGIN_MESSAGE_MAP(DrmOverlayManager, message)
43 IPC_MESSAGE_HANDLER(OzoneHostMsg_OverlayCapabilitiesReceived,
44 OnOverlayResult)
45 IPC_END_MESSAGE_MAP()
46 return handled;
47 }
48
49 void DrmOverlayManager::ResetCache() {
50 core_->ResetCache();
51 }
52
53 void DrmOverlayManager::OnOverlayResult(
54 gfx::AcceleratedWidget widget,
55 const std::vector<OverlayCheck_Params>& params) {
56 core_->GpuSentOverlayResult(widget, params);
57 }
58
59 // TODO(rjkroege): There is a refactoring opportunity in the sender pattern.
60 DrmOverlayManager::OverlayCandidatesIPC::OverlayCandidatesIPC(
61 DrmGpuPlatformSupportHost* platform_support,
62 DrmOverlayManager* parent)
63 : platform_support_(platform_support), parent_(parent) {}
64
65 DrmOverlayManager::OverlayCandidatesIPC::~OverlayCandidatesIPC() {}
66
67 void DrmOverlayManager::OverlayCandidatesIPC::UnregisterHandler() {
68 platform_support_->UnregisterHandler(parent_);
69 }
70
71 void DrmOverlayManager::OverlayCandidatesIPC::RegisterHandler() {
72 platform_support_->RegisterHandler(parent_);
73 }
74
75 bool DrmOverlayManager::OverlayCandidatesIPC::IsConnected() {
76 return platform_support_->IsConnected();
77 }
78
79 bool DrmOverlayManager::OverlayCandidatesIPC::CheckOverlayCapabilities(
80 gfx::AcceleratedWidget widget,
81 const std::vector<OverlayCheck_Params>& new_params) {
82 return platform_support_->Send(
83 new OzoneGpuMsg_CheckOverlayCapabilities(widget, new_params));
35 } 84 }
36 85
37 } // namespace ui 86 } // namespace ui
OLDNEW
« 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