flutter_flutter/mojo/gpu/gl_context.h
James Robinson c8eff5e44f Update to mojo d259eb58aa59e14a13d5e0dc3984b855b475ba09
This updates to mojo commit d259eb58aa59 and limits the roll script to
only pull in the parts of //mojo that are currently being used. More
stuff will be dropped in the future.
2015-08-25 14:56:25 -07:00

62 lines
1.2 KiB
C++

// Copyright 2014 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.
#ifndef MOJO_GPU_GL_CONTEXT_H_
#define MOJO_GPU_GL_CONTEXT_H_
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "mojo/public/c/gles2/gles2.h"
namespace gpu {
namespace gles2 {
class GLES2Interface;
}
}
namespace mojo {
class MojoGLES2Impl;
class Shell;
class GLContext {
public:
class Observer {
public:
virtual void OnContextLost() = 0;
protected:
virtual ~Observer();
};
static base::WeakPtr<GLContext> Create(Shell* shell);
void MakeCurrent();
void Destroy();
gpu::gles2::GLES2Interface* gl() const;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
private:
explicit GLContext(Shell* shell);
~GLContext();
static void ContextLostThunk(void* self);
void OnContextLost();
MojoGLES2Context context_;
scoped_ptr<MojoGLES2Impl> gl_impl_;
base::ObserverList<Observer> observers_;
base::WeakPtrFactory<GLContext> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(GLContext);
};
} // namespace mojo
#endif // MOJO_GPU_GL_CONTEXT_H_