| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
| 8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
| 9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
| 10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
| 11 #include "cc/playback/display_item_list_settings.h" | 11 #include "cc/playback/display_item_list_settings.h" |
| 12 #include "cc/playback/drawing_display_item.h" | 12 #include "cc/playback/drawing_display_item.h" |
| 13 #include "cc/test/layer_tree_pixel_test.h" | 13 #include "cc/test/layer_tree_pixel_test.h" |
| 14 #include "cc/test/test_compositor_frame_sink.h" |
| 15 #include "gpu/command_buffer/client/gles2_interface.h" |
| 14 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
| 15 #include "third_party/skia/include/core/SkPictureRecorder.h" | 17 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 16 | 18 |
| 17 #if !defined(OS_ANDROID) | 19 #if !defined(OS_ANDROID) |
| 18 | 20 |
| 19 namespace cc { | 21 namespace cc { |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 enum RasterMode { | 24 enum RasterMode { |
| 23 PARTIAL_ONE_COPY, | 25 PARTIAL_ONE_COPY, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 client_.set_blue_top(false); | 170 client_.set_blue_top(false); |
| 169 Finish(); | 171 Finish(); |
| 170 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); | 172 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); |
| 171 | 173 |
| 172 // Add a copy request to see what happened! | 174 // Add a copy request to see what happened! |
| 173 DoReadback(); | 175 DoReadback(); |
| 174 break; | 176 break; |
| 175 } | 177 } |
| 176 } | 178 } |
| 177 | 179 |
| 180 void WillPrepareTilesOnThread(LayerTreeHostImpl* host_impl) override { |
| 181 // Issue a GL finish before preparing tiles to ensure resources become |
| 182 // available for use in a timely manner. Needed for the one-copy path. |
| 183 ContextProvider* context_provider = |
| 184 host_impl->compositor_frame_sink()->worker_context_provider(); |
| 185 if (!context_provider) |
| 186 return; |
| 187 |
| 188 ContextProvider::ScopedContextLock lock(context_provider); |
| 189 lock.ContextGL()->Finish(); |
| 190 } |
| 191 |
| 178 protected: | 192 protected: |
| 179 BlueYellowClient client_; | 193 BlueYellowClient client_; |
| 180 scoped_refptr<PictureLayer> picture_layer_; | 194 scoped_refptr<PictureLayer> picture_layer_; |
| 181 }; | 195 }; |
| 182 | 196 |
| 183 TEST_F(LayerTreeHostTilesTestPartialInvalidation, | 197 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 184 PartialRaster_SingleThread_OneCopy) { | 198 PartialRaster_SingleThread_OneCopy) { |
| 185 RunRasterPixelTest( | 199 RunRasterPixelTest( |
| 186 false, PARTIAL_ONE_COPY, picture_layer_, | 200 false, PARTIAL_ONE_COPY, picture_layer_, |
| 187 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); | 201 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 FullRaster_SingleThread_GpuRaster) { | 247 FullRaster_SingleThread_GpuRaster) { |
| 234 RunRasterPixelTest( | 248 RunRasterPixelTest( |
| 235 false, FULL_GPU, picture_layer_, | 249 false, FULL_GPU, picture_layer_, |
| 236 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); | 250 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
| 237 } | 251 } |
| 238 | 252 |
| 239 } // namespace | 253 } // namespace |
| 240 } // namespace cc | 254 } // namespace cc |
| 241 | 255 |
| 242 #endif // !defined(OS_ANDROID) | 256 #endif // !defined(OS_ANDROID) |
| OLD | NEW |