Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / platform / dri / gbm_surfaceless.cc
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
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/dri/gbm_surfaceless.h"
6
7 #include "ui/ozone/platform/dri/dri_vsync_provider.h"
8 #include "ui/ozone/platform/dri/gbm_buffer.h"
9
10 namespace ui {
11
12 GbmSurfaceless::GbmSurfaceless(
13     const base::WeakPtr<HardwareDisplayController>& controller)
14     : controller_(controller) {}
15
16 GbmSurfaceless::~GbmSurfaceless() {}
17
18 intptr_t GbmSurfaceless::GetNativeWindow() {
19   NOTREACHED();
20   return 0;
21 }
22
23 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) {
24   NOTIMPLEMENTED();
25   return false;
26 }
27
28 bool GbmSurfaceless::OnSwapBuffers() {
29   if (!controller_)
30     return true;
31
32   bool success = controller_->SchedulePageFlip();
33   controller_->WaitForPageFlipEvent();
34
35   return success;
36 }
37
38 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
39   return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_));
40 }
41
42 }  // namespace ui