Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / service / gl_context_virtual.h
blob1d82d5ac784287faae16c0345bf39216939dde09
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 "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "gpu/gpu_export.h"
13 #include "ui/gl/gl_context.h"
15 namespace gfx {
16 class Display;
17 class GLSurface;
18 class GLStateRestorer;
21 namespace gpu {
22 namespace gles2 {
23 class GLES2Decoder;
26 // Encapsulates a virtual OpenGL context.
27 class GPU_EXPORT GLContextVirtual : public gfx::GLContext {
28 public:
29 GLContextVirtual(
30 gfx::GLShareGroup* share_group,
31 gfx::GLContext* shared_context,
32 base::WeakPtr<gles2::GLES2Decoder> decoder);
34 // Implement GLContext.
35 bool Initialize(gfx::GLSurface* compatible_surface,
36 gfx::GpuPreference gpu_preference) override;
37 void Destroy() override;
38 bool MakeCurrent(gfx::GLSurface* surface) override;
39 void ReleaseCurrent(gfx::GLSurface* surface) override;
40 bool IsCurrent(gfx::GLSurface* surface) override;
41 void* GetHandle() override;
42 scoped_refptr<gfx::GPUTimingClient> CreateGPUTimingClient() override;
43 void OnSetSwapInterval(int interval) override;
44 std::string GetExtensions() override;
45 bool GetTotalGpuMemory(size_t* bytes) override;
46 void SetSafeToForceGpuSwitch() override;
47 bool WasAllocatedUsingRobustnessExtension() override;
48 void SetUnbindFboOnMakeCurrent() override;
49 base::Closure GetStateWasDirtiedExternallyCallback() override;
50 void RestoreStateIfDirtiedExternally() override;
52 protected:
53 ~GLContextVirtual() override;
55 private:
56 scoped_refptr<gfx::GLContext> shared_context_;
57 base::WeakPtr<gles2::GLES2Decoder> decoder_;
59 DISALLOW_COPY_AND_ASSIGN(GLContextVirtual);
62 } // namespace gpu
64 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_