Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / common / gpu / client / grcontext_for_webgraphicscontext3d.h
blob8d0a2ea2a7062b3b5b62050c89c7f68da1977ea0
1 // Copyright (c) 2013 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 CONTENT_COMMON_GPU_CLIENT_GRCONTEXT_FOR_WEBGRAPHICSCONTEXT3D_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GRCONTEXT_FOR_WEBGRAPHICSCONTEXT3D_H_
8 #include "base/macros.h"
9 #include "skia/ext/refptr.h"
11 class GrContext;
13 namespace gpu_blink {
14 class WebGraphicsContext3DImpl;
17 namespace content {
19 // This class binds an offscreen GrContext to an offscreen context3d. The
20 // context3d is used by the GrContext so must be valid as long as this class
21 // is alive.
22 class GrContextForWebGraphicsContext3D {
23 public:
24 explicit GrContextForWebGraphicsContext3D(
25 gpu_blink::WebGraphicsContext3DImpl* context3d);
26 virtual ~GrContextForWebGraphicsContext3D();
28 GrContext* get() { return gr_context_.get(); }
30 void OnLostContext();
31 void FreeGpuResources();
33 private:
34 skia::RefPtr<class GrContext> gr_context_;
36 DISALLOW_COPY_AND_ASSIGN(GrContextForWebGraphicsContext3D);
39 } // namespace content
41 #endif // CONTENT_COMMON_GPU_CLIENT_GRCONTEXT_FOR_WEBGRAPHICSCONTEXT3D_H_