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

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager.h

Issue 3743001: FBTF: Fix more ctor/dtors found by clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Rebase to pick up mac fix on ToT Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "gpu/command_buffer/service/gl_utils.h" 12 #include "gpu/command_buffer/service/gl_utils.h"
13 #include "gpu/command_buffer/service/renderbuffer_manager.h" 13 #include "gpu/command_buffer/service/renderbuffer_manager.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 namespace gles2 { 16 namespace gles2 {
17 17
18 // This class keeps track of the frambebuffers and their attached renderbuffers 18 // This class keeps track of the frambebuffers and their attached renderbuffers
19 // so we can correctly clear them. 19 // so we can correctly clear them.
20 class FramebufferManager { 20 class FramebufferManager {
21 public: 21 public:
22 // Info about Framebuffers currently in the system. 22 // Info about Framebuffers currently in the system.
23 class FramebufferInfo : public base::RefCounted<FramebufferInfo> { 23 class FramebufferInfo : public base::RefCounted<FramebufferInfo> {
24 public: 24 public:
25 typedef scoped_refptr<FramebufferInfo> Ref; 25 typedef scoped_refptr<FramebufferInfo> Ref;
26 26
27 explicit FramebufferInfo(GLuint service_id) 27 explicit FramebufferInfo(GLuint service_id);
28 : service_id_(service_id) {
29 }
30 28
31 GLuint service_id() const { 29 GLuint service_id() const {
32 return service_id_; 30 return service_id_;
33 } 31 }
34 32
35 bool HasUnclearedAttachment(GLenum attachment) const; 33 bool HasUnclearedAttachment(GLenum attachment) const;
36 34
37 // Attaches a renderbuffer to a particlar attachment. 35 // Attaches a renderbuffer to a particlar attachment.
38 // Pass null to detach. 36 // Pass null to detach.
39 void AttachRenderbuffer( 37 void AttachRenderbuffer(
40 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer); 38 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer);
41 39
42 void MarkAttachedRenderbuffersAsCleared(); 40 void MarkAttachedRenderbuffersAsCleared();
43 41
44 bool IsDeleted() { 42 bool IsDeleted() {
45 return service_id_ == 0; 43 return service_id_ == 0;
46 } 44 }
47 45
48 private: 46 private:
49 friend class FramebufferManager; 47 friend class FramebufferManager;
50 friend class base::RefCounted<FramebufferInfo>; 48 friend class base::RefCounted<FramebufferInfo>;
51 49
52 ~FramebufferInfo() { } 50 ~FramebufferInfo();
53 51
54 void MarkAsDeleted() { 52 void MarkAsDeleted() {
55 service_id_ = 0; 53 service_id_ = 0;
56 renderbuffers_.clear(); 54 renderbuffers_.clear();
57 } 55 }
58 56
59 // Service side framebuffer id. 57 // Service side framebuffer id.
60 GLuint service_id_; 58 GLuint service_id_;
61 59
62 // A map of attachments to renderbuffers. 60 // A map of attachments to renderbuffers.
63 typedef std::map<GLenum, RenderbufferManager::RenderbufferInfo::Ref> 61 typedef std::map<GLenum, RenderbufferManager::RenderbufferInfo::Ref>
64 AttachmentToRenderbufferMap; 62 AttachmentToRenderbufferMap;
65 AttachmentToRenderbufferMap renderbuffers_; 63 AttachmentToRenderbufferMap renderbuffers_;
66 }; 64 };
67 65
68 FramebufferManager() { } 66 FramebufferManager();
69 ~FramebufferManager(); 67 ~FramebufferManager();
70 68
71 // Must call before destruction. 69 // Must call before destruction.
72 void Destroy(bool have_context); 70 void Destroy(bool have_context);
73 71
74 // Creates a FramebufferInfo for the given framebuffer. 72 // Creates a FramebufferInfo for the given framebuffer.
75 void CreateFramebufferInfo(GLuint client_id, GLuint service_id); 73 void CreateFramebufferInfo(GLuint client_id, GLuint service_id);
76 74
77 // Gets the framebuffer info for the given framebuffer. 75 // Gets the framebuffer info for the given framebuffer.
78 FramebufferInfo* GetFramebufferInfo(GLuint client_id); 76 FramebufferInfo* GetFramebufferInfo(GLuint client_id);
(...skipping 10 matching lines...) Expand all
89 typedef std::map<GLuint, FramebufferInfo::Ref> FramebufferInfoMap; 87 typedef std::map<GLuint, FramebufferInfo::Ref> FramebufferInfoMap;
90 FramebufferInfoMap framebuffer_infos_; 88 FramebufferInfoMap framebuffer_infos_;
91 89
92 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); 90 DISALLOW_COPY_AND_ASSIGN(FramebufferManager);
93 }; 91 };
94 92
95 } // namespace gles2 93 } // namespace gles2
96 } // namespace gpu 94 } // namespace gpu
97 95
98 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 96 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/common_decoder.cc ('k') | gpu/command_buffer/service/framebuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698