Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / cc / output / overlay_processor.h
blobfeba0481b299955800702685aa4906db41de7979
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 CC_OUTPUT_OVERLAY_PROCESSOR_H_
6 #define CC_OUTPUT_OVERLAY_PROCESSOR_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/output/overlay_candidate.h"
12 #include "cc/quads/render_pass.h"
14 namespace cc {
15 class OutputSurface;
16 class ResourceProvider;
18 class CC_EXPORT OverlayProcessor {
19 public:
20 class CC_EXPORT Strategy {
21 public:
22 virtual ~Strategy() {}
23 // Returns false if the strategy cannot be made to work with the
24 // current set of render passes. Returns true if the strategy was successful
25 // and adds any additional passes necessary to represent overlays to
26 // |render_passes_in_draw_order|.
27 virtual bool Attempt(RenderPassList* render_passes_in_draw_order,
28 OverlayCandidateList* candidates,
29 float device_scale_factor) = 0;
31 typedef ScopedPtrVector<Strategy> StrategyList;
33 explicit OverlayProcessor(OutputSurface* surface);
34 virtual ~OverlayProcessor();
35 // Virtual to allow testing different strategies.
36 virtual void Initialize();
38 void ProcessForOverlays(RenderPassList* render_passes_in_draw_order,
39 OverlayCandidateList* candidate_list);
41 protected:
42 StrategyList strategies_;
43 OutputSurface* surface_;
45 private:
46 DISALLOW_COPY_AND_ASSIGN(OverlayProcessor);
49 } // namespace cc
51 #endif // CC_OUTPUT_OVERLAY_PROCESSOR_H_