GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / cc / blink / web_compositor_support_impl.cc
blobe335ba3b8676fbc6e84ebff9b128f214a88f7727
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/blink/web_compositor_support_impl.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "cc/animation/transform_operations.h"
10 #include "cc/blink/web_animation_impl.h"
11 #include "cc/blink/web_content_layer_impl.h"
12 #include "cc/blink/web_display_item_list_impl.h"
13 #include "cc/blink/web_external_texture_layer_impl.h"
14 #include "cc/blink/web_filter_animation_curve_impl.h"
15 #include "cc/blink/web_filter_operations_impl.h"
16 #include "cc/blink/web_float_animation_curve_impl.h"
17 #include "cc/blink/web_image_layer_impl.h"
18 #include "cc/blink/web_layer_impl.h"
19 #include "cc/blink/web_nine_patch_layer_impl.h"
20 #include "cc/blink/web_scroll_offset_animation_curve_impl.h"
21 #include "cc/blink/web_scrollbar_layer_impl.h"
22 #include "cc/blink/web_transform_animation_curve_impl.h"
23 #include "cc/blink/web_transform_operations_impl.h"
24 #include "cc/output/output_surface.h"
25 #include "cc/output/software_output_device.h"
27 using blink::WebCompositorAnimation;
28 using blink::WebCompositorAnimationCurve;
29 using blink::WebContentLayer;
30 using blink::WebContentLayerClient;
31 using blink::WebDisplayItemList;
32 using blink::WebExternalTextureLayer;
33 using blink::WebExternalTextureLayerClient;
34 using blink::WebFilterAnimationCurve;
35 using blink::WebFilterOperations;
36 using blink::WebFloatAnimationCurve;
37 using blink::WebImageLayer;
38 using blink::WebNinePatchLayer;
39 using blink::WebLayer;
40 using blink::WebScrollbar;
41 using blink::WebScrollbarLayer;
42 using blink::WebScrollbarThemeGeometry;
43 using blink::WebScrollbarThemePainter;
44 using blink::WebScrollOffsetAnimationCurve;
45 using blink::WebTransformAnimationCurve;
46 using blink::WebTransformOperations;
48 namespace cc_blink {
50 WebCompositorSupportImpl::WebCompositorSupportImpl() {
53 WebCompositorSupportImpl::~WebCompositorSupportImpl() {
56 WebLayer* WebCompositorSupportImpl::createLayer() {
57 return new WebLayerImpl();
60 WebContentLayer* WebCompositorSupportImpl::createContentLayer(
61 WebContentLayerClient* client) {
62 return new WebContentLayerImpl(client);
65 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer(
66 WebExternalTextureLayerClient* client) {
67 return new WebExternalTextureLayerImpl(client);
70 blink::WebImageLayer* WebCompositorSupportImpl::createImageLayer() {
71 return new WebImageLayerImpl();
74 blink::WebNinePatchLayer* WebCompositorSupportImpl::createNinePatchLayer() {
75 return new WebNinePatchLayerImpl();
78 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer(
79 WebScrollbar* scrollbar,
80 WebScrollbarThemePainter painter,
81 WebScrollbarThemeGeometry* geometry) {
82 return new WebScrollbarLayerImpl(scrollbar, painter, geometry);
85 WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer(
86 WebScrollbar::Orientation orientation,
87 int thumb_thickness,
88 int track_start,
89 bool is_left_side_vertical_scrollbar) {
90 return new WebScrollbarLayerImpl(orientation,
91 thumb_thickness,
92 track_start,
93 is_left_side_vertical_scrollbar);
96 WebDisplayItemList* WebCompositorSupportImpl::createDisplayItemList() {
97 return new WebDisplayItemListImpl();
100 WebCompositorAnimation* WebCompositorSupportImpl::createAnimation(
101 const blink::WebCompositorAnimationCurve& curve,
102 blink::WebCompositorAnimation::TargetProperty target,
103 #ifdef WEB_COMPOSITOR_SUPPORT_CREATE_ANIMATION_SUPPORTS_GROUP
104 int group_id,
105 #endif
106 int animation_id) {
107 #ifdef WEB_COMPOSITOR_SUPPORT_CREATE_ANIMATION_SUPPORTS_GROUP
108 return new WebCompositorAnimationImpl(curve, target, animation_id, group_id);
109 #else
110 return new WebCompositorAnimationImpl(curve, target, animation_id, 0);
111 #endif
114 WebFilterAnimationCurve*
115 WebCompositorSupportImpl::createFilterAnimationCurve() {
116 return new WebFilterAnimationCurveImpl();
119 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
120 return new WebFloatAnimationCurveImpl();
123 WebScrollOffsetAnimationCurve*
124 WebCompositorSupportImpl::createScrollOffsetAnimationCurve(
125 blink::WebFloatPoint target_value,
126 blink::WebCompositorAnimationCurve::TimingFunctionType timing_function) {
127 return new WebScrollOffsetAnimationCurveImpl(target_value, timing_function);
130 WebTransformAnimationCurve*
131 WebCompositorSupportImpl::createTransformAnimationCurve() {
132 return new WebTransformAnimationCurveImpl();
135 WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() {
136 return new WebTransformOperationsImpl();
139 WebFilterOperations* WebCompositorSupportImpl::createFilterOperations() {
140 return new WebFilterOperationsImpl();
143 } // namespace cc_blink