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

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

Issue 2706653002: Added SurfaceTextureGLOwner to create / own GL objects. (Closed)
Patch Set: made destruction the same as before Created 3 years, 10 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_AVDA_SURFACE_TEXTURE_GL_OWNER_H_
6 #define MEDIA_GPU_AVDA_SURFACE_TEXTURE_GL_OWNER_H_
watk 2017/02/21 23:18:31 remove AVDA
liberato (no reviews please) 2017/02/22 01:22:45 Done.
7
8 #include "media/gpu/media_gpu_export.h"
9 #include "ui/gl/android/surface_texture.h"
10 #include "ui/gl/gl_bindings.h"
11 #include "ui/gl/gl_context.h"
12 #include "ui/gl/gl_surface.h"
13
14 namespace media {
15
16 // Handy subclass of SurfaceTexture which creates and maintains ownership of the
17 // GL texture also. This texture is only destroyed with the object; one may
18 // ReleaseSurfaceTexture without destroying the GL texture.
19 class MEDIA_GPU_EXPORT SurfaceTextureGLOwner : public gl::SurfaceTexture {
watk 2017/02/21 23:18:31 This requires that it's deleted on the thread it w
liberato (no reviews please) 2017/02/22 01:22:45 Done.
20 public:
21 // Must be called with a platform gl context current. Creates the GL texture
22 // using this context, and memorizes it to delete the texture later.
23 static scoped_refptr<SurfaceTextureGLOwner> Create();
24
25 // Return the GL texture id that we created.
26 GLuint texture_id() const { return texture_id_; }
27
28 gl::GLContext* context() const { return context_.get(); }
29 gl::GLSurface* surface() const { return surface_.get(); }
30
31 // We don't support these. In principle, we could, but they're fairly buggy
32 // anyway on many devices.
33 void AttachToGLContext() override;
34 void DetachFromGLContext() override;
35
36 private:
37 SurfaceTextureGLOwner(GLuint texture_id);
38 ~SurfaceTextureGLOwner() override;
39
40 // Context and surface that were used to create |texture_id_|.
41 scoped_refptr<gl::GLContext> context_;
42 scoped_refptr<gl::GLSurface> surface_;
43
44 GLuint texture_id_;
45 };
46
47 } // namespace media
48
49 #endif // MEDIA_GPU_AVDA_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