| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/tiles/checker_image_tracker.h" | 5 #include "cc/tiles/checker_image_tracker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ImageDecodeRequestId request_id = next_image_request_id_++; | 41 ImageDecodeRequestId request_id = next_image_request_id_++; |
| 42 | 42 |
| 43 // The tracker should request a decode only once. | 43 // The tracker should request a decode only once. |
| 44 EXPECT_EQ(decodes_requested_.count(image->uniqueID()), 0u); | 44 EXPECT_EQ(decodes_requested_.count(image->uniqueID()), 0u); |
| 45 decodes_requested_.insert(image->uniqueID()); | 45 decodes_requested_.insert(image->uniqueID()); |
| 46 | 46 |
| 47 locked_images_.insert(request_id); | 47 locked_images_.insert(request_id); |
| 48 | 48 |
| 49 // Post the callback asynchronously to match the behaviour in | 49 // Post the callback asynchronously to match the behaviour in |
| 50 // ImageController. | 50 // ImageController. |
| 51 worker_task_runner_->PostTask(FROM_HERE, base::Bind(callback, request_id)); | 51 worker_task_runner_->PostTask( |
| 52 FROM_HERE, |
| 53 base::Bind(callback, request_id, ImageDecodeResult::SUCCESS)); |
| 52 | 54 |
| 53 return request_id; | 55 return request_id; |
| 54 } | 56 } |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 ImageDecodeRequestId next_image_request_id_ = 1U; | 59 ImageDecodeRequestId next_image_request_id_ = 1U; |
| 58 std::unordered_set<ImageDecodeRequestId> locked_images_; | 60 std::unordered_set<ImageDecodeRequestId> locked_images_; |
| 59 ImageIdFlatSet decodes_requested_; | 61 ImageIdFlatSet decodes_requested_; |
| 60 }; | 62 }; |
| 61 | 63 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 checkered_images.clear(); | 289 checkered_images.clear(); |
| 288 draw_images.push_back(checkerable_image1); | 290 draw_images.push_back(checkerable_image1); |
| 289 checker_image_tracker_->FilterImagesForCheckeringForTile( | 291 checker_image_tracker_->FilterImagesForCheckeringForTile( |
| 290 &draw_images, &checkered_images, WhichTree::ACTIVE_TREE); | 292 &draw_images, &checkered_images, WhichTree::ACTIVE_TREE); |
| 291 EXPECT_EQ(draw_images.size(), 1U); | 293 EXPECT_EQ(draw_images.size(), 1U); |
| 292 EXPECT_EQ(checkered_images.size(), 0U); | 294 EXPECT_EQ(checkered_images.size(), 0U); |
| 293 } | 295 } |
| 294 | 296 |
| 295 } // namespace | 297 } // namespace |
| 296 } // namespace cc | 298 } // namespace cc |
| OLD | NEW |