diff options
Diffstat (limited to 'chromium/gpu/command_buffer/service/mailbox_manager.h')
-rw-r--r-- | chromium/gpu/command_buffer/service/mailbox_manager.h | 64 |
1 files changed, 25 insertions, 39 deletions
diff --git a/chromium/gpu/command_buffer/service/mailbox_manager.h b/chromium/gpu/command_buffer/service/mailbox_manager.h index c97302813a0..e1b36cb934e 100644 --- a/chromium/gpu/command_buffer/service/mailbox_manager.h +++ b/chromium/gpu/command_buffer/service/mailbox_manager.h @@ -10,68 +10,55 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" -#include "crypto/hmac.h" #include "gpu/command_buffer/common/constants.h" +#include "gpu/command_buffer/common/mailbox.h" #include "gpu/gpu_export.h" -// From gl2/gl2ext.h. -#ifndef GL_MAILBOX_SIZE_CHROMIUM -#define GL_MAILBOX_SIZE_CHROMIUM 64 -#endif - typedef signed char GLbyte; namespace gpu { namespace gles2 { +class MailboxSynchronizer; class Texture; class TextureManager; -// Identifies a mailbox where a texture definition can be stored for -// transferring textures between contexts that are not in the same context -// group. It is a random key signed with a hash of a private key. -struct GPU_EXPORT MailboxName { - MailboxName(); - GLbyte key[GL_MAILBOX_SIZE_CHROMIUM / 2]; - GLbyte signature[GL_MAILBOX_SIZE_CHROMIUM / 2]; -}; - // Manages resources scoped beyond the context or context group level. class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { public: MailboxManager(); - // Generate a unique mailbox name signed with the manager's private key. - void GenerateMailboxName(MailboxName* name); - // Look up the texture definition from the named mailbox. - Texture* ConsumeTexture(unsigned target, const MailboxName& name); + Texture* ConsumeTexture(unsigned target, const Mailbox& mailbox); // Put the texture into the named mailbox. - bool ProduceTexture(unsigned target, - const MailboxName& name, + void ProduceTexture(unsigned target, + const Mailbox& mailbox, Texture* texture); + // Returns whether this manager synchronizes with other instances. + bool UsesSync() { return sync_ != NULL; } + + // Used with the MailboxSynchronizer to push/pull texture state to/from + // other manager instances. + void PushTextureUpdates(); + void PullTextureUpdates(); + // Destroy any mailbox that reference the given texture. void TextureDeleted(Texture* texture); - std::string private_key() { - return std::string(private_key_, sizeof(private_key_)); - } - private: friend class base::RefCounted<MailboxManager>; + friend class MailboxSynchronizer; ~MailboxManager(); - void SignMailboxName(MailboxName* name); - bool IsMailboxNameValid(const MailboxName& name); - struct TargetName { - TargetName(unsigned target, const MailboxName& name); + TargetName(unsigned target, const Mailbox& mailbox); unsigned target; - MailboxName name; + Mailbox mailbox; }; + void InsertTexture(TargetName target_name, Texture* texture); static bool TargetNameLess(const TargetName& lhs, const TargetName& rhs); @@ -80,17 +67,17 @@ class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { // iterator in the MailboxToTextureMap to be able to manage changes to // the TextureToMailboxMap efficiently. typedef std::multimap<Texture*, TargetName> TextureToMailboxMap; - typedef std::map< - TargetName, - TextureToMailboxMap::iterator, - std::pointer_to_binary_function< - const TargetName&, const TargetName&, bool> > MailboxToTextureMap; - - char private_key_[GL_MAILBOX_SIZE_CHROMIUM / 2]; - crypto::HMAC hmac_; + typedef std::map<TargetName, + TextureToMailboxMap::iterator, + std::pointer_to_binary_function<const TargetName&, + const TargetName&, + bool> > MailboxToTextureMap; + MailboxToTextureMap mailbox_to_textures_; TextureToMailboxMap textures_to_mailboxes_; + MailboxSynchronizer* sync_; + DISALLOW_COPY_AND_ASSIGN(MailboxManager); }; } // namespage gles2 @@ -98,4 +85,3 @@ class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ - |