OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
18 #include "cc/animation/animation_events.h" | 18 #include "cc/animation/animation_events.h" |
19 #include "cc/animation/animation_host.h" | 19 #include "cc/animation/animation_host.h" |
20 #include "cc/animation/animation_id_provider.h" | 20 #include "cc/animation/animation_id_provider.h" |
21 #include "cc/animation/transform_operations.h" | 21 #include "cc/animation/transform_operations.h" |
22 #include "cc/base/math_util.h" | 22 #include "cc/base/math_util.h" |
23 #include "cc/input/main_thread_scrolling_reason.h" | 23 #include "cc/input/main_thread_scrolling_reason.h" |
24 #include "cc/input/page_scale_animation.h" | 24 #include "cc/input/page_scale_animation.h" |
25 #include "cc/input/scrollbar_animation_controller_thinning.h" | 25 #include "cc/input/scrollbar_animation_controller_thinning.h" |
26 #include "cc/input/top_controls_manager.h" | 26 #include "cc/input/top_controls_manager.h" |
27 #include "cc/layers/append_quads_data.h" | 27 #include "cc/layers/append_quads_data.h" |
28 #include "cc/layers/heads_up_display_layer_impl.h" | 28 #include "cc/layers/heads_up_display_layer_impl.h" |
29 #include "cc/layers/io_surface_layer_impl.h" | |
30 #include "cc/layers/layer_impl.h" | 29 #include "cc/layers/layer_impl.h" |
31 #include "cc/layers/painted_scrollbar_layer_impl.h" | 30 #include "cc/layers/painted_scrollbar_layer_impl.h" |
32 #include "cc/layers/render_surface_impl.h" | 31 #include "cc/layers/render_surface_impl.h" |
33 #include "cc/layers/solid_color_layer_impl.h" | 32 #include "cc/layers/solid_color_layer_impl.h" |
34 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 33 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
35 #include "cc/layers/texture_layer_impl.h" | 34 #include "cc/layers/texture_layer_impl.h" |
36 #include "cc/layers/video_layer_impl.h" | 35 #include "cc/layers/video_layer_impl.h" |
37 #include "cc/layers/viewport.h" | 36 #include "cc/layers/viewport.h" |
38 #include "cc/output/begin_frame_args.h" | 37 #include "cc/output/begin_frame_args.h" |
39 #include "cc/output/compositor_frame_ack.h" | 38 #include "cc/output/compositor_frame_ack.h" |
(...skipping 7148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7188 media::VideoFrame::CreateColorFrame( | 7187 media::VideoFrame::CreateColorFrame( |
7189 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 7188 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
7190 FakeVideoFrameProvider provider; | 7189 FakeVideoFrameProvider provider; |
7191 provider.set_frame(softwareFrame); | 7190 provider.set_frame(softwareFrame); |
7192 std::unique_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( | 7191 std::unique_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( |
7193 host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0); | 7192 host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0); |
7194 video_layer->SetBounds(gfx::Size(10, 10)); | 7193 video_layer->SetBounds(gfx::Size(10, 10)); |
7195 video_layer->SetDrawsContent(true); | 7194 video_layer->SetDrawsContent(true); |
7196 root_layer->AddChild(std::move(video_layer)); | 7195 root_layer->AddChild(std::move(video_layer)); |
7197 | 7196 |
7198 std::unique_ptr<IOSurfaceLayerImpl> io_surface_layer = | |
7199 IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); | |
7200 io_surface_layer->SetBounds(gfx::Size(10, 10)); | |
7201 io_surface_layer->SetDrawsContent(true); | |
7202 io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); | |
7203 root_layer->AddChild(std::move(io_surface_layer)); | |
7204 | |
7205 host_impl_->active_tree()->SetRootLayer(std::move(root_layer)); | 7197 host_impl_->active_tree()->SetRootLayer(std::move(root_layer)); |
7206 | 7198 |
7207 EXPECT_EQ(0u, context3d->NumTextures()); | 7199 EXPECT_EQ(0u, context3d->NumTextures()); |
7208 | 7200 |
7209 LayerTreeHostImpl::FrameData frame; | 7201 LayerTreeHostImpl::FrameData frame; |
7210 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 7202 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
7211 host_impl_->DrawLayers(&frame); | 7203 host_impl_->DrawLayers(&frame); |
7212 host_impl_->DidDrawAllLayers(frame); | 7204 host_impl_->DidDrawAllLayers(frame); |
7213 host_impl_->SwapBuffers(frame); | 7205 host_impl_->SwapBuffers(frame); |
7214 | 7206 |
(...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10608 // There should not be any jitter measured till we hit the fixed point hits | 10600 // There should not be any jitter measured till we hit the fixed point hits |
10609 // threshold. | 10601 // threshold. |
10610 float expected_jitter = | 10602 float expected_jitter = |
10611 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10603 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
10612 EXPECT_EQ(jitter, expected_jitter); | 10604 EXPECT_EQ(jitter, expected_jitter); |
10613 } | 10605 } |
10614 } | 10606 } |
10615 | 10607 |
10616 } // namespace | 10608 } // namespace |
10617 } // namespace cc | 10609 } // namespace cc |
OLD | NEW |