Handle account removal correctly on all platforms.
[chromium-blink-merge.git] / gpu / command_buffer / service / gl_state_restorer_impl.h
blob73534b81ad34a1d0cc3c76cad578979ca4f9311d
1 // Copyright (c) 2012 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.
5 // This file contains the GLStateRestorerImpl class.
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "gpu/gpu_export.h"
13 #include "ui/gl/gl_state_restorer.h"
15 namespace gpu {
16 namespace gles2 {
17 class GLES2Decoder;
18 struct ContextState;
21 // This class implements a GLStateRestorer that forwards to a GLES2Decoder.
22 class GPU_EXPORT GLStateRestorerImpl : public gfx::GLStateRestorer {
23 public:
24 explicit GLStateRestorerImpl(base::WeakPtr<gles2::GLES2Decoder> decoder);
25 virtual ~GLStateRestorerImpl();
27 virtual bool IsInitialized() OVERRIDE;
28 virtual void RestoreState(const gfx::GLStateRestorer* prev_state) OVERRIDE;
29 virtual void RestoreAllTextureUnitBindings() OVERRIDE;
30 virtual void RestoreActiveTextureUnitBinding(unsigned int target) OVERRIDE;
31 virtual void RestoreFramebufferBindings() OVERRIDE;
33 private:
34 const gles2::ContextState* GetContextState() const;
35 base::WeakPtr<gles2::GLES2Decoder> decoder_;
37 DISALLOW_COPY_AND_ASSIGN(GLStateRestorerImpl);
40 } // namespace gpu
42 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_