summaryrefslogtreecommitdiffstats
path: root/ui/base/ozone/surface_factory_ozone.cc
blob: c80d70ca506c249b09406a3a2a51978f3d518653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/base/ozone/surface_factory_ozone.h"

#include <stdlib.h>

namespace ui {

// static
SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL;

class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone {
 public:
  SurfaceFactoryOzoneStub() {}
  virtual ~SurfaceFactoryOzoneStub() {}

  virtual HardwareState InitializeHardware() OVERRIDE { return INITIALIZED; }
  virtual void ShutdownHardware() OVERRIDE {}
  virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 0; }
  virtual gfx::AcceleratedWidget RealizeAcceleratedWidget(
      gfx::AcceleratedWidget w) OVERRIDE {
    return 0;
  }
  virtual bool LoadEGLGLES2Bindings() OVERRIDE { return true; }
  virtual bool AttemptToResizeAcceleratedWidget(
      gfx::AcceleratedWidget w,
      const gfx::Rect& bounds) OVERRIDE {
    return false;
  }
  virtual gfx::VSyncProvider* GetVSyncProvider(
      gfx::AcceleratedWidget w) OVERRIDE {
    return NULL;
  }
};

SurfaceFactoryOzone::SurfaceFactoryOzone() {
}

SurfaceFactoryOzone::~SurfaceFactoryOzone() {
}

SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
  CHECK(impl_) << "SurfaceFactoryOzone accessed before constructed";
  return impl_;
}

void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) {
  impl_ = impl;
}

const char* SurfaceFactoryOzone::DefaultDisplaySpec() {
  char* envvar = getenv("ASH_DISPLAY_SPEC");
  if (envvar)
    return envvar;
  return  "720x1280*2";
}

gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() {
  return NULL;
}

intptr_t SurfaceFactoryOzone::GetNativeDisplay() {
  return 0;
}

bool SurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget) {
  return true;
}

// static
SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() {
  return new SurfaceFactoryOzoneStub;
}

}  // namespace ui