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/gbm_surfaceless.h" | 5 #include "ui/ozone/platform/dri/gbm_surfaceless.h" |
6 | 6 |
7 #include "ui/ozone/platform/dri/dri_vsync_provider.h" | 7 #include "ui/ozone/platform/dri/dri_vsync_provider.h" |
| 8 #include "ui/ozone/platform/dri/dri_window_delegate.h" |
8 #include "ui/ozone/platform/dri/gbm_buffer.h" | 9 #include "ui/ozone/platform/dri/gbm_buffer.h" |
| 10 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
9 | 11 |
10 namespace ui { | 12 namespace ui { |
11 | 13 |
12 GbmSurfaceless::GbmSurfaceless( | 14 GbmSurfaceless::GbmSurfaceless(DriWindowDelegate* window_delegate) |
13 const base::WeakPtr<HardwareDisplayController>& controller) | 15 : window_delegate_(window_delegate) { |
14 : controller_(controller) {} | 16 } |
15 | 17 |
16 GbmSurfaceless::~GbmSurfaceless() {} | 18 GbmSurfaceless::~GbmSurfaceless() {} |
17 | 19 |
18 intptr_t GbmSurfaceless::GetNativeWindow() { | 20 intptr_t GbmSurfaceless::GetNativeWindow() { |
19 NOTREACHED(); | 21 NOTREACHED(); |
20 return 0; | 22 return 0; |
21 } | 23 } |
22 | 24 |
23 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { | 25 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { |
24 NOTIMPLEMENTED(); | 26 NOTIMPLEMENTED(); |
25 return false; | 27 return false; |
26 } | 28 } |
27 | 29 |
28 bool GbmSurfaceless::OnSwapBuffers() { | 30 bool GbmSurfaceless::OnSwapBuffers() { |
29 if (!controller_) | 31 HardwareDisplayController* controller = window_delegate_->GetController(); |
| 32 if (!controller) |
30 return true; | 33 return true; |
31 | 34 |
32 bool success = controller_->SchedulePageFlip(); | 35 bool success = controller->SchedulePageFlip(); |
33 controller_->WaitForPageFlipEvent(); | 36 controller->WaitForPageFlipEvent(); |
34 | 37 |
35 return success; | 38 return success; |
36 } | 39 } |
37 | 40 |
38 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { | 41 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
39 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); | 42 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(window_delegate_)); |
40 } | 43 } |
41 | 44 |
42 } // namespace ui | 45 } // namespace ui |
OLD | NEW |