Web MIDI API: disallow to add custom exceptions on content settings UI
[chromium-blink-merge.git] / cc / resources / layer_updater.h
bloba5eb0a11da744538d892033d04fea2656811ae2a
1 // Copyright 2011 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 CC_RESOURCES_LAYER_UPDATER_H_
6 #define CC_RESOURCES_LAYER_UPDATER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/vector2d.h"
15 namespace cc {
17 class PrioritizedResource;
18 class PrioritizedResourceManager;
19 class ResourceUpdateQueue;
20 class TextureManager;
22 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
23 public:
24 // Allows updaters to store per-resource update properties.
25 class CC_EXPORT Resource {
26 public:
27 virtual ~Resource();
29 PrioritizedResource* texture() { return texture_.get(); }
30 // TODO(reveman): partial_update should be a property of this class
31 // instead of an argument passed to Update().
32 virtual void Update(ResourceUpdateQueue* queue,
33 const gfx::Rect& source_rect,
34 const gfx::Vector2d& dest_offset,
35 bool partial_update) = 0;
37 protected:
38 explicit Resource(scoped_ptr<PrioritizedResource> texture);
40 private:
41 scoped_ptr<PrioritizedResource> texture_;
43 DISALLOW_COPY_AND_ASSIGN(Resource);
46 LayerUpdater() {}
48 virtual scoped_ptr<Resource> CreateResource(
49 PrioritizedResourceManager* manager) = 0;
50 virtual void PrepareToUpdate(const gfx::Size& content_size,
51 const gfx::Rect& paint_rect,
52 const gfx::Size& tile_size,
53 float contents_width_scale,
54 float contents_height_scale) {}
55 virtual void ReduceMemoryUsage() {}
57 // Set true by the layer when it is known that the entire output is going to
58 // be opaque.
59 virtual void SetOpaque(bool opaque) {}
60 // Set true by the layer when it is known that the entire output bounds will
61 // be rasterized.
62 virtual void SetFillsBoundsCompletely(bool fills_bounds) {}
63 virtual void SetBackgroundColor(SkColor background_color) {}
65 protected:
66 virtual ~LayerUpdater() {}
68 private:
69 friend class base::RefCounted<LayerUpdater>;
71 DISALLOW_COPY_AND_ASSIGN(LayerUpdater);
74 } // namespace cc
76 #endif // CC_RESOURCES_LAYER_UPDATER_H_