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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2929493002: Plumb PaintImage for the img.decode instead of SkImage. (Closed)
Patch Set: 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/trees/layer_tree_host_impl.cc ('k') | content/renderer/gpu/render_widget_compositor.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 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 7781 matching lines...) Expand 10 before | Expand all | Expand 10 after
7792 7792
7793 class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest { 7793 class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest {
7794 protected: 7794 protected:
7795 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 7795 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
7796 7796
7797 void WillBeginMainFrame() override { 7797 void WillBeginMainFrame() override {
7798 if (!first_) 7798 if (!first_)
7799 return; 7799 return;
7800 first_ = false; 7800 first_ = false;
7801 7801
7802 sk_sp<const SkImage> image = CreateDiscardableImage(gfx::Size(10, 10)); 7802 PaintImage image(PaintImage::GetNextId(),
7803 CreateDiscardableImage(gfx::Size(10, 10)));
7803 auto callback = 7804 auto callback =
7804 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, 7805 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished,
7805 base::Unretained(this)); 7806 base::Unretained(this));
7806 // Schedule the decode twice for the same image. 7807 // Schedule the decode twice for the same image.
7807 layer_tree_host()->QueueImageDecode(image, callback); 7808 layer_tree_host()->QueueImageDecode(image, callback);
7808 layer_tree_host()->QueueImageDecode(image, callback); 7809 layer_tree_host()->QueueImageDecode(image, callback);
7809 } 7810 }
7810 7811
7811 void ImageDecodeFinished(bool decode_succeeded) { 7812 void ImageDecodeFinished(bool decode_succeeded) {
7812 EXPECT_TRUE(decode_succeeded); 7813 EXPECT_TRUE(decode_succeeded);
(...skipping 15 matching lines...) Expand all
7828 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { 7829 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest {
7829 protected: 7830 protected:
7830 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 7831 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
7831 7832
7832 void WillBeginMainFrame() override { 7833 void WillBeginMainFrame() override {
7833 if (!first_) 7834 if (!first_)
7834 return; 7835 return;
7835 first_ = false; 7836 first_ = false;
7836 7837
7837 bitmap_.allocN32Pixels(10, 10); 7838 bitmap_.allocN32Pixels(10, 10);
7838 sk_sp<const SkImage> image = SkImage::MakeFromBitmap(bitmap_); 7839 PaintImage image(PaintImage::GetNextId(), SkImage::MakeFromBitmap(bitmap_));
7839 auto callback = base::Bind( 7840 auto callback = base::Bind(
7840 &LayerTreeHostTestQueueImageDecodeNonLazy::ImageDecodeFinished, 7841 &LayerTreeHostTestQueueImageDecodeNonLazy::ImageDecodeFinished,
7841 base::Unretained(this)); 7842 base::Unretained(this));
7842 layer_tree_host()->QueueImageDecode(image, callback); 7843 layer_tree_host()->QueueImageDecode(image, callback);
7843 } 7844 }
7844 7845
7845 void ImageDecodeFinished(bool decode_succeeded) { 7846 void ImageDecodeFinished(bool decode_succeeded) {
7846 EXPECT_TRUE(decode_succeeded); 7847 EXPECT_TRUE(decode_succeeded);
7847 EndTest(); 7848 EndTest();
7848 } 7849 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
7968 void AfterTest() override {} 7969 void AfterTest() override {}
7969 7970
7970 private: 7971 private:
7971 bool received_ack_ = false; 7972 bool received_ack_ = false;
7972 }; 7973 };
7973 7974
7974 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); 7975 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
7975 7976
7976 } // namespace 7977 } // namespace
7977 } // namespace cc 7978 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698