| OLD | NEW |
| 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 #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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "gpu/command_buffer/common/mailbox.h" | 9 #include "gpu/command_buffer/common/mailbox.h" |
| 10 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
| 11 | 11 |
| 12 namespace gpu { | 12 namespace gpu { |
| 13 namespace gles2 { | 13 namespace gles2 { |
| 14 | 14 |
| 15 class Texture; | 15 class Texture; |
| 16 | 16 |
| 17 // Manages resources scoped beyond the context or context group level. | 17 // Manages resources scoped beyond the context or context group level. |
| 18 class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { | 18 // TODO(mgiuca): Avoid using UnsafeRefCounted. http://crbug.com/469952. |
| 19 class GPU_EXPORT MailboxManager |
| 20 : public base::UnsafeRefCounted<MailboxManager> { |
| 19 public: | 21 public: |
| 20 // Look up the texture definition from the named mailbox. | 22 // Look up the texture definition from the named mailbox. |
| 21 virtual Texture* ConsumeTexture(const Mailbox& mailbox) = 0; | 23 virtual Texture* ConsumeTexture(const Mailbox& mailbox) = 0; |
| 22 | 24 |
| 23 // Put the texture into the named mailbox. | 25 // Put the texture into the named mailbox. |
| 24 virtual void ProduceTexture(const Mailbox& mailbox, Texture* texture) = 0; | 26 virtual void ProduceTexture(const Mailbox& mailbox, Texture* texture) = 0; |
| 25 | 27 |
| 26 // If |true| then Pull/PushTextureUpdates() needs to be called. | 28 // If |true| then Pull/PushTextureUpdates() needs to be called. |
| 27 virtual bool UsesSync() = 0; | 29 virtual bool UsesSync() = 0; |
| 28 | 30 |
| 29 // Used to synchronize texture state across share groups. | 31 // Used to synchronize texture state across share groups. |
| 30 virtual void PushTextureUpdates(uint32 sync_point) = 0; | 32 virtual void PushTextureUpdates(uint32 sync_point) = 0; |
| 31 virtual void PullTextureUpdates(uint32 sync_point) = 0; | 33 virtual void PullTextureUpdates(uint32 sync_point) = 0; |
| 32 | 34 |
| 33 // Destroy any mailbox that reference the given texture. | 35 // Destroy any mailbox that reference the given texture. |
| 34 virtual void TextureDeleted(Texture* texture) = 0; | 36 virtual void TextureDeleted(Texture* texture) = 0; |
| 35 | 37 |
| 36 protected: | 38 protected: |
| 37 MailboxManager() {} | 39 MailboxManager() {} |
| 38 virtual ~MailboxManager() {} | 40 virtual ~MailboxManager() {} |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 friend class base::RefCounted<MailboxManager>; | 43 friend class base::UnsafeRefCounted<MailboxManager>; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(MailboxManager); | 45 DISALLOW_COPY_AND_ASSIGN(MailboxManager); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespage gles2 | 48 } // namespage gles2 |
| 47 } // namespace gpu | 49 } // namespace gpu |
| 48 | 50 |
| 49 #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ | 51 #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ |
| 50 | 52 |
| OLD | NEW |