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

Unified Diff: cc/resources/resource_update_controller.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_update_controller.h ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_update_controller.cc
diff --git a/cc/resources/resource_update_controller.cc b/cc/resources/resource_update_controller.cc
index 59c536b0844b495712447d1ec17c31c627915b85..868133596bec362c2292a4af59097a2cf7d6ac22 100644
--- a/cc/resources/resource_update_controller.cc
+++ b/cc/resources/resource_update_controller.cc
@@ -32,11 +32,7 @@ size_t ResourceUpdateController::MaxPartialTextureUpdates() {
size_t ResourceUpdateController::MaxFullUpdatesPerTick(
ResourceProvider* resource_provider) {
- double textures_per_second = resource_provider->EstimatedUploadsPerSecond();
- size_t textures_per_tick =
- floor(resource_provider->TextureUpdateTickRate().InSecondsF() *
- textures_per_second);
- return textures_per_tick ? textures_per_tick : 1;
+ return resource_provider->EstimatedUploadsPerTick();
}
ResourceUpdateController::ResourceUpdateController(
@@ -113,12 +109,9 @@ void ResourceUpdateController::OnTimerFired() {
client_->ReadyToFinalizeTextureUpdates();
}
-base::TimeTicks ResourceUpdateController::Now() const {
- return gfx::FrameTime::Now();
-}
-
-base::TimeDelta ResourceUpdateController::UpdateMoreTexturesTime() const {
- return resource_provider_->TextureUpdateTickRate();
+base::TimeTicks ResourceUpdateController::UpdateMoreTexturesCompletionTime() {
+ return resource_provider_->EstimatedUploadCompletionTime(
+ texture_updates_per_tick_);
}
size_t ResourceUpdateController::UpdateMoreTexturesSize() const {
@@ -129,25 +122,14 @@ size_t ResourceUpdateController::MaxBlockingUpdates() const {
return UpdateMoreTexturesSize() * kMaxBlockingUpdateIntervals;
}
-base::TimeDelta ResourceUpdateController::PendingUpdateTime() const {
- base::TimeDelta update_one_resource_time =
- UpdateMoreTexturesTime() / UpdateMoreTexturesSize();
- return update_one_resource_time * resource_provider_->NumBlockingUploads();
-}
-
bool ResourceUpdateController::UpdateMoreTexturesIfEnoughTimeRemaining() {
while (resource_provider_->NumBlockingUploads() < MaxBlockingUpdates()) {
if (!queue_->FullUploadSize())
return false;
if (!time_limit_.is_null()) {
- // Estimated completion time of all pending updates.
- base::TimeTicks completion_time = Now() + PendingUpdateTime();
-
- // Time remaining based on current completion estimate.
- base::TimeDelta time_remaining = time_limit_ - completion_time;
-
- if (time_remaining < UpdateMoreTexturesTime())
+ base::TimeTicks completion_time = UpdateMoreTexturesCompletionTime();
+ if (completion_time > time_limit_)
return true;
}
« no previous file with comments | « cc/resources/resource_update_controller.h ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698