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

Side by Side Diff: cc/ThrottledTextureUploaderTest.cpp

Issue 11008017: cc: Never block on uploads from previous frame and increase max pending uploads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename numPendingUploads to numBlockingUploads and discardPendingUploads to markPendingUploadsAsNon… Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cc/ThrottledTextureUploader.cpp ('k') | cc/UnthrottledTextureUploader.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "config.h" 5 #include "config.h"
6 6
7 #include "ThrottledTextureUploader.h" 7 #include "ThrottledTextureUploader.h"
8 8
9 #include "Extensions3DChromium.h" 9 #include "Extensions3DChromium.h"
10 #include "FakeWebGraphicsContext3D.h" 10 #include "FakeWebGraphicsContext3D.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 class FakeTexture : public cc::LayerTextureUpdater::Texture { 46 class FakeTexture : public cc::LayerTextureUpdater::Texture {
47 public: 47 public:
48 FakeTexture() : LayerTextureUpdater::Texture( 48 FakeTexture() : LayerTextureUpdater::Texture(
49 PassOwnPtr<cc::CCPrioritizedTexture>()) { } 49 PassOwnPtr<cc::CCPrioritizedTexture>()) { }
50 50
51 virtual void updateRect(cc::CCResourceProvider* , const cc::IntRect&, const cc::IntSize&) OVERRIDE { } 51 virtual void updateRect(cc::CCResourceProvider* , const cc::IntRect&, const cc::IntSize&) OVERRIDE { }
52 }; 52 };
53 53
54 54
55 TEST(ThrottledTextureUploaderTest, NumPendingUploads) 55 TEST(ThrottledTextureUploaderTest, NumBlockingUploads)
56 { 56 {
57 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting)); 57 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting));
58 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get()); 58 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get());
59 OwnPtr<FakeTexture> texture = adoptPtr(new FakeTexture); 59 OwnPtr<FakeTexture> texture = adoptPtr(new FakeTexture);
60 TextureUploader::Parameters upload; 60 TextureUploader::Parameters upload;
61 upload.texture = texture.get(); 61 upload.texture = texture.get();
62 upload.sourceRect = IntRect(); 62 upload.sourceRect = IntRect();
63 upload.destOffset = IntSize(); 63 upload.destOffset = IntSize();
64 64
65 fakeContext->setResultAvailable(0); 65 fakeContext->setResultAvailable(0);
66 EXPECT_EQ(0, uploader->numPendingUploads()); 66 EXPECT_EQ(0, uploader->numBlockingUploads());
67 uploader->beginUploads(); 67 uploader->beginUploads();
68 uploader->uploadTexture(NULL, upload); 68 uploader->uploadTexture(NULL, upload);
69 uploader->endUploads(); 69 uploader->endUploads();
70 EXPECT_EQ(1, uploader->numPendingUploads()); 70 EXPECT_EQ(1, uploader->numBlockingUploads());
71 uploader->beginUploads(); 71 uploader->beginUploads();
72 uploader->uploadTexture(NULL, upload); 72 uploader->uploadTexture(NULL, upload);
73 uploader->endUploads(); 73 uploader->endUploads();
74 EXPECT_EQ(2, uploader->numPendingUploads()); 74 EXPECT_EQ(2, uploader->numBlockingUploads());
75 75
76 fakeContext->setResultAvailable(1); 76 fakeContext->setResultAvailable(1);
77 EXPECT_EQ(0, uploader->numPendingUploads()); 77 EXPECT_EQ(0, uploader->numBlockingUploads());
78 uploader->beginUploads(); 78 uploader->beginUploads();
79 uploader->uploadTexture(NULL, upload); 79 uploader->uploadTexture(NULL, upload);
80 uploader->endUploads(); 80 uploader->endUploads();
81 EXPECT_EQ(0, uploader->numPendingUploads()); 81 EXPECT_EQ(0, uploader->numBlockingUploads());
82 uploader->beginUploads(); 82 uploader->beginUploads();
83 uploader->uploadTexture(NULL, upload); 83 uploader->uploadTexture(NULL, upload);
84 uploader->uploadTexture(NULL, upload); 84 uploader->uploadTexture(NULL, upload);
85 uploader->endUploads(); 85 uploader->endUploads();
86 EXPECT_EQ(0, uploader->numPendingUploads()); 86 EXPECT_EQ(0, uploader->numBlockingUploads());
87 }
88
89 TEST(ThrottledTextureUploaderTest, MarkPendingUploadsAsNonBlocking)
90 {
91 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting));
92 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get());
93 OwnPtr<FakeTexture> texture = adoptPtr(new FakeTexture);
94 TextureUploader::Parameters upload;
95 upload.texture = texture.get();
96 upload.sourceRect = IntRect();
97 upload.destOffset = IntSize();
98
99 fakeContext->setResultAvailable(0);
100 EXPECT_EQ(0, uploader->numBlockingUploads());
101 uploader->beginUploads();
102 uploader->uploadTexture(NULL, upload);
103 uploader->uploadTexture(NULL, upload);
104 uploader->endUploads();
105 EXPECT_EQ(2, uploader->numBlockingUploads());
106
107 uploader->markPendingUploadsAsNonBlocking();
108 EXPECT_EQ(0, uploader->numBlockingUploads());
109 uploader->beginUploads();
110 uploader->uploadTexture(NULL, upload);
111 uploader->endUploads();
112 EXPECT_EQ(1, uploader->numBlockingUploads());
113
114 fakeContext->setResultAvailable(1);
115 EXPECT_EQ(0, uploader->numBlockingUploads());
116 uploader->beginUploads();
117 uploader->uploadTexture(NULL, upload);
118 uploader->endUploads();
119 uploader->markPendingUploadsAsNonBlocking();
120 EXPECT_EQ(0, uploader->numBlockingUploads());
87 } 121 }
88 122
89 } // namespace 123 } // namespace
OLDNEW
« no previous file with comments | « cc/ThrottledTextureUploader.cpp ('k') | cc/UnthrottledTextureUploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698