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

Side by Side Diff: cc/tiles/checker_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/checker_image_tracker.cc ('k') | cc/tiles/decoded_image_tracker.cc » ('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 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 28 matching lines...) Expand all
39 const PaintImageIdFlatSet& decodes_requested() const { 39 const PaintImageIdFlatSet& decodes_requested() const {
40 return decodes_requested_; 40 return decodes_requested_;
41 } 41 }
42 42
43 void UnlockImageDecode(ImageDecodeRequestId id) override { 43 void UnlockImageDecode(ImageDecodeRequestId id) override {
44 DCHECK_EQ(locked_images_.count(id), 1U); 44 DCHECK_EQ(locked_images_.count(id), 1U);
45 locked_images_.erase(id); 45 locked_images_.erase(id);
46 } 46 }
47 47
48 ImageDecodeRequestId QueueImageDecode( 48 ImageDecodeRequestId QueueImageDecode(
49 sk_sp<const SkImage> image, 49 const PaintImage& image,
50 const ImageDecodedCallback& callback) override { 50 const ImageDecodedCallback& callback) override {
51 ImageDecodeRequestId request_id = next_image_request_id_++; 51 ImageDecodeRequestId request_id = next_image_request_id_++;
52 52
53 decodes_requested_.insert(image->uniqueID()); 53 decodes_requested_.insert(image.sk_image()->uniqueID());
54 locked_images_.insert(request_id); 54 locked_images_.insert(request_id);
55 55
56 // Post the callback asynchronously to match the behaviour in 56 // Post the callback asynchronously to match the behaviour in
57 // ImageController. 57 // ImageController.
58 worker_task_runner_->PostTask( 58 worker_task_runner_->PostTask(
59 FROM_HERE, 59 FROM_HERE,
60 base::BindOnce(callback, request_id, ImageDecodeResult::SUCCESS)); 60 base::BindOnce(callback, request_id, ImageDecodeResult::SUCCESS));
61 61
62 return request_id; 62 return request_id;
63 } 63 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 gfx::Size image_size = gfx::Size(partial_image.sk_image()->width(), 411 gfx::Size image_size = gfx::Size(partial_image.sk_image()->width(),
412 partial_image.sk_image()->height()); 412 partial_image.sk_image()->height());
413 PaintImage completed_paint_image = 413 PaintImage completed_paint_image =
414 PaintImage(partial_image.stable_id(), CreateDiscardableImage(image_size)); 414 PaintImage(partial_image.stable_id(), CreateDiscardableImage(image_size));
415 EXPECT_FALSE(checker_image_tracker_->ShouldCheckerImage( 415 EXPECT_FALSE(checker_image_tracker_->ShouldCheckerImage(
416 completed_paint_image, WhichTree::PENDING_TREE)); 416 completed_paint_image, WhichTree::PENDING_TREE));
417 } 417 }
418 418
419 } // namespace 419 } // namespace
420 } // namespace cc 420 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/checker_image_tracker.cc ('k') | cc/tiles/decoded_image_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698