| OLD | NEW | 
|    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 "cc/resources/resource_update_controller.h" |    5 #include "cc/resources/resource_update_controller.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/location.h" |    8 #include "base/location.h" | 
|    9 #include "base/single_thread_task_runner.h" |    9 #include "base/single_thread_task_runner.h" | 
|   10 #include "cc/resources/prioritized_resource.h" |   10 #include "cc/resources/prioritized_resource.h" | 
|   11 #include "cc/resources/resource_provider.h" |   11 #include "cc/resources/resource_provider.h" | 
 |   12 #include "ui/gfx/frame_time.h" | 
|   12  |   13  | 
|   13 namespace { |   14 namespace { | 
|   14  |   15  | 
|   15 // Number of partial updates we allow. |   16 // Number of partial updates we allow. | 
|   16 const size_t kPartialTextureUpdatesMax = 12; |   17 const size_t kPartialTextureUpdatesMax = 12; | 
|   17  |   18  | 
|   18 // Measured in seconds. |   19 // Measured in seconds. | 
|   19 const double kUploaderBusyTickRate = 0.001; |   20 const double kUploaderBusyTickRate = 0.001; | 
|   20  |   21  | 
|   21 // Number of blocking update intervals to allow. |   22 // Number of blocking update intervals to allow. | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  106   resource_provider_->FlushUploads(); |  107   resource_provider_->FlushUploads(); | 
|  107 } |  108 } | 
|  108  |  109  | 
|  109 void ResourceUpdateController::OnTimerFired() { |  110 void ResourceUpdateController::OnTimerFired() { | 
|  110   task_posted_ = false; |  111   task_posted_ = false; | 
|  111   if (!UpdateMoreTexturesIfEnoughTimeRemaining()) |  112   if (!UpdateMoreTexturesIfEnoughTimeRemaining()) | 
|  112     client_->ReadyToFinalizeTextureUpdates(); |  113     client_->ReadyToFinalizeTextureUpdates(); | 
|  113 } |  114 } | 
|  114  |  115  | 
|  115 base::TimeTicks ResourceUpdateController::Now() const { |  116 base::TimeTicks ResourceUpdateController::Now() const { | 
|  116   return base::TimeTicks::Now(); |  117   return gfx::FrameTime::Now(); | 
|  117 } |  118 } | 
|  118  |  119  | 
|  119 base::TimeDelta ResourceUpdateController::UpdateMoreTexturesTime() const { |  120 base::TimeDelta ResourceUpdateController::UpdateMoreTexturesTime() const { | 
|  120   return resource_provider_->TextureUpdateTickRate(); |  121   return resource_provider_->TextureUpdateTickRate(); | 
|  121 } |  122 } | 
|  122  |  123  | 
|  123 size_t ResourceUpdateController::UpdateMoreTexturesSize() const { |  124 size_t ResourceUpdateController::UpdateMoreTexturesSize() const { | 
|  124   return texture_updates_per_tick_; |  125   return texture_updates_per_tick_; | 
|  125 } |  126 } | 
|  126  |  127  | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  169   if (!uploads) |  170   if (!uploads) | 
|  170     return; |  171     return; | 
|  171  |  172  | 
|  172   while (queue_->FullUploadSize() && uploads--) |  173   while (queue_->FullUploadSize() && uploads--) | 
|  173     UpdateTexture(queue_->TakeFirstFullUpload()); |  174     UpdateTexture(queue_->TakeFirstFullUpload()); | 
|  174  |  175  | 
|  175   resource_provider_->FlushUploads(); |  176   resource_provider_->FlushUploads(); | 
|  176 } |  177 } | 
|  177  |  178  | 
|  178 }  // namespace cc |  179 }  // namespace cc | 
| OLD | NEW |