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

Side by Side Diff: content/common/gpu/texture_image_transport_surface.h

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add optional 'pool' reference while textures are in mailbox Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ 5 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ 6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "content/common/gpu/gpu_command_buffer_stub.h" 13 #include "content/common/gpu/gpu_command_buffer_stub.h"
13 #include "content/common/gpu/image_transport_surface.h" 14 #include "content/common/gpu/image_transport_surface.h"
14 #include "gpu/command_buffer/service/mailbox_manager.h" 15 #include "gpu/command_buffer/service/mailbox_manager.h"
15 #include "gpu/command_buffer/service/texture_definition.h" 16 #include "gpu/command_buffer/service/texture_definition.h"
16 #include "gpu/command_buffer/service/texture_manager.h" 17 #include "gpu/command_buffer/service/texture_manager.h"
17 #include "ui/gl/gl_context.h" 18 #include "ui/gl/gl_context.h"
18 #include "ui/gl/gl_surface.h" 19 #include "ui/gl/gl_surface.h"
19 20
20 namespace content { 21 namespace content {
21 class GpuChannelManager; 22 class GpuChannelManager;
22 23
23 class TextureImageTransportSurface 24 class TextureImageTransportSurface
24 : public ImageTransportSurface, 25 : public ImageTransportSurface,
25 public GpuCommandBufferStub::DestructionObserver, 26 public GpuCommandBufferStub::DestructionObserver,
26 public gfx::GLSurface { 27 public gfx::GLSurface,
28 private gpu::gles2::TextureDefinition::Client {
27 public: 29 public:
28 TextureImageTransportSurface(GpuChannelManager* manager, 30 TextureImageTransportSurface(GpuChannelManager* manager,
29 GpuCommandBufferStub* stub, 31 GpuCommandBufferStub* stub,
30 const gfx::GLSurfaceHandle& handle); 32 const gfx::GLSurfaceHandle& handle);
31 33
32 // gfx::GLSurface implementation. 34 // gfx::GLSurface implementation.
33 virtual bool Initialize() OVERRIDE; 35 virtual bool Initialize() OVERRIDE;
34 virtual void Destroy() OVERRIDE; 36 virtual void Destroy() OVERRIDE;
35 virtual bool DeferDraws() OVERRIDE; 37 virtual bool DeferDraws() OVERRIDE;
36 virtual bool Resize(const gfx::Size& size) OVERRIDE; 38 virtual bool Resize(const gfx::Size& size) OVERRIDE;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void ConsumeTexture(); 77 void ConsumeTexture();
76 78
77 static gpu::gles2::TextureDefinition* CreateTextureDefinition(gfx::Size size, 79 static gpu::gles2::TextureDefinition* CreateTextureDefinition(gfx::Size size,
78 int service_id); 80 int service_id);
79 81
80 // The framebuffer that represents this surface (service id). Allocated lazily 82 // The framebuffer that represents this surface (service id). Allocated lazily
81 // in OnMakeCurrent. 83 // in OnMakeCurrent.
82 uint32 fbo_id_; 84 uint32 fbo_id_;
83 85
84 // The current backbuffer. 86 // The current backbuffer.
85 scoped_ptr<gpu::gles2::TextureDefinition> backbuffer_; 87 gpu::gles2::TextureDefinition* backbuffer_;
86 88
87 // The mailbox name for the current backbuffer texture. Needs to be unique per 89 // The mailbox name for the current backbuffer texture. Needs to be unique per
88 // GL texture and is invalid while service_id is zero. 90 // GL texture and is invalid while service_id is zero.
89 gpu::gles2::MailboxName mailbox_name_; 91 gpu::gles2::MailboxName mailbox_name_;
90 92
91 // The current size of the GLSurface. Used to disambiguate from the current 93 // The current size of the GLSurface. Used to disambiguate from the current
92 // texture size which might be outdated (since we use two buffers). 94 // texture size which might be outdated (since we use two buffers).
93 gfx::Size current_size_; 95 gfx::Size current_size_;
94 96
95 // Whether or not the command buffer stub has been destroyed. 97 // Whether or not the command buffer stub has been destroyed.
96 bool stub_destroyed_; 98 bool stub_destroyed_;
97 99
98 bool backbuffer_suggested_allocation_; 100 bool backbuffer_suggested_allocation_;
99 bool frontbuffer_suggested_allocation_; 101 bool frontbuffer_suggested_allocation_;
100 102
101 scoped_ptr<ImageTransportHelper> helper_; 103 scoped_ptr<ImageTransportHelper> helper_;
102 gfx::GLSurfaceHandle handle_; 104 gfx::GLSurfaceHandle handle_;
103 105
104 // The offscreen surface used to make the context current. However note that 106 // The offscreen surface used to make the context current. However note that
105 // the actual rendering is always redirected to an FBO. 107 // the actual rendering is always redirected to an FBO.
106 scoped_refptr<gfx::GLSurface> surface_; 108 scoped_refptr<gfx::GLSurface> surface_;
107 109
108 // Holds a reference to the underlying context for cleanup.
109 scoped_refptr<gfx::GLContext> context_;
110
111 // Whether a SwapBuffers is pending. 110 // Whether a SwapBuffers is pending.
112 bool is_swap_buffers_pending_; 111 bool is_swap_buffers_pending_;
113 112
114 // Whether we unscheduled command buffer because of pending SwapBuffers. 113 // Whether we unscheduled command buffer because of pending SwapBuffers.
115 bool did_unschedule_; 114 bool did_unschedule_;
116 115
117 // Holds a reference to the mailbox manager for cleanup. 116 // Holds a reference to the mailbox manager for cleanup.
118 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 117 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
119 118
120 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); 119 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface);
121 }; 120 };
122 121
123 } // namespace content 122 } // namespace content
124 123
125 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ 124 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/texture_image_transport_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698