summaryrefslogtreecommitdiffstats
path: root/cc/CCTextureUpdateQueue.h
blob: afe33b3f747dd9516f27a1a5cd71f8a98350f5e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 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 CCTextureUpdateQueue_h
#define CCTextureUpdateQueue_h

#include "TextureCopier.h"
#include "TextureUploader.h"
#include <wtf/Deque.h>
#include <wtf/Noncopyable.h>

namespace WebCore {

class CCTextureUpdateQueue {
    WTF_MAKE_NONCOPYABLE(CCTextureUpdateQueue);
public:
    CCTextureUpdateQueue();
    virtual ~CCTextureUpdateQueue();

    void appendFullUpload(TextureUploader::Parameters);
    void appendPartialUpload(TextureUploader::Parameters);
    void appendCopy(TextureCopier::Parameters);

    void clearUploads();

    TextureUploader::Parameters takeFirstFullUpload();
    TextureUploader::Parameters takeFirstPartialUpload();
    TextureCopier::Parameters takeFirstCopy();

    size_t fullUploadSize() const { return m_fullEntries.size(); }
    size_t partialUploadSize() const { return m_partialEntries.size(); }
    size_t copySize() const { return m_copyEntries.size(); }

    bool hasMoreUpdates() const;

private:
    Deque<TextureUploader::Parameters> m_fullEntries;
    Deque<TextureUploader::Parameters> m_partialEntries;
    Deque<TextureCopier::Parameters> m_copyEntries;
};

}

#endif // CCTextureUpdateQueue_h