| OLD | NEW |
| 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/gpu/drm_thread_message_proxy.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_thread_message_proxy.h" |
| 6 | 6 |
| 7 #include "base/task_runner_util.h" |
| 7 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 9 #include "ipc/ipc_sender.h" | 10 #include "ipc/ipc_sender.h" |
| 10 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 11 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
| 12 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 11 #include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h" | 13 #include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h" |
| 12 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" | 14 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" |
| 13 | 15 |
| 14 namespace ui { | 16 namespace ui { |
| 15 | 17 |
| 16 DrmThreadMessageProxy::DrmThreadMessageProxy() : weak_ptr_factory_(this) {} | 18 DrmThreadMessageProxy::DrmThreadMessageProxy() : weak_ptr_factory_(this) {} |
| 17 | 19 |
| 18 DrmThreadMessageProxy::~DrmThreadMessageProxy() {} | 20 DrmThreadMessageProxy::~DrmThreadMessageProxy() {} |
| 19 | 21 |
| 20 void DrmThreadMessageProxy::SetDrmThread(DrmThread* thread) { | 22 void DrmThreadMessageProxy::SetDrmThread(DrmThread* thread) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 FROM_HERE, | 131 FROM_HERE, |
| 130 base::BindOnce(&DrmThread::RefreshNativeDisplays, | 132 base::BindOnce(&DrmThread::RefreshNativeDisplays, |
| 131 base::Unretained(drm_thread_), std::move(safe_callback))); | 133 base::Unretained(drm_thread_), std::move(safe_callback))); |
| 132 } | 134 } |
| 133 | 135 |
| 134 void DrmThreadMessageProxy::OnConfigureNativeDisplay( | 136 void DrmThreadMessageProxy::OnConfigureNativeDisplay( |
| 135 int64_t id, | 137 int64_t id, |
| 136 const DisplayMode_Params& mode, | 138 const DisplayMode_Params& mode, |
| 137 const gfx::Point& origin) { | 139 const gfx::Point& origin) { |
| 138 DCHECK(drm_thread_->IsRunning()); | 140 DCHECK(drm_thread_->IsRunning()); |
| 141 auto dmode = CreateDisplayModeFromParams(mode); |
| 139 auto callback = | 142 auto callback = |
| 140 base::BindOnce(&DrmThreadMessageProxy::OnConfigureNativeDisplayCallback, | 143 base::BindOnce(&DrmThreadMessageProxy::OnConfigureNativeDisplayCallback, |
| 141 weak_ptr_factory_.GetWeakPtr()); | 144 weak_ptr_factory_.GetWeakPtr()); |
| 142 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); | 145 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); |
| 143 drm_thread_->task_runner()->PostTask( | 146 drm_thread_->task_runner()->PostTask( |
| 144 FROM_HERE, base::BindOnce(&DrmThread::ConfigureNativeDisplay, | 147 FROM_HERE, |
| 145 base::Unretained(drm_thread_), id, mode, origin, | 148 base::BindOnce(&DrmThread::ConfigureNativeDisplay, |
| 146 std::move(safe_callback))); | 149 base::Unretained(drm_thread_), id, std::move(dmode), |
| 150 origin, std::move(safe_callback))); |
| 147 } | 151 } |
| 148 | 152 |
| 149 void DrmThreadMessageProxy::OnDisableNativeDisplay(int64_t id) { | 153 void DrmThreadMessageProxy::OnDisableNativeDisplay(int64_t id) { |
| 150 DCHECK(drm_thread_->IsRunning()); | 154 DCHECK(drm_thread_->IsRunning()); |
| 151 auto callback = | 155 auto callback = |
| 152 base::BindOnce(&DrmThreadMessageProxy::OnDisableNativeDisplayCallback, | 156 base::BindOnce(&DrmThreadMessageProxy::OnDisableNativeDisplayCallback, |
| 153 weak_ptr_factory_.GetWeakPtr()); | 157 weak_ptr_factory_.GetWeakPtr()); |
| 154 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); | 158 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); |
| 155 drm_thread_->task_runner()->PostTask( | 159 drm_thread_->task_runner()->PostTask( |
| 156 FROM_HERE, base::BindOnce(&DrmThread::DisableNativeDisplay, | 160 FROM_HERE, base::BindOnce(&DrmThread::DisableNativeDisplay, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 display::HDCPState state) const { | 274 display::HDCPState state) const { |
| 271 sender_->Send(new OzoneHostMsg_HDCPStateReceived(display_id, success, state)); | 275 sender_->Send(new OzoneHostMsg_HDCPStateReceived(display_id, success, state)); |
| 272 } | 276 } |
| 273 | 277 |
| 274 void DrmThreadMessageProxy::OnSetHDCPStateCallback(int64_t display_id, | 278 void DrmThreadMessageProxy::OnSetHDCPStateCallback(int64_t display_id, |
| 275 bool success) const { | 279 bool success) const { |
| 276 sender_->Send(new OzoneHostMsg_HDCPStateUpdated(display_id, success)); | 280 sender_->Send(new OzoneHostMsg_HDCPStateUpdated(display_id, success)); |
| 277 } | 281 } |
| 278 | 282 |
| 279 } // namespace ui | 283 } // namespace ui |
| OLD | NEW |