Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / gpu / command_buffer / service / gl_context_virtual.h
blob1403cf04ed07337104fe00fd7d63e0faddcb5eac
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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_
8 #include <string>
9 #include "base/callback_forward.h"
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "gpu/gpu_export.h"
14 #include "ui/gl/gl_context.h"
16 namespace gfx {
17 class GPUPreference;
18 class GPUTimingClient;
19 class GLShareGroup;
20 class GLSurface;
23 namespace gpu {
24 namespace gles2 {
25 class GLES2Decoder;
28 // Encapsulates a virtual OpenGL context.
29 class GPU_EXPORT GLContextVirtual : public gfx::GLContext {
30 public:
31 GLContextVirtual(
32 gfx::GLShareGroup* share_group,
33 gfx::GLContext* shared_context,
34 base::WeakPtr<gles2::GLES2Decoder> decoder);
36 // Implement GLContext.
37 bool Initialize(gfx::GLSurface* compatible_surface,
38 gfx::GpuPreference gpu_preference) override;
39 bool MakeCurrent(gfx::GLSurface* surface) override;
40 void ReleaseCurrent(gfx::GLSurface* surface) override;
41 bool IsCurrent(gfx::GLSurface* surface) override;
42 void* GetHandle() override;
43 scoped_refptr<gfx::GPUTimingClient> CreateGPUTimingClient() override;
44 void OnSetSwapInterval(int interval) override;
45 std::string GetExtensions() override;
46 bool GetTotalGpuMemory(size_t* bytes) override;
47 void SetSafeToForceGpuSwitch() override;
48 bool WasAllocatedUsingRobustnessExtension() override;
49 void SetUnbindFboOnMakeCurrent() override;
50 base::Closure GetStateWasDirtiedExternallyCallback() override;
51 void RestoreStateIfDirtiedExternally() override;
53 protected:
54 ~GLContextVirtual() override;
56 private:
57 void Destroy();
59 scoped_refptr<gfx::GLContext> shared_context_;
60 base::WeakPtr<gles2::GLES2Decoder> decoder_;
62 DISALLOW_COPY_AND_ASSIGN(GLContextVirtual);
65 } // namespace gpu
67 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_