Index: gpu/command_buffer/service/mailbox_manager.h |
=================================================================== |
--- gpu/command_buffer/service/mailbox_manager.h (revision 0) |
+++ gpu/command_buffer/service/mailbox_manager.h (revision 0) |
@@ -0,0 +1,86 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
+#define GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
+ |
+#include <queue> |
+ |
+#include "base/hash_tables.h" |
+#include "base/memory/linked_ptr.h" |
+#include "base/memory/ref_counted.h" |
+#include "gpu/command_buffer/common/constants.h" |
+#include "gpu/gpu_export.h" |
+ |
+namespace gpu { |
+namespace gles2 { |
+ |
+class TextureDefinition; |
+class TextureManager; |
+ |
+// Identified a mailbox where a texture definition can be stored for sharing |
greggman
2012/04/26 18:09:18
s/Identified/Identifies/ ?
|
+// transferring between contexts that are not in the same context group. It is |
+// generally a large random number. |
+struct MailboxName { |
+ char components[kMailboxSize]; |
+}; |
+ |
+// Manages resources scoped beyond the context or context group level. |
+class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { |
+ public: |
+ MailboxManager(); |
+ |
+ // Remove the texture definition from the named mailbox and empty the mailbox. |
+ TextureDefinition* ConsumeTexture(unsigned target, const MailboxName& name); |
+ |
+ // Put the texture definition in the named mailbox. |
+ void ProduceTexture(unsigned target, |
+ const MailboxName& name, |
+ TextureDefinition* definition, |
+ TextureManager* owner); |
+ |
+ // Destroy any texture definitions and mailboxes owned by the given texture |
+ // manager. |
+ void DestroyOwnedTextures(TextureManager* owner, bool have_context); |
+ |
+ private: |
+ friend class base::RefCounted<MailboxManager>; |
+ |
+ struct TargetName { |
+ TargetName(unsigned target, const MailboxName& name); |
+ unsigned target; |
+ MailboxName name; |
+ }; |
+ |
+ struct TargetNameCompare { |
+ enum { |
+ bucket_size = 4, |
+ min_buckets = 8 |
+ }; |
+ size_t operator() (const TargetName& key) const; |
+ int operator() (const TargetName& lhs, const TargetName& rhs) const; |
+ }; |
+ |
+ struct OwnedTextureDefinition { |
+ OwnedTextureDefinition(TextureDefinition* definition, |
+ TextureManager* owner); |
+ linked_ptr<TextureDefinition> definition; |
+ TextureManager* owner; |
+ }; |
+ |
+ typedef base::hash_map<TargetName, OwnedTextureDefinition, TargetNameCompare> |
+ TextureDefinitionMap; |
+ |
+ ~MailboxManager(); |
+ |
+ TextureDefinitionMap textures_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MailboxManager); |
+}; |
+} // namespage gles2 |
+} // namespace gpu |
+ |
+#endif // GPU_COMMAND_BUFFER_SERVICE_DISPLAY_H_ |
+ |
+ |
Property changes on: gpu\command_buffer\service\mailbox_manager.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |