Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: cc/tiles/decoded_image_tracker_unittest.cc

Issue 2926513003: Use PaintImage in cc QueueImageDecode
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/decoded_image_tracker.cc ('k') | cc/tiles/image_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/tiles/decoded_image_tracker.h" 8 #include "cc/tiles/decoded_image_tracker.h"
9 #include "cc/tiles/image_controller.h" 9 #include "cc/tiles/image_controller.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class TestImageController : public ImageController { 14 class TestImageController : public ImageController {
15 public: 15 public:
16 TestImageController() : ImageController(nullptr, nullptr) {} 16 TestImageController() : ImageController(nullptr, nullptr) {}
17 17
18 void UnlockImageDecode(ImageDecodeRequestId id) override { 18 void UnlockImageDecode(ImageDecodeRequestId id) override {
19 auto it = std::find(locked_ids_.begin(), locked_ids_.end(), id); 19 auto it = std::find(locked_ids_.begin(), locked_ids_.end(), id);
20 ASSERT_FALSE(it == locked_ids_.end()); 20 ASSERT_FALSE(it == locked_ids_.end());
21 locked_ids_.erase(it); 21 locked_ids_.erase(it);
22 } 22 }
23 23
24 ImageDecodeRequestId QueueImageDecode( 24 ImageDecodeRequestId QueueImageDecode(
25 sk_sp<const SkImage> image, 25 const PaintImage& image,
26 const ImageDecodedCallback& callback) override { 26 const ImageDecodedCallback& callback) override {
27 auto id = next_id_++; 27 auto id = next_id_++;
28 locked_ids_.push_back(id); 28 locked_ids_.push_back(id);
29 callback.Run(id, ImageDecodeResult::SUCCESS); 29 callback.Run(id, ImageDecodeResult::SUCCESS);
30 return id; 30 return id;
31 } 31 }
32 32
33 size_t num_locked_images() { return locked_ids_.size(); } 33 size_t num_locked_images() { return locked_ids_.size(); }
34 34
35 private: 35 private:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_EQ(2u, image_controller()->num_locked_images()); 84 EXPECT_EQ(2u, image_controller()->num_locked_images());
85 85
86 decoded_image_tracker()->NotifyFrameFinished(); 86 decoded_image_tracker()->NotifyFrameFinished();
87 EXPECT_EQ(1u, image_controller()->num_locked_images()); 87 EXPECT_EQ(1u, image_controller()->num_locked_images());
88 88
89 decoded_image_tracker()->NotifyFrameFinished(); 89 decoded_image_tracker()->NotifyFrameFinished();
90 EXPECT_EQ(0u, image_controller()->num_locked_images()); 90 EXPECT_EQ(0u, image_controller()->num_locked_images());
91 } 91 }
92 92
93 } // namespace cc 93 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/decoded_image_tracker.cc ('k') | cc/tiles/image_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698