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

Side by Side Diff: cc/resource_update_controller.cc

Issue 11367054: cc: Move textureUploadFlushPeriod to TextureUploader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/resource_provider.cc ('k') | cc/texture_uploader.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 "cc/resource_update_controller.h" 7 #include "cc/resource_update_controller.h"
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/prioritized_texture.h" 10 #include "cc/prioritized_texture.h"
(...skipping 14 matching lines...) Expand all
25 25
26 // Number of partial updates we allow. 26 // Number of partial updates we allow.
27 const size_t partialTextureUpdatesMax = 12; 27 const size_t partialTextureUpdatesMax = 12;
28 28
29 // Measured in seconds. 29 // Measured in seconds.
30 const double textureUpdateTickRate = 0.004; 30 const double textureUpdateTickRate = 0.004;
31 31
32 // Measured in seconds. 32 // Measured in seconds.
33 const double uploaderBusyTickRate = 0.001; 33 const double uploaderBusyTickRate = 0.001;
34 34
35 // Flush interval when performing texture uploads.
36 const int textureUploadFlushPeriod = 4;
37
38 // Number of blocking update intervals to allow. 35 // Number of blocking update intervals to allow.
39 const size_t maxBlockingUpdateIntervals = 4; 36 const size_t maxBlockingUpdateIntervals = 4;
40 37
41 scoped_ptr<SkCanvas> createAcceleratedCanvas( 38 scoped_ptr<SkCanvas> createAcceleratedCanvas(
42 GrContext* grContext, gfx::Size canvasSize, unsigned textureId) 39 GrContext* grContext, gfx::Size canvasSize, unsigned textureId)
43 { 40 {
44 GrPlatformTextureDesc textureDesc; 41 GrPlatformTextureDesc textureDesc;
45 textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag; 42 textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag;
46 textureDesc.fWidth = canvasSize.width(); 43 textureDesc.fWidth = canvasSize.width();
47 textureDesc.fHeight = canvasSize.height(); 44 textureDesc.fHeight = canvasSize.height();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 static_cast<const uint8_t*>(update.bitmap->getPixels()), 183 static_cast<const uint8_t*>(update.bitmap->getPixels()),
187 update.content_rect, 184 update.content_rect,
188 update.source_rect, 185 update.source_rect,
189 update.dest_offset); 186 update.dest_offset);
190 update.bitmap->unlockPixels(); 187 update.bitmap->unlockPixels();
191 } 188 }
192 } 189 }
193 190
194 void ResourceUpdateController::finalize() 191 void ResourceUpdateController::finalize()
195 { 192 {
196 size_t uploadCount = 0; 193 while (m_queue->fullUploadSize())
197 while (m_queue->fullUploadSize()) { 194 updateTexture(m_queue->takeFirstFullUpload());
198 if (!(uploadCount % textureUploadFlushPeriod) && uploadCount)
199 m_resourceProvider->shallowFlushIfSupported();
200 195
201 updateTexture(m_queue->takeFirstFullUpload()); 196 while (m_queue->partialUploadSize())
202 uploadCount++; 197 updateTexture(m_queue->takeFirstPartialUpload());
203 }
204 198
205 while (m_queue->partialUploadSize()) { 199 m_resourceProvider->flushUploads();
206 if (!(uploadCount % textureUploadFlushPeriod) && uploadCount)
207 m_resourceProvider->shallowFlushIfSupported();
208
209 updateTexture(m_queue->takeFirstPartialUpload());
210 uploadCount++;
211 }
212
213 if (uploadCount)
214 m_resourceProvider->shallowFlushIfSupported();
215 200
216 if (m_queue->copySize()) { 201 if (m_queue->copySize()) {
217 TextureCopier* copier = m_resourceProvider->textureCopier(); 202 TextureCopier* copier = m_resourceProvider->textureCopier();
218 while (m_queue->copySize()) 203 while (m_queue->copySize())
219 copier->copyTexture(m_queue->takeFirstCopy()); 204 copier->copyTexture(m_queue->takeFirstCopy());
220 205
221 // If we've performed any texture copies, we need to insert a flush 206 // If we've performed any texture copies, we need to insert a flush
222 // here into the compositor context before letting the main thread 207 // here into the compositor context before letting the main thread
223 // proceed as it may make draw calls to the source texture of one of 208 // proceed as it may make draw calls to the source texture of one of
224 // our copy operations. 209 // our copy operations.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 size_t uploads = std::min( 269 size_t uploads = std::min(
285 m_queue->fullUploadSize(), updateMoreTexturesSize()); 270 m_queue->fullUploadSize(), updateMoreTexturesSize());
286 m_taskPosted = true; 271 m_taskPosted = true;
287 m_thread->postDelayedTask(base::Bind(&ResourceUpdateController::onTimerFired , 272 m_thread->postDelayedTask(base::Bind(&ResourceUpdateController::onTimerFired ,
288 m_weakFactory.GetWeakPtr()), 273 m_weakFactory.GetWeakPtr()),
289 updateMoreTexturesTime().InSecondsF() / updateMore TexturesSize() * uploads * 1000); 274 updateMoreTexturesTime().InSecondsF() / updateMore TexturesSize() * uploads * 1000);
290 275
291 if (!uploads) 276 if (!uploads)
292 return; 277 return;
293 278
294 size_t uploadCount = 0; 279 while (m_queue->fullUploadSize() && uploads--)
295 while (m_queue->fullUploadSize() && uploadCount < uploads) {
296 if (!(uploadCount % textureUploadFlushPeriod) && uploadCount)
297 m_resourceProvider->shallowFlushIfSupported();
298 updateTexture(m_queue->takeFirstFullUpload()); 280 updateTexture(m_queue->takeFirstFullUpload());
299 uploadCount++; 281
300 } 282 m_resourceProvider->flushUploads();
301 m_resourceProvider->shallowFlushIfSupported();
302 } 283 }
303 284
304 } // namespace cc 285 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resource_provider.cc ('k') | cc/texture_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698