summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/gl_context_stub.cc
blob: 84e62094f7009d791003304d5a510313023f8a21 (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
// Copyright (c) 2010 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.

// This file implements the StubGLContext.

#include "build/build_config.h"
#include "gpu/command_buffer/service/gl_context.h"

namespace gpu {

// A GLContext that does nothing for unit tests.
class StubGLContext : public GLContext {
 public:

  // Implement GLContext.
  virtual void Destroy() {}
  virtual bool MakeCurrent() { return true; }
  virtual bool IsCurrent() { return true; }
  virtual bool IsOffscreen() { return true; }
  virtual void SwapBuffers() {}
  virtual gfx::Size GetSize() { return gfx::Size(); }
  virtual void* GetHandle() { return NULL; }
};

#if !defined(OS_MACOSX)

GLContext* GLContext::CreateViewGLContext(gfx::PluginWindowHandle /* window */,
                                          bool /* multisampled */) {
  return new StubGLContext;
}

#endif  // OS_MACOSX

GLContext* GLContext::CreateOffscreenGLContext(void* /* shared_handle */) {
  return new StubGLContext;
}

}  // namespace gpu