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

Side by Side Diff: ui/ozone/platform/dri/gpu_platform_support_gbm.cc

Issue 469343003: [Ozone-GBM] Pumb DriWindowDelegate throughout the platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest && rebase Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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/gpu_platform_support_gbm.h" 5 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h"
6 6
7 #include "ipc/ipc_message_macros.h" 7 #include "ipc/ipc_message_macros.h"
8 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" 8 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
9 #include "ui/ozone/platform/dri/dri_surface_factory.h" 9 #include "ui/ozone/platform/dri/dri_surface_factory.h"
10 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" 10 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void GpuPlatformSupportGbm::OnCreateWindowDelegate( 59 void GpuPlatformSupportGbm::OnCreateWindowDelegate(
60 gfx::AcceleratedWidget widget) { 60 gfx::AcceleratedWidget widget) {
61 // Due to how the GPU process starts up this IPC call may happen after the IPC 61 // Due to how the GPU process starts up this IPC call may happen after the IPC
62 // to create a surface. Since a surface wants to know the window associated 62 // to create a surface. Since a surface wants to know the window associated
63 // with it, we create it ahead of time. So when this call happens we do not 63 // with it, we create it ahead of time. So when this call happens we do not
64 // create a delegate if it already exists. 64 // create a delegate if it already exists.
65 if (!window_manager_->HasWindowDelegate(widget)) { 65 if (!window_manager_->HasWindowDelegate(widget)) {
66 scoped_ptr<DriWindowDelegate> delegate( 66 scoped_ptr<DriWindowDelegate> delegate(
67 new DriWindowDelegateImpl(widget, screen_manager_)); 67 new DriWindowDelegateImpl(widget, screen_manager_));
68 delegate->Initialize(); 68 delegate->Initialize();
69 window_manager_->AddWindowDelegate(widget, delegate.get()); 69 window_manager_->AddWindowDelegate(widget, delegate.Pass());
70
71 std::pair<WidgetToWindowDelegateMap::iterator, bool> result =
72 window_delegate_owner_.add(widget, delegate.Pass());
73 DCHECK(result.second) << "Delegate already added.";
74 } 70 }
75 } 71 }
76 72
77 void GpuPlatformSupportGbm::OnDestroyWindowDelegate( 73 void GpuPlatformSupportGbm::OnDestroyWindowDelegate(
78 gfx::AcceleratedWidget widget) { 74 gfx::AcceleratedWidget widget) {
79 scoped_ptr<DriWindowDelegate> delegate = 75 scoped_ptr<DriWindowDelegate> delegate =
80 window_delegate_owner_.take_and_erase(widget); 76 window_manager_->RemoveWindowDelegate(widget);
81 DCHECK(delegate) << "Attempting to remove non-existing delegate.";
82
83 window_manager_->RemoveWindowDelegate(widget);
84 delegate->Shutdown(); 77 delegate->Shutdown();
85 } 78 }
86 79
87 void GpuPlatformSupportGbm::OnWindowBoundsChanged(gfx::AcceleratedWidget widget, 80 void GpuPlatformSupportGbm::OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
88 const gfx::Rect& bounds) { 81 const gfx::Rect& bounds) {
89 window_manager_->GetWindowDelegate(widget)->OnBoundsChanged(bounds); 82 window_manager_->GetWindowDelegate(widget)->OnBoundsChanged(bounds);
90 } 83 }
91 84
92 void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget, 85 void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget,
93 const SkBitmap& bitmap, 86 const SkBitmap& bitmap,
94 const gfx::Point& location) { 87 const gfx::Point& location) {
95 dri_->SetHardwareCursor(widget, bitmap, location); 88 dri_->SetHardwareCursor(widget, bitmap, location);
96 } 89 }
97 90
98 void GpuPlatformSupportGbm::OnCursorMove(gfx::AcceleratedWidget widget, 91 void GpuPlatformSupportGbm::OnCursorMove(gfx::AcceleratedWidget widget,
99 const gfx::Point& location) { 92 const gfx::Point& location) {
100 dri_->MoveHardwareCursor(widget, location); 93 dri_->MoveHardwareCursor(widget, location);
101 } 94 }
102 95
103 } // namespace ui 96 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gpu_platform_support_gbm.h ('k') | ui/ozone/platform/dri/hardware_display_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698