| OLD | NEW |
| 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 GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "gpu/command_buffer/common/constants.h" | 13 #include "gpu/command_buffer/common/constants.h" |
| 14 #include "gpu/command_buffer/common/mailbox.h" | 14 #include "gpu/command_buffer/common/mailbox.h" |
| 15 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
| 16 | 16 |
| 17 typedef signed char GLbyte; | 17 typedef signed char GLbyte; |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 namespace gles2 { | 20 namespace gles2 { |
| 21 | 21 |
| 22 class Texture; | 22 class Texture; |
| 23 class TextureManager; | 23 class TextureManager; |
| 24 | 24 |
| 25 // Manages resources scoped beyond the context or context group level. | 25 // Manages resources scoped beyond the context or context group level. |
| 26 class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { | 26 class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { |
| 27 public: | 27 public: |
| 28 MailboxManager(); | 28 MailboxManager(); |
| 29 | 29 |
| 30 // Generate a unique unguessable mailbox name. | |
| 31 void GenerateMailbox(Mailbox* mailbox); | |
| 32 | |
| 33 // Look up the texture definition from the named mailbox. | 30 // Look up the texture definition from the named mailbox. |
| 34 Texture* ConsumeTexture(unsigned target, const Mailbox& mailbox); | 31 Texture* ConsumeTexture(unsigned target, const Mailbox& mailbox); |
| 35 | 32 |
| 36 // Put the texture into the named mailbox. | 33 // Put the texture into the named mailbox. |
| 37 void ProduceTexture(unsigned target, | 34 void ProduceTexture(unsigned target, |
| 38 const Mailbox& mailbox, | 35 const Mailbox& mailbox, |
| 39 Texture* texture); | 36 Texture* texture); |
| 40 | 37 |
| 41 // Destroy any mailbox that reference the given texture. | 38 // Destroy any mailbox that reference the given texture. |
| 42 void TextureDeleted(Texture* texture); | 39 void TextureDeleted(Texture* texture); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 MailboxToTextureMap mailbox_to_textures_; | 65 MailboxToTextureMap mailbox_to_textures_; |
| 69 TextureToMailboxMap textures_to_mailboxes_; | 66 TextureToMailboxMap textures_to_mailboxes_; |
| 70 | 67 |
| 71 DISALLOW_COPY_AND_ASSIGN(MailboxManager); | 68 DISALLOW_COPY_AND_ASSIGN(MailboxManager); |
| 72 }; | 69 }; |
| 73 } // namespage gles2 | 70 } // namespage gles2 |
| 74 } // namespace gpu | 71 } // namespace gpu |
| 75 | 72 |
| 76 #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ | 73 #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ |
| 77 | 74 |
| OLD | NEW |