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

Unified Diff: cc/resources/resource_provider.cc

Issue 99553002: cc: Prevent ResourceUpdateContoller from uploading textures after lost context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_update_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 70ff34bea09c6c69ecf6eb7a593ab45b2bc953a0..d87e460db51452f0f16efb29c3e17ef34fa19182 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -23,6 +23,7 @@
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/gfx/frame_time.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/vector2d.h"
@@ -649,11 +650,14 @@ void ResourceProvider::MarkPendingUploadsAsNonBlocking() {
texture_uploader_->MarkPendingUploadsAsNonBlocking();
}
-double ResourceProvider::EstimatedUploadsPerSecond() {
+size_t ResourceProvider::EstimatedUploadsPerTick() {
if (!texture_uploader_)
- return 0.0;
+ return 1u;
- return texture_uploader_->EstimatedTexturesPerSecond();
+ double textures_per_second = texture_uploader_->EstimatedTexturesPerSecond();
+ size_t textures_per_tick = floor(
+ kTextureUploadTickRate * textures_per_second);
+ return textures_per_tick ? textures_per_tick : 1u;
}
void ResourceProvider::FlushUploads() {
@@ -670,13 +674,25 @@ void ResourceProvider::ReleaseCachedData() {
texture_uploader_->ReleaseCachedQueries();
}
-base::TimeDelta ResourceProvider::TextureUpdateTickRate() {
+base::TimeTicks ResourceProvider::EstimatedUploadCompletionTime(
+ size_t uploads_per_tick) {
+ if (lost_output_surface_)
+ return base::TimeTicks();
+
// Software resource uploads happen on impl thread, so don't bother batching
// them up and trying to wait for them to complete.
- double rate =
- texture_uploader_ ? kTextureUploadTickRate : kSoftwareUploadTickRate;
- return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond *
- rate);
+ if (!texture_uploader_) {
+ return gfx::FrameTime::Now() + base::TimeDelta::FromMicroseconds(
+ base::Time::kMicrosecondsPerSecond * kSoftwareUploadTickRate);
+ }
+
+ base::TimeDelta upload_one_texture_time =
+ base::TimeDelta::FromMicroseconds(
+ base::Time::kMicrosecondsPerSecond * kTextureUploadTickRate) /
+ uploads_per_tick;
+
+ size_t total_uploads = NumBlockingUploads() + uploads_per_tick;
+ return gfx::FrameTime::Now() + upload_one_texture_time * total_uploads;
}
void ResourceProvider::Flush() {
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_update_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698