Update V8 to version 4.5.7.
[chromium-blink-merge.git] / cc / output / overlay_processor.cc
blob0f5ec560dd6baeb42bda510ee3ff602826e9382d
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 #include "cc/output/overlay_processor.h"
7 #include "cc/output/output_surface.h"
8 #include "cc/output/overlay_strategy_single_on_top.h"
9 #include "cc/output/overlay_strategy_underlay.h"
10 #include "ui/gfx/geometry/rect_conversions.h"
11 #include "ui/gfx/transform.h"
13 namespace cc {
15 OverlayProcessor::OverlayProcessor(OutputSurface* surface,
16 ResourceProvider* resource_provider)
17 : surface_(surface), resource_provider_(resource_provider) {}
19 void OverlayProcessor::Initialize() {
20 DCHECK(surface_);
21 if (!resource_provider_)
22 return;
24 OverlayCandidateValidator* candidates =
25 surface_->GetOverlayCandidateValidator();
26 if (candidates) {
27 strategies_.push_back(scoped_ptr<Strategy>(
28 new OverlayStrategySingleOnTop(candidates, resource_provider_)));
29 strategies_.push_back(scoped_ptr<Strategy>(
30 new OverlayStrategyUnderlay(candidates, resource_provider_)));
34 OverlayProcessor::~OverlayProcessor() {}
36 void OverlayProcessor::ProcessForOverlays(
37 RenderPassList* render_passes_in_draw_order,
38 OverlayCandidateList* candidate_list) {
39 for (StrategyList::iterator it = strategies_.begin(); it != strategies_.end();
40 ++it) {
41 if ((*it)->Attempt(render_passes_in_draw_order, candidate_list))
42 return;
46 } // namespace cc