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

Side by Side Diff: ui/ozone/platform/drm/host/drm_overlay_candidates_host.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 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_candidates_host.h" 5 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "ui/gfx/geometry/rect_conversions.h" 11 #include "ui/gfx/geometry/rect_conversions.h"
12 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" 12 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
13 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" 13 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
14 #include "ui/ozone/platform/drm/host/drm_overlay_manager_core.h"
14 #include "ui/ozone/platform/drm/host/drm_window_host.h" 15 #include "ui/ozone/platform/drm/host/drm_window_host.h"
16 #include "ui/ozone/public/overlay_manager_ozone.h"
15 17
16 namespace ui { 18 namespace ui {
17 19
18 DrmOverlayCandidatesHost::DrmOverlayCandidatesHost( 20 DrmOverlayCandidatesHost::DrmOverlayCandidatesHost(
19 DrmGpuPlatformSupportHost* platform_support, 21 DrmOverlayManagerCore* manager_core,
20 DrmWindowHost* window) 22 gfx::AcceleratedWidget widget)
21 : sender_(new OverlayCandidatesIPC(platform_support, this)), 23 : overlay_manager_(manager_core), widget_(widget) {}
22 core_(new DrmOverlayCandidatesHostCore(sender_.get(), window)) {}
23 24
24 DrmOverlayCandidatesHost::~DrmOverlayCandidatesHost() { 25 DrmOverlayCandidatesHost::~DrmOverlayCandidatesHost() {
25 } 26 }
26 27
27 void DrmOverlayCandidatesHost::CheckOverlaySupport( 28 void DrmOverlayCandidatesHost::CheckOverlaySupport(
28 OverlaySurfaceCandidateList* candidates) { 29 OverlaySurfaceCandidateList* candidates) {
29 core_->CheckOverlaySupport(candidates); 30 overlay_manager_->CheckOverlaySupport(candidates, widget_);
30 } 31 }
31 32
32 void DrmOverlayCandidatesHost::OnChannelEstablished(
33 int host_id,
34 scoped_refptr<base::SingleThreadTaskRunner> send_runner,
35 const base::Callback<void(IPC::Message*)>& sender) {
36 core_->ResetCache();
37 }
38
39 void DrmOverlayCandidatesHost::OnChannelDestroyed(int host_id) {
40 }
41
42 bool DrmOverlayCandidatesHost::OnMessageReceived(const IPC::Message& message) {
43 bool handled = false;
44 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(DrmOverlayCandidatesHost, message, &handled)
45 IPC_MESSAGE_FORWARD(OzoneHostMsg_OverlayCapabilitiesReceived, this,
46 DrmOverlayCandidatesHost::OnOverlayResult)
47 IPC_END_MESSAGE_MAP()
48 return handled;
49 }
50
51 void DrmOverlayCandidatesHost::OnOverlayResult(
52 bool* handled,
53 gfx::AcceleratedWidget widget,
54 const std::vector<OverlayCheck_Params>& params) {
55 core_->GpuSentOverlayResult(handled, widget, params);
56 }
57
58 // TODO(rjkroege): There is a refactoring opportunity in the sender pattern.
59 DrmOverlayCandidatesHost::OverlayCandidatesIPC::OverlayCandidatesIPC(
60 DrmGpuPlatformSupportHost* platform_support,
61 DrmOverlayCandidatesHost* parent)
62 : platform_support_(platform_support), parent_(parent) {}
63
64 DrmOverlayCandidatesHost::OverlayCandidatesIPC::~OverlayCandidatesIPC() {}
65
66 void DrmOverlayCandidatesHost::OverlayCandidatesIPC::UnregisterHandler() {
67 platform_support_->UnregisterHandler(parent_);
68 }
69
70 void DrmOverlayCandidatesHost::OverlayCandidatesIPC::RegisterHandler() {
71 platform_support_->RegisterHandler(parent_);
72 }
73
74 bool DrmOverlayCandidatesHost::OverlayCandidatesIPC::IsConnected() {
75 return platform_support_->IsConnected();
76 }
77
78 bool DrmOverlayCandidatesHost::OverlayCandidatesIPC::CheckOverlayCapabilities(
79 gfx::AcceleratedWidget widget,
80 const std::vector<OverlayCheck_Params>& new_params) {
81 return platform_support_->Send(
82 new OzoneGpuMsg_CheckOverlayCapabilities(widget, new_params));
83 }
84 33
85 } // namespace ui 34 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698