Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: media/gpu/surface_texture_gl_owner.h

Issue 2706653002: Added SurfaceTextureGLOwner to create / own GL objects. (Closed)
Patch Set: stopped including gl_initializer.h Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/avda_shared_state.cc ('k') | media/gpu/surface_texture_gl_owner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #ifndef MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_
6 #define MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_
7
8 #include "base/threading/thread_checker.h"
9 #include "media/gpu/media_gpu_export.h"
10 #include "ui/gl/android/surface_texture.h"
11 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_surface.h"
14
15 namespace media {
16
17 // Handy subclass of SurfaceTexture which creates and maintains ownership of the
18 // GL texture also. This texture is only destroyed with the object; one may
19 // ReleaseSurfaceTexture without destroying the GL texture. It must be deleted
20 // on the same thread on which it is constructed.
21 class MEDIA_GPU_EXPORT SurfaceTextureGLOwner : public gl::SurfaceTexture {
22 public:
23 // Must be called with a platform gl context current. Creates the GL texture
24 // using this context, and memorizes it to delete the texture later.
25 static scoped_refptr<SurfaceTextureGLOwner> Create();
26
27 // Return the GL texture id that we created.
28 GLuint texture_id() const { return texture_id_; }
29
30 gl::GLContext* context() const { return context_.get(); }
31 gl::GLSurface* surface() const { return surface_.get(); }
32
33 // We don't support these. In principle, we could, but they're fairly buggy
34 // anyway on many devices.
35 void AttachToGLContext() override;
36 void DetachFromGLContext() override;
37
38 private:
39 SurfaceTextureGLOwner(GLuint texture_id);
40 ~SurfaceTextureGLOwner() override;
41
42 // Context and surface that were used to create |texture_id_|.
43 scoped_refptr<gl::GLContext> context_;
44 scoped_refptr<gl::GLSurface> surface_;
45
46 GLuint texture_id_;
47
48 base::ThreadChecker thread_checker_;
49 };
50
51 } // namespace media
52
53 #endif // MEDIA_GPU_SURFACE_TEXTURE_GL_OWNER_H_
OLDNEW
« no previous file with comments | « media/gpu/avda_shared_state.cc ('k') | media/gpu/surface_texture_gl_owner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698