OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/dri/dri_gpu_platform_support.h" | 5 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (!handled) | 222 if (!handled) |
223 for (size_t i = 0; i < handlers_.size(); ++i) | 223 for (size_t i = 0; i < handlers_.size(); ++i) |
224 if (handlers_[i]->OnMessageReceived(message)) | 224 if (handlers_[i]->OnMessageReceived(message)) |
225 return true; | 225 return true; |
226 | 226 |
227 return false; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 void DriGpuPlatformSupport::OnCreateWindowDelegate( | 230 void DriGpuPlatformSupport::OnCreateWindowDelegate( |
231 gfx::AcceleratedWidget widget) { | 231 gfx::AcceleratedWidget widget) { |
232 // Due to how the GPU process starts up this IPC call may happen after the IPC | 232 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( |
233 // to create a surface. Since a surface wants to know the window associated | 233 widget, drm_, window_manager_, screen_manager_)); |
234 // with it, we create it ahead of time. So when this call happens we do not | 234 delegate->Initialize(); |
235 // create a delegate if it already exists. | 235 window_manager_->AddWindowDelegate(widget, delegate.Pass()); |
236 if (!window_manager_->HasWindowDelegate(widget)) { | |
237 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( | |
238 widget, drm_, window_manager_, screen_manager_)); | |
239 delegate->Initialize(); | |
240 window_manager_->AddWindowDelegate(widget, delegate.Pass()); | |
241 } | |
242 } | 236 } |
243 | 237 |
244 void DriGpuPlatformSupport::OnDestroyWindowDelegate( | 238 void DriGpuPlatformSupport::OnDestroyWindowDelegate( |
245 gfx::AcceleratedWidget widget) { | 239 gfx::AcceleratedWidget widget) { |
246 scoped_ptr<DriWindowDelegate> delegate = | 240 scoped_ptr<DriWindowDelegate> delegate = |
247 window_manager_->RemoveWindowDelegate(widget); | 241 window_manager_->RemoveWindowDelegate(widget); |
248 delegate->Shutdown(); | 242 delegate->Shutdown(); |
249 } | 243 } |
250 | 244 |
251 void DriGpuPlatformSupport::OnWindowBoundsChanged(gfx::AcceleratedWidget widget, | 245 void DriGpuPlatformSupport::OnWindowBoundsChanged(gfx::AcceleratedWidget widget, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 helper_thread_.Initialize(); | 361 helper_thread_.Initialize(); |
368 drm_->InitializeTaskRunner(helper_thread_.task_runner()); | 362 drm_->InitializeTaskRunner(helper_thread_.task_runner()); |
369 } | 363 } |
370 } | 364 } |
371 | 365 |
372 IPC::MessageFilter* DriGpuPlatformSupport::GetMessageFilter() { | 366 IPC::MessageFilter* DriGpuPlatformSupport::GetMessageFilter() { |
373 return filter_.get(); | 367 return filter_.get(); |
374 } | 368 } |
375 | 369 |
376 } // namespace ui | 370 } // namespace ui |
OLD | NEW |