summaryrefslogtreecommitdiffstats
path: root/cc/resources/resource_update_queue.h
blob: 9ed326605f6578fb4d972deff0e39e8082a6dc6f (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
46
47
48
// 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 CC_RESOURCES_RESOURCE_UPDATE_QUEUE_H_
#define CC_RESOURCES_RESOURCE_UPDATE_QUEUE_H_

#include <deque>
#include "base/basictypes.h"
#include "cc/base/cc_export.h"
#include "cc/output/texture_copier.h"
#include "cc/resources/resource_update.h"

namespace cc {

class CC_EXPORT ResourceUpdateQueue {
 public:
  ResourceUpdateQueue();
  virtual ~ResourceUpdateQueue();

  void AppendFullUpload(const ResourceUpdate& upload);
  void AppendPartialUpload(const ResourceUpdate& upload);
  void AppendCopy(TextureCopier::Parameters copy);

  void ClearUploadsToEvictedResources();

  ResourceUpdate TakeFirstFullUpload();
  ResourceUpdate TakeFirstPartialUpload();
  TextureCopier::Parameters TakeFirstCopy();

  size_t FullUploadSize() const { return full_entries_.size(); }
  size_t PartialUploadSize() const { return partial_entries_.size(); }
  size_t CopySize() const { return copy_entries_.size(); }

  bool HasMoreUpdates() const;

 private:
  void ClearUploadsToEvictedResources(std::deque<ResourceUpdate>* entry_queue);
  std::deque<ResourceUpdate> full_entries_;
  std::deque<ResourceUpdate> partial_entries_;
  std::deque<TextureCopier::Parameters> copy_entries_;

  DISALLOW_COPY_AND_ASSIGN(ResourceUpdateQueue);
};

}  // namespace cc

#endif  // CC_RESOURCES_RESOURCE_UPDATE_QUEUE_H_