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

Side by Side Diff: gpu/command_buffer/service/texture_definition.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: Destroy GLImage during ContextGroup destroy Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/texture_definition.h" 5 #include "gpu/command_buffer/service/texture_definition.h"
6 6
7 #include "gpu/command_buffer/service/texture_manager.h" 7 #include "gpu/command_buffer/service/texture_manager.h"
8 #include "ui/gl/gl_image.h" 8 #include "ui/gl/gl_image.h"
9 #include "ui/gl/gl_implementation.h" 9 #include "ui/gl/gl_implementation.h"
10 #include "ui/gl/scoped_binders.h" 10 #include "ui/gl/scoped_binders.h"
11 11
12 #if !defined(OS_MACOSX) 12 #if !defined(OS_MACOSX)
13 #include "ui/gl/gl_surface_egl.h" 13 #include "ui/gl/gl_surface_egl.h"
14 #endif 14 #endif
15 15
16 namespace gpu { 16 namespace gpu {
17 namespace gles2 { 17 namespace gles2 {
18 18
19 namespace { 19 namespace {
20 20
21 class GLImageSync : public gfx::GLImage { 21 class GLImageSync : public gfx::GLImage {
22 public: 22 public:
23 explicit GLImageSync( 23 explicit GLImageSync(
24 const scoped_refptr<NativeImageBuffer>& buffer); 24 const scoped_refptr<NativeImageBuffer>& buffer);
25 25
26 // Implement GLImage. 26 // Implement GLImage.
27 virtual void Destroy() OVERRIDE; 27 virtual void Destroy(bool have_context) OVERRIDE;
28 virtual gfx::Size GetSize() OVERRIDE; 28 virtual gfx::Size GetSize() OVERRIDE;
29 virtual bool BindTexImage(unsigned target) OVERRIDE; 29 virtual bool BindTexImage(unsigned target) OVERRIDE;
30 virtual void ReleaseTexImage(unsigned target) OVERRIDE; 30 virtual void ReleaseTexImage(unsigned target) OVERRIDE;
31 virtual void WillUseTexImage() OVERRIDE; 31 virtual void WillUseTexImage() OVERRIDE;
32 virtual void WillModifyTexImage() OVERRIDE; 32 virtual void WillModifyTexImage() OVERRIDE;
33 virtual void DidModifyTexImage() OVERRIDE; 33 virtual void DidModifyTexImage() OVERRIDE;
34 34
35 virtual void DidUseTexImage() OVERRIDE; 35 virtual void DidUseTexImage() OVERRIDE;
36 virtual void SetReleaseAfterUse() OVERRIDE; 36 virtual void SetReleaseAfterUse() OVERRIDE;
37 37
(...skipping 10 matching lines...) Expand all
48 : buffer_(buffer) { 48 : buffer_(buffer) {
49 if (buffer) 49 if (buffer)
50 buffer->AddClient(this); 50 buffer->AddClient(this);
51 } 51 }
52 52
53 GLImageSync::~GLImageSync() { 53 GLImageSync::~GLImageSync() {
54 if (buffer_) 54 if (buffer_)
55 buffer_->RemoveClient(this); 55 buffer_->RemoveClient(this);
56 } 56 }
57 57
58 void GLImageSync::Destroy() {} 58 void GLImageSync::Destroy(bool have_context) {
59 }
59 60
60 gfx::Size GLImageSync::GetSize() { 61 gfx::Size GLImageSync::GetSize() {
61 NOTREACHED(); 62 NOTREACHED();
62 return gfx::Size(); 63 return gfx::Size();
63 } 64 }
64 65
65 bool GLImageSync::BindTexImage(unsigned target) { 66 bool GLImageSync::BindTexImage(unsigned target) {
66 NOTREACHED(); 67 NOTREACHED();
67 return false; 68 return false;
68 } 69 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 438
438 // All structural changes should have orphaned the texture. 439 // All structural changes should have orphaned the texture.
439 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0)) 440 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0))
440 return false; 441 return false;
441 442
442 return true; 443 return true;
443 } 444 }
444 445
445 } // namespace gles2 446 } // namespace gles2
446 } // namespace gpu 447 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698