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

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

Issue 2820463002: gpu: Completely remove GpuProcessHostUIShim. (Closed)
Patch Set: . Created 3 years, 8 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_gpu_platform_support_host.cc
diff --git a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
index c955cb23b734e3881e6a50d69a8da0c98aae1ce9..01920a85e24de42676fd27f8a98e82cb1a362415 100644
--- a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
+++ b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
@@ -82,7 +82,7 @@ void CursorIPC::Send(IPC::Message* message) {
} // namespace
DrmGpuPlatformSupportHost::DrmGpuPlatformSupportHost(DrmCursor* cursor)
- : cursor_(cursor) {}
+ : cursor_(cursor), weak_ptr_factory_(this) {}
DrmGpuPlatformSupportHost::~DrmGpuPlatformSupportHost() {}
@@ -105,31 +105,23 @@ bool DrmGpuPlatformSupportHost::IsConnected() {
void DrmGpuPlatformSupportHost::OnGpuProcessLaunched(
int host_id,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> send_runner,
const base::Callback<void(IPC::Message*)>& send_callback) {
+ DCHECK(!ui_runner->BelongsToCurrentThread());
+ ui_runner_ = std::move(ui_runner);
TRACE_EVENT1("drm", "DrmGpuPlatformSupportHost::OnGpuProcessLaunched",
"host_id", host_id);
host_id_ = host_id;
- send_runner_ = send_runner;
+ send_runner_ = std::move(send_runner);
send_callback_ = send_callback;
for (GpuThreadObserver& observer : gpu_thread_observers_)
observer.OnGpuProcessLaunched();
-}
-
-void DrmGpuPlatformSupportHost::OnChannelEstablished() {
- TRACE_EVENT0("drm", "DrmGpuPlatformSupportHost::OnChannelEstablished");
- channel_established_ = true;
-
- for (GpuThreadObserver& observer : gpu_thread_observers_)
- observer.OnGpuThreadReady();
- // The cursor is special since it will process input events on the IO thread
- // and can by-pass the UI thread. This means that we need to special case it
- // and notify it after all other observers/handlers are notified such that the
- // (windowing) state on the GPU can be initialized before the cursor is
- // allowed to IPC messages (which are targeted to a specific window).
- cursor_->SetDrmCursorProxy(new CursorIPC(send_runner_, send_callback_));
+ ui_runner_->PostTask(
+ FROM_HERE, base::Bind(&DrmGpuPlatformSupportHost::OnChannelEstablished,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) {
@@ -176,6 +168,21 @@ void DrmGpuPlatformSupportHost::UnRegisterHandlerForDrmDisplayHostManager() {
display_manager_ = nullptr;
}
+void DrmGpuPlatformSupportHost::OnChannelEstablished() {
+ TRACE_EVENT0("drm", "DrmGpuPlatformSupportHost::OnChannelEstablished");
+ channel_established_ = true;
+
+ for (GpuThreadObserver& observer : gpu_thread_observers_)
+ observer.OnGpuThreadReady();
+
+ // The cursor is special since it will process input events on the IO thread
+ // and can by-pass the UI thread. This means that we need to special case it
+ // and notify it after all other observers/handlers are notified such that the
+ // (windowing) state on the GPU can be initialized before the cursor is
+ // allowed to IPC messages (which are targeted to a specific window).
+ cursor_->SetDrmCursorProxy(new CursorIPC(send_runner_, send_callback_));
+}
+
bool DrmGpuPlatformSupportHost::OnMessageReceivedForDrmDisplayHostManager(
const IPC::Message& message) {
bool handled = true;
« no previous file with comments | « ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h ('k') | ui/ozone/public/gpu_platform_support_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698