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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_IMPL_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_IMPL_H_
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/ref_counted.h"
13 #include "gpu/command_buffer/common/constants.h"
14 #include "gpu/command_buffer/common/mailbox.h"
15 #include "gpu/command_buffer/service/mailbox_manager.h"
16 #include "gpu/gpu_export.h"
24 // Manages resources scoped beyond the context or context group level.
25 class GPU_EXPORT MailboxManagerImpl
: public MailboxManager
{
29 // MailboxManager implementation:
30 Texture
* ConsumeTexture(const Mailbox
& mailbox
) override
;
31 void ProduceTexture(const Mailbox
& mailbox
, Texture
* texture
) override
;
32 bool UsesSync() override
;
33 void PushTextureUpdates(uint32 sync_point
) override
{}
34 void PullTextureUpdates(uint32 sync_point
) override
{}
35 void TextureDeleted(Texture
* texture
) override
;
38 ~MailboxManagerImpl() override
;
41 friend class base::RefCounted
<MailboxManager
>;
43 void InsertTexture(const Mailbox
& mailbox
, Texture
* texture
);
45 // This is a bidirectional map between mailbox and textures. We can have
46 // multiple mailboxes per texture, but one texture per mailbox. We keep an
47 // iterator in the MailboxToTextureMap to be able to manage changes to
48 // the TextureToMailboxMap efficiently.
49 typedef std::multimap
<Texture
*, Mailbox
> TextureToMailboxMap
;
50 typedef std::map
<Mailbox
, TextureToMailboxMap::iterator
>
53 MailboxToTextureMap mailbox_to_textures_
;
54 TextureToMailboxMap textures_to_mailboxes_
;
56 DISALLOW_COPY_AND_ASSIGN(MailboxManagerImpl
);
62 #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_IMPL_H_