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

Side by Side Diff: gpu/command_buffer/service/stream_texture_manager_in_process_android.cc

Issue 301793003: During image destroy, delete textures only if we have a GL context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve android clang dbg build issue. Created 6 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h " 5 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "gpu/command_buffer/service/texture_manager.h" 9 #include "gpu/command_buffer/service/texture_manager.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
11 #include "ui/gl/android/surface_texture.h" 11 #include "ui/gl/android/surface_texture.h"
12 #include "ui/gl/gl_bindings.h" 12 #include "ui/gl/gl_bindings.h"
13 #include "ui/gl/gl_image.h" 13 #include "ui/gl/gl_image.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 16
17 namespace { 17 namespace {
18 18
19 // Simply wraps a SurfaceTexture reference as a GLImage. 19 // Simply wraps a SurfaceTexture reference as a GLImage.
20 class GLImageImpl : public gfx::GLImage { 20 class GLImageImpl : public gfx::GLImage {
21 public: 21 public:
22 GLImageImpl(const scoped_refptr<gfx::SurfaceTexture>& surface_texture, 22 GLImageImpl(const scoped_refptr<gfx::SurfaceTexture>& surface_texture,
23 const base::Closure& release_callback); 23 const base::Closure& release_callback);
24 24
25 // implement gfx::GLImage 25 // implement gfx::GLImage
26 virtual void Destroy() OVERRIDE; 26 virtual void Destroy(bool have_context) OVERRIDE;
27 virtual gfx::Size GetSize() OVERRIDE; 27 virtual gfx::Size GetSize() OVERRIDE;
28 virtual bool BindTexImage(unsigned target) OVERRIDE; 28 virtual bool BindTexImage(unsigned target) OVERRIDE;
29 virtual void ReleaseTexImage(unsigned target) OVERRIDE; 29 virtual void ReleaseTexImage(unsigned target) OVERRIDE;
30 virtual void WillUseTexImage() OVERRIDE; 30 virtual void WillUseTexImage() OVERRIDE;
31 virtual void DidUseTexImage() OVERRIDE {} 31 virtual void DidUseTexImage() OVERRIDE {}
32 virtual void WillModifyTexImage() OVERRIDE {} 32 virtual void WillModifyTexImage() OVERRIDE {}
33 virtual void DidModifyTexImage() OVERRIDE {} 33 virtual void DidModifyTexImage() OVERRIDE {}
34 34
35 private: 35 private:
36 virtual ~GLImageImpl(); 36 virtual ~GLImageImpl();
37 37
38 scoped_refptr<gfx::SurfaceTexture> surface_texture_; 38 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
39 base::Closure release_callback_; 39 base::Closure release_callback_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(GLImageImpl); 41 DISALLOW_COPY_AND_ASSIGN(GLImageImpl);
42 }; 42 };
43 43
44 GLImageImpl::GLImageImpl( 44 GLImageImpl::GLImageImpl(
45 const scoped_refptr<gfx::SurfaceTexture>& surface_texture, 45 const scoped_refptr<gfx::SurfaceTexture>& surface_texture,
46 const base::Closure& release_callback) 46 const base::Closure& release_callback)
47 : surface_texture_(surface_texture), release_callback_(release_callback) {} 47 : surface_texture_(surface_texture), release_callback_(release_callback) {}
48 48
49 GLImageImpl::~GLImageImpl() { 49 GLImageImpl::~GLImageImpl() {
50 release_callback_.Run(); 50 release_callback_.Run();
51 } 51 }
52 52
53 void GLImageImpl::Destroy() { 53 void GLImageImpl::Destroy(bool have_context) {
54 NOTREACHED(); 54 NOTREACHED();
55 } 55 }
56 56
57 void GLImageImpl::WillUseTexImage() { 57 void GLImageImpl::WillUseTexImage() {
58 surface_texture_->UpdateTexImage(); 58 surface_texture_->UpdateTexImage();
59 } 59 }
60 60
61 bool GLImageImpl::BindTexImage(unsigned target) { 61 bool GLImageImpl::BindTexImage(unsigned target) {
62 NOTREACHED(); 62 NOTREACHED();
63 return false; 63 return false;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) { 142 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) {
143 base::AutoLock lock(map_lock_); 143 base::AutoLock lock(map_lock_);
144 TextureMap::const_iterator it = textures_.find(stream_id); 144 TextureMap::const_iterator it = textures_.find(stream_id);
145 if (it != textures_.end()) 145 if (it != textures_.end())
146 return it->second; 146 return it->second;
147 147
148 return NULL; 148 return NULL;
149 } 149 }
150 150
151 } // namespace gpu 151 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_manager.cc ('k') | gpu/command_buffer/service/texture_definition.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698