diff options
-rw-r--r-- | cc/base/switches.cc | 6 | ||||
-rw-r--r-- | cc/base/switches.h | 1 | ||||
-rw-r--r-- | cc/base/worker_pool.cc | 298 | ||||
-rw-r--r-- | cc/base/worker_pool.h | 15 | ||||
-rw-r--r-- | cc/resources/managed_tile_state.cc | 2 | ||||
-rw-r--r-- | cc/resources/picture_pile_impl.cc | 4 | ||||
-rw-r--r-- | cc/resources/picture_pile_impl.h | 1 | ||||
-rw-r--r-- | cc/resources/raster_worker_pool.cc | 11 | ||||
-rw-r--r-- | cc/resources/raster_worker_pool.h | 4 | ||||
-rw-r--r-- | cc/resources/tile_manager.cc | 47 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 8 | ||||
-rw-r--r-- | cc/test/fake_picture_layer_tiling_client.cc | 1 | ||||
-rw-r--r-- | cc/test/fake_tile_manager.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 6 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.cc | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.h | 1 | ||||
-rw-r--r-- | cc/trees/thread_proxy.cc | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/chrome_restart_request.cc | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 1 | ||||
-rw-r--r-- | content/renderer/gpu/render_widget_compositor.cc | 2 |
21 files changed, 57 insertions, 359 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc index cf2e6c5d..6c694a9 100644 --- a/cc/base/switches.cc +++ b/cc/base/switches.cc @@ -35,7 +35,7 @@ const char kEnableRightAlignedScheduling[] = "enable-right-aligned-scheduling"; const char kEnableTopControlsPositionCalculation[] = "enable-top-controls-position-calculation"; -// Enable solid tile color, transparent tile, and cheapness prediction metrics. +// Enable solid tile color and transparent tile metrics. const char kEnablePredictionBenchmarking[] = "enable-prediction-benchmarking"; // The height of the movable top controls. @@ -62,10 +62,6 @@ const char kTraceAllRenderedFrames[] = "trace-all-rendered-frames"; // complete, such as --slow-down-raster-scale-factor=25. const char kSlowDownRasterScaleFactor[] = "slow-down-raster-scale-factor"; -// Disable scheduling of rasterization jobs according to their estimated -// processing cost. -const char kDisableCheapnessEstimator[] = "disable-cheapness-estimator"; - // The scale factor for low resolution tile contents. const char kLowResolutionContentsScaleFactor[] = "low-resolution-contents-scale-factor"; diff --git a/cc/base/switches.h b/cc/base/switches.h index 629afb3..2e9a3e3 100644 --- a/cc/base/switches.h +++ b/cc/base/switches.h @@ -17,7 +17,6 @@ namespace switches { // Switches for the renderer compositor only. CC_EXPORT extern const char kBackgroundColorInsteadOfCheckerboard[]; -CC_EXPORT extern const char kDisableCheapnessEstimator[]; CC_EXPORT extern const char kDisableColorEstimator[]; CC_EXPORT extern const char kDisableImplSidePainting[]; CC_EXPORT extern const char kDisableThreadedAnimation[]; diff --git a/cc/base/worker_pool.cc b/cc/base/worker_pool.cc index 0097ad9..fd07e6c 100644 --- a/cc/base/worker_pool.cc +++ b/cc/base/worker_pool.cc @@ -4,6 +4,11 @@ #include "cc/base/worker_pool.h" +#if defined(OS_ANDROID) +// TODO(epenner): Move thread priorities to base. (crbug.com/170549) +#include <sys/resource.h> +#endif + #include <algorithm> #include "base/bind.h" @@ -12,11 +17,6 @@ #include "base/synchronization/condition_variable.h" #include "base/threading/simple_thread.h" -#if defined(OS_ANDROID) -// TODO(epenner): Move thread priorities to base. (crbug.com/170549) -#include <sys/resource.h> -#endif - namespace cc { namespace { @@ -28,12 +28,6 @@ class WorkerPoolTaskImpl : public internal::WorkerPoolTask { : internal::WorkerPoolTask(reply), task_(task) {} - virtual bool IsCheap() OVERRIDE { return false; } - - virtual void Run() OVERRIDE { - task_.Run(); - } - virtual void RunOnThread(unsigned thread_index) OVERRIDE { task_.Run(); } @@ -65,33 +59,23 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { public: Inner(WorkerPool* worker_pool, size_t num_threads, - const std::string& thread_name_prefix, - bool need_on_task_completed_callback); + const std::string& thread_name_prefix); virtual ~Inner(); void Shutdown(); - void PostTask(scoped_ptr<internal::WorkerPoolTask> task, bool signal_workers); + void PostTask(scoped_ptr<internal::WorkerPoolTask> task); // Appends all completed tasks to worker pool's completed tasks queue // and returns true if idle. bool CollectCompletedTasks(); - // Runs cheap tasks on caller thread until |time_limit| is reached - // and returns true if idle. - bool RunCheapTasksUntilTimeLimit(base::TimeTicks time_limit); - private: // Appends all completed tasks to |completed_tasks|. Lock must // already be acquired before calling this function. bool AppendCompletedTasksWithLockAcquired( ScopedPtrDeque<internal::WorkerPoolTask>* completed_tasks); - // Schedule a OnTaskCompletedOnOriginThread callback if not already - // pending. Lock must already be acquired before calling this function. - void ScheduleOnTaskCompletedWithLockAcquired(); - void OnTaskCompletedOnOriginThread(); - // Schedule an OnIdleOnOriginThread callback if not already pending. // Lock must already be acquired before calling this function. void ScheduleOnIdleWithLockAcquired(); @@ -118,14 +102,6 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { base::WeakPtrFactory<Inner> weak_ptr_factory_; - // Set to true when worker pool requires a callback for each - // completed task. - bool need_on_task_completed_callback_; - - const base::Closure on_task_completed_callback_; - // Set when a OnTaskCompletedOnOriginThread() callback is pending. - bool on_task_completed_pending_; - const base::Closure on_idle_callback_; // Set when a OnIdleOnOriginThread() callback is pending. bool on_idle_pending_; @@ -152,18 +128,12 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { WorkerPool::Inner::Inner(WorkerPool* worker_pool, size_t num_threads, - const std::string& thread_name_prefix, - bool need_on_task_completed_callback) + const std::string& thread_name_prefix) : worker_pool_on_origin_thread_(worker_pool), lock_(), has_pending_tasks_cv_(&lock_), origin_loop_(base::MessageLoopProxy::current()), weak_ptr_factory_(this), - need_on_task_completed_callback_(need_on_task_completed_callback), - on_task_completed_callback_( - base::Bind(&WorkerPool::Inner::OnTaskCompletedOnOriginThread, - weak_ptr_factory_.GetWeakPtr())), - on_task_completed_pending_(false), on_idle_callback_(base::Bind(&WorkerPool::Inner::OnIdleOnOriginThread, weak_ptr_factory_.GetWeakPtr())), on_idle_pending_(false), @@ -178,8 +148,8 @@ WorkerPool::Inner::Inner(WorkerPool* worker_pool, this, thread_name_prefix + base::StringPrintf( - "Worker%lu", - static_cast<unsigned long>(workers_.size() + 1)).c_str())); + "Worker%u", + static_cast<unsigned>(workers_.size() + 1)).c_str())); worker->Start(); workers_.push_back(worker.Pass()); } @@ -216,15 +186,13 @@ void WorkerPool::Inner::Shutdown() { } } -void WorkerPool::Inner::PostTask(scoped_ptr<internal::WorkerPoolTask> task, - bool signal_workers) { +void WorkerPool::Inner::PostTask(scoped_ptr<internal::WorkerPoolTask> task) { base::AutoLock lock(lock_); pending_tasks_.push_back(task.Pass()); // There is more work available, so wake up worker thread. - if (signal_workers) - has_pending_tasks_cv_.Signal(); + has_pending_tasks_cv_.Signal(); } bool WorkerPool::Inner::CollectCompletedTasks() { @@ -234,57 +202,6 @@ bool WorkerPool::Inner::CollectCompletedTasks() { &worker_pool_on_origin_thread_->completed_tasks_); } -bool WorkerPool::Inner::RunCheapTasksUntilTimeLimit( - base::TimeTicks time_limit) { - base::AutoLock lock(lock_); - - while (base::TimeTicks::Now() < time_limit) { - scoped_ptr<internal::WorkerPoolTask> task; - - // Find next cheap task. - for (TaskDeque::iterator iter = pending_tasks_.begin(); - iter != pending_tasks_.end(); ++iter) { - if ((*iter)->IsCheap()) { - task = pending_tasks_.take(iter); - break; - } - } - - if (!task) { - // Schedule an idle callback if requested and not pending. - if (!running_task_count_ && pending_tasks_.empty()) - ScheduleOnIdleWithLockAcquired(); - - // Exit when no more cheap tasks are pending. - break; - } - - // Increment |running_task_count_| before starting to run task. - running_task_count_++; - - { - base::AutoUnlock unlock(lock_); - - task->Run(); - - // Append tasks directly to worker pool's completed tasks queue. - worker_pool_on_origin_thread_->completed_tasks_.push_back(task.Pass()); - if (need_on_task_completed_callback_) - worker_pool_on_origin_thread_->OnTaskCompleted(); - } - - // Decrement |running_task_count_| now that we are done running task. - running_task_count_--; - } - - if (!pending_tasks_.empty()) - has_pending_tasks_cv_.Signal(); - - // Append any other completed tasks before releasing lock. - return AppendCompletedTasksWithLockAcquired( - &worker_pool_on_origin_thread_->completed_tasks_); -} - bool WorkerPool::Inner::AppendCompletedTasksWithLockAcquired( ScopedPtrDeque<internal::WorkerPoolTask>* completed_tasks) { lock_.AssertAcquired(); @@ -295,29 +212,6 @@ bool WorkerPool::Inner::AppendCompletedTasksWithLockAcquired( return !running_task_count_ && pending_tasks_.empty(); } -void WorkerPool::Inner::ScheduleOnTaskCompletedWithLockAcquired() { - lock_.AssertAcquired(); - - if (on_task_completed_pending_ || !need_on_task_completed_callback_) - return; - origin_loop_->PostTask(FROM_HERE, on_task_completed_callback_); - on_task_completed_pending_ = true; -} - -void WorkerPool::Inner::OnTaskCompletedOnOriginThread() { - { - base::AutoLock lock(lock_); - - DCHECK(on_task_completed_pending_); - on_task_completed_pending_ = false; - - AppendCompletedTasksWithLockAcquired( - &worker_pool_on_origin_thread_->completed_tasks_); - } - - worker_pool_on_origin_thread_->OnTaskCompleted(); -} - void WorkerPool::Inner::ScheduleOnIdleWithLockAcquired() { lock_.AssertAcquired(); @@ -351,56 +245,52 @@ void WorkerPool::Inner::Run() { int nice_value = 10; // Idle priority. setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value); #endif - { - base::AutoLock lock(lock_); - // Get a unique thread index. - int thread_index = next_thread_index_++; - - while (true) { - if (pending_tasks_.empty()) { - // Exit when shutdown is set and no more tasks are pending. - if (shutdown_) - break; - - // Schedule an idle callback if requested and not pending. - if (!running_task_count_) - ScheduleOnIdleWithLockAcquired(); + base::AutoLock lock(lock_); - // Wait for new pending tasks. - has_pending_tasks_cv_.Wait(); - continue; - } + // Get a unique thread index. + int thread_index = next_thread_index_++; - // Get next task. - scoped_ptr<internal::WorkerPoolTask> task = pending_tasks_.take_front(); + while (true) { + if (pending_tasks_.empty()) { + // Exit when shutdown is set and no more tasks are pending. + if (shutdown_) + break; - // Increment |running_task_count_| before starting to run task. - running_task_count_++; + // Schedule an idle callback if requested and not pending. + if (!running_task_count_) + ScheduleOnIdleWithLockAcquired(); - // There may be more work available, so wake up another - // worker thread. - has_pending_tasks_cv_.Signal(); + // Wait for new pending tasks. + has_pending_tasks_cv_.Wait(); + continue; + } - { - base::AutoUnlock unlock(lock_); + // Get next task. + scoped_ptr<internal::WorkerPoolTask> task = pending_tasks_.take_front(); - task->RunOnThread(thread_index); - } + // Increment |running_task_count_| before starting to run task. + running_task_count_++; - completed_tasks_.push_back(task.Pass()); + // There may be more work available, so wake up another + // worker thread. + has_pending_tasks_cv_.Signal(); - // Decrement |running_task_count_| now that we are done running task. - running_task_count_--; + { + base::AutoUnlock unlock(lock_); - // Schedule a task completed callback if requested and not pending. - ScheduleOnTaskCompletedWithLockAcquired(); + task->RunOnThread(thread_index); } - // We noticed we should exit. Wake up the next worker so it knows it should - // exit as well (because the Shutdown() code only signals once). - has_pending_tasks_cv_.Signal(); + completed_tasks_.push_back(task.Pass()); + + // Decrement |running_task_count_| now that we are done running task. + running_task_count_--; } + + // We noticed we should exit. Wake up the next worker so it knows it should + // exit as well (because the Shutdown() code only signals once). + has_pending_tasks_cv_.Signal(); } WorkerPool::WorkerPool(WorkerPoolClient* client, @@ -412,18 +302,9 @@ WorkerPool::WorkerPool(WorkerPoolClient* client, weak_ptr_factory_(this), check_for_completed_tasks_delay_(check_for_completed_tasks_delay), check_for_completed_tasks_pending_(false), - run_cheap_tasks_callback_( - base::Bind(&WorkerPool::RunCheapTasks, - weak_ptr_factory_.GetWeakPtr())), - run_cheap_tasks_pending_(false), - inner_(make_scoped_ptr( - new Inner( - this, - num_threads, - thread_name_prefix, - // Request OnTaskCompleted() callback when check - // for completed tasks delay is 0. - check_for_completed_tasks_delay == base::TimeDelta()))) { + inner_(make_scoped_ptr(new Inner(this, + num_threads, + thread_name_prefix))) { } WorkerPool::~WorkerPool() { @@ -447,36 +328,19 @@ void WorkerPool::PostTaskAndReply( reply)).PassAs<internal::WorkerPoolTask>()); } -void WorkerPool::SetRunCheapTasksTimeLimit( - base::TimeTicks run_cheap_tasks_time_limit) { - run_cheap_tasks_time_limit_ = run_cheap_tasks_time_limit; - ScheduleRunCheapTasks(); -} - void WorkerPool::OnIdle() { TRACE_EVENT0("cc", "WorkerPool::OnIdle"); DispatchCompletionCallbacks(); } -void WorkerPool::OnTaskCompleted() { - TRACE_EVENT0("cc", "WorkerPool::OnTaskCompleted"); - - DispatchCompletionCallbacks(); -} - void WorkerPool::ScheduleCheckForCompletedTasks() { - if (check_for_completed_tasks_pending_ || - check_for_completed_tasks_delay_ == base::TimeDelta()) + if (check_for_completed_tasks_pending_) return; - check_for_completed_tasks_callback_.Reset( - base::Bind(&WorkerPool::CheckForCompletedTasks, - weak_ptr_factory_.GetWeakPtr())); - check_for_completed_tasks_time_ = base::TimeTicks::Now() + - check_for_completed_tasks_delay_; origin_loop_->PostDelayedTask( FROM_HERE, - check_for_completed_tasks_callback_.callback(), + base::Bind(&WorkerPool::CheckForCompletedTasks, + weak_ptr_factory_.GetWeakPtr()), check_for_completed_tasks_delay_); check_for_completed_tasks_pending_ = true; } @@ -493,14 +357,6 @@ void WorkerPool::CheckForCompletedTasks() { DispatchCompletionCallbacks(); } -void WorkerPool::CancelCheckForCompletedTasks() { - if (!check_for_completed_tasks_pending_) - return; - - check_for_completed_tasks_callback_.Cancel(); - check_for_completed_tasks_pending_ = false; -} - void WorkerPool::DispatchCompletionCallbacks() { TRACE_EVENT0("cc", "WorkerPool::DispatchCompletionCallbacks"); @@ -516,60 +372,10 @@ void WorkerPool::DispatchCompletionCallbacks() { } void WorkerPool::PostTask(scoped_ptr<internal::WorkerPoolTask> task) { - bool signal_workers = true; - if (task->IsCheap()) { - // To make cheap tasks more likely to run on the origin thread, don't wake - // workers when posting them. - signal_workers = false; - ScheduleRunCheapTasks(); - } - // Schedule check for completed tasks if not pending. ScheduleCheckForCompletedTasks(); - inner_->PostTask(task.Pass(), signal_workers); -} - -void WorkerPool::ScheduleRunCheapTasks() { - if (run_cheap_tasks_pending_) - return; - origin_loop_->PostTask(FROM_HERE, run_cheap_tasks_callback_); - run_cheap_tasks_pending_ = true; -} - -void WorkerPool::RunCheapTasks() { - TRACE_EVENT0("cc", "WorkerPool::RunCheapTasks"); - DCHECK(run_cheap_tasks_pending_); - run_cheap_tasks_pending_ = false; - - while (true) { - base::TimeTicks time_limit = run_cheap_tasks_time_limit_; - - if (!check_for_completed_tasks_time_.is_null()) - time_limit = std::min(time_limit, check_for_completed_tasks_time_); - - bool is_idle = inner_->RunCheapTasksUntilTimeLimit(time_limit); - - base::TimeTicks now = base::TimeTicks::Now(); - if (now >= run_cheap_tasks_time_limit_) { - TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks out of time", - TRACE_EVENT_SCOPE_THREAD); - break; - } - - // We must be out of cheap tasks if this happens. - if (!check_for_completed_tasks_pending_ || - now < check_for_completed_tasks_time_) - break; - - TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time", - TRACE_EVENT_SCOPE_THREAD); - CancelCheckForCompletedTasks(); - DispatchCompletionCallbacks(); - // Schedule another check for completed tasks if not idle. - if (!is_idle) - ScheduleCheckForCompletedTasks(); - } + inner_->PostTask(task.Pass()); } } // namespace cc diff --git a/cc/base/worker_pool.h b/cc/base/worker_pool.h index 172165c..8e14824 100644 --- a/cc/base/worker_pool.h +++ b/cc/base/worker_pool.h @@ -22,10 +22,6 @@ class WorkerPoolTask { public: virtual ~WorkerPoolTask(); - virtual bool IsCheap() = 0; - - virtual void Run() = 0; - virtual void RunOnThread(unsigned thread_index) = 0; void DidComplete(); @@ -73,9 +69,6 @@ class WorkerPool { // is posted to the thread that called PostTaskAndReply(). void PostTaskAndReply(const Callback& task, const base::Closure& reply); - // Set time limit for running cheap tasks. - void SetRunCheapTasksTimeLimit(base::TimeTicks run_cheap_tasks_time_limit); - protected: WorkerPool(WorkerPoolClient* client, size_t num_threads, @@ -92,21 +85,13 @@ class WorkerPool { void OnIdle(); void ScheduleCheckForCompletedTasks(); void CheckForCompletedTasks(); - void CancelCheckForCompletedTasks(); void DispatchCompletionCallbacks(); - void ScheduleRunCheapTasks(); - void RunCheapTasks(); WorkerPoolClient* client_; scoped_refptr<base::MessageLoopProxy> origin_loop_; base::WeakPtrFactory<WorkerPool> weak_ptr_factory_; - base::TimeTicks check_for_completed_tasks_time_; base::TimeDelta check_for_completed_tasks_delay_; - base::CancelableClosure check_for_completed_tasks_callback_; bool check_for_completed_tasks_pending_; - const base::Closure run_cheap_tasks_callback_; - base::TimeTicks run_cheap_tasks_time_limit_; - bool run_cheap_tasks_pending_; // Holds all completed tasks for which we have not yet dispatched // reply callbacks. diff --git a/cc/resources/managed_tile_state.cc b/cc/resources/managed_tile_state.cc index 3ccd27d..ae144be 100644 --- a/cc/resources/managed_tile_state.cc +++ b/cc/resources/managed_tile_state.cc @@ -72,8 +72,6 @@ scoped_ptr<base::Value> ManagedTileState::AsValue() const { state->Set("distance_to_visible_in_pixels", MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); - state->SetBoolean("is_cheap_to_raster", - picture_pile_analysis.is_cheap_to_raster); state->SetBoolean("is_transparent", picture_pile_analysis.is_transparent); state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); return state.PassAs<base::Value>(); diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc index 7db0ecf..865e878 100644 --- a/cc/resources/picture_pile_impl.cc +++ b/cc/resources/picture_pile_impl.cc @@ -263,7 +263,6 @@ void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, analysis->is_transparent = canvas.isTransparent(); analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); - analysis->is_cheap_to_raster = canvas.isCheap(); analysis->has_text = canvas.hasText(); canvas.consumeLazyPixelRefs(&analysis->lazy_pixel_refs); } @@ -271,8 +270,7 @@ void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, PicturePileImpl::Analysis::Analysis() : is_solid_color(false), is_transparent(false), - has_text(false), - is_cheap_to_raster(false) { + has_text(false) { } PicturePileImpl::Analysis::~Analysis() { diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h index d1ad2de..2bd34ba 100644 --- a/cc/resources/picture_pile_impl.h +++ b/cc/resources/picture_pile_impl.h @@ -62,7 +62,6 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase { bool is_solid_color; bool is_transparent; bool has_text; - bool is_cheap_to_raster; SkColor solid_color; skia::AnalysisCanvas::LazyPixelRefList lazy_pixel_refs; diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index c2a4a0b..0cb913d 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -13,29 +13,20 @@ namespace { class RasterWorkerPoolTaskImpl : public internal::WorkerPoolTask { public: RasterWorkerPoolTaskImpl(PicturePileImpl* picture_pile, - bool is_cheap, const RasterWorkerPool::RasterCallback& task, const base::Closure& reply) : internal::WorkerPoolTask(reply), picture_pile_(picture_pile), - is_cheap_(is_cheap), task_(task) { DCHECK(picture_pile_); } - virtual bool IsCheap() OVERRIDE { return is_cheap_; } - - virtual void Run() OVERRIDE { - task_.Run(picture_pile_.get()); - } - virtual void RunOnThread(unsigned thread_index) OVERRIDE { task_.Run(picture_pile_->GetCloneForDrawingOnThread(thread_index)); } private: scoped_refptr<PicturePileImpl> picture_pile_; - bool is_cheap_; RasterWorkerPool::RasterCallback task_; }; @@ -57,12 +48,10 @@ RasterWorkerPool::~RasterWorkerPool() { } void RasterWorkerPool::PostRasterTaskAndReply(PicturePileImpl* picture_pile, - bool is_cheap, const RasterCallback& task, const base::Closure& reply) { PostTask(make_scoped_ptr(new RasterWorkerPoolTaskImpl( picture_pile, - is_cheap, task, reply)).PassAs<internal::WorkerPoolTask>()); } diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index 0557946..8d3691d 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h @@ -15,8 +15,7 @@ class PicturePileImpl; // A worker thread pool that runs raster tasks. class RasterWorkerPool : public WorkerPool { public: - typedef base::Callback<void(PicturePileImpl*)> - RasterCallback; + typedef base::Callback<void(PicturePileImpl* picture_pile)> RasterCallback; virtual ~RasterWorkerPool(); @@ -26,7 +25,6 @@ class RasterWorkerPool : public WorkerPool { } void PostRasterTaskAndReply(PicturePileImpl* picture_pile, - bool is_cheap, const RasterCallback& task, const base::Closure& reply); diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index b0c54c8..08cea05 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -44,10 +44,6 @@ const int kMaxNumPendingTasksPerThread = 8; const int kMaxNumPendingTasksPerThread = 40; #endif -// Limit for time spent running cheap tasks during a single frame. -// TODO(skyostil): Determine this limit more dynamically. -const int kRunCheapTasksTimeMs = 6; - // Determine bin based on three categories of tiles: things we need now, // things we need soon, and eventually. inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { @@ -120,7 +116,6 @@ TileManager::TileManager( TileManagerClient* client, ResourceProvider* resource_provider, size_t num_raster_threads, - bool use_cheapness_estimator, bool use_color_estimator, bool prediction_benchmarking, RenderingStatsInstrumentation* rendering_stats_instrumentation) @@ -133,7 +128,6 @@ TileManager::TileManager( has_performed_uploads_since_last_flush_(false), ever_exceeded_memory_budget_(false), rendering_stats_instrumentation_(rendering_stats_instrumentation), - use_cheapness_estimator_(use_cheapness_estimator), use_color_estimator_(use_color_estimator), prediction_benchmarking_(prediction_benchmarking), did_initialize_visible_tile_(false), @@ -162,7 +156,6 @@ void TileManager::SetGlobalState( global_state_.memory_limit_in_bytes, global_state_.unused_memory_limit_in_bytes); ScheduleManageTiles(); - UpdateCheapTasksTimeLimit(); } void TileManager::RegisterTile(Tile* tile) { @@ -657,14 +650,11 @@ void TileManager::DispatchMoreTasks() { void TileManager::AnalyzeTile(Tile* tile) { ManagedTileState& managed_tile_state = tile->managed_state(); - if ((use_cheapness_estimator_ || use_color_estimator_) && - !managed_tile_state.picture_pile_analyzed) { + if (use_color_estimator_ && !managed_tile_state.picture_pile_analyzed) { tile->picture_pile()->AnalyzeInRect( tile->content_rect(), tile->contents_scale(), &managed_tile_state.picture_pile_analysis); - managed_tile_state.picture_pile_analysis.is_cheap_to_raster &= - use_cheapness_estimator_; managed_tile_state.picture_pile_analysis.is_solid_color &= use_color_estimator_; managed_tile_state.picture_pile_analysis.is_transparent &= @@ -786,23 +776,6 @@ scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster( return resource.Pass(); } -void TileManager::SetAnticipatedDrawTime(base::TimeTicks time) { - anticipated_draw_time_ = time; - UpdateCheapTasksTimeLimit(); -} - -void TileManager::UpdateCheapTasksTimeLimit() { - base::TimeTicks limit; - if (use_cheapness_estimator_ && - global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) { - limit = std::min( - base::TimeTicks::Now() + - base::TimeDelta::FromMilliseconds(kRunCheapTasksTimeMs), - anticipated_draw_time_); - } - raster_worker_pool_->SetRunCheapTasksTimeLimit(limit); -} - void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); @@ -814,10 +787,8 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { // skia requires that our buffer be 4-byte aligned CHECK(!(reinterpret_cast<intptr_t>(buffer) & 3)); - ManagedTileState& managed_tile_state = tile->managed_state(); raster_worker_pool_->PostRasterTaskAndReply( tile->picture_pile(), - managed_tile_state.picture_pile_analysis.is_cheap_to_raster, base::Bind(&TileManager::RunRasterTask, buffer, tile->content_rect(), @@ -942,10 +913,6 @@ void TileManager::RunRasterTask( if (metadata.prediction_benchmarking) { PicturePileImpl::Analysis analysis; picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); - bool is_predicted_cheap = analysis.is_cheap_to_raster; - bool is_actually_cheap = - raster_stats.best_rasterize_time.InMillisecondsF() <= 1.0f; - RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); DCHECK_EQ(bitmap.rowBytes(), static_cast<size_t>(bitmap.width() * bitmap.bytesPerPixel())); @@ -963,18 +930,6 @@ void TileManager::RunRasterTask( } // static -void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, - bool is_actually_cheap) { - if (is_predicted_cheap && !is_actually_cheap) - HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); - else if (!is_predicted_cheap && is_actually_cheap) - HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); - - HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", - is_predicted_cheap == is_actually_cheap); -} - -// static void TileManager::RecordSolidColorPredictorResults( const SkColor* actual_colors, size_t color_count, diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 944b54d..2a3f1ce 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -65,7 +65,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { TileManager(TileManagerClient* client, ResourceProvider *resource_provider, size_t num_raster_threads, - bool use_cheapess_estimator, bool use_color_estimator, bool prediction_benchmarking, RenderingStatsInstrumentation* rendering_stats_instrumentation); @@ -80,7 +79,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { void CheckForCompletedTileUploads(); void AbortPendingTileUploads(); void ForceTileUploadToComplete(Tile* tile); - void SetAnticipatedDrawTime(base::TimeTicks time); scoped_ptr<base::Value> BasicStateAsValue() const; scoped_ptr<base::Value> AllTilesAsValue() const; @@ -131,7 +129,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { client_->ScheduleManageTiles(); manage_tiles_pending_ = true; } - void UpdateCheapTasksTimeLimit(); void AnalyzeTile(Tile* tile); void GatherPixelRefsForTile(Tile* tile); void DispatchImageDecodeTasksForTile(Tile* tile); @@ -164,8 +161,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { skia::LazyPixelRef* pixel_ref, RenderingStatsInstrumentation* stats_instrumentation); - static void RecordCheapnessPredictorResults(bool is_predicted_cheap, - bool is_actually_cheap); static void RecordSolidColorPredictorResults(const SkColor* actual_colors, size_t color_count, bool is_predicted_solid, @@ -198,7 +193,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { RenderingStatsInstrumentation* rendering_stats_instrumentation_; - bool use_cheapness_estimator_; bool use_color_estimator_; bool prediction_benchmarking_; bool did_initialize_visible_tile_; @@ -206,8 +200,6 @@ class CC_EXPORT TileManager : public WorkerPoolClient { size_t pending_tasks_; size_t max_pending_tasks_; - base::TimeTicks anticipated_draw_time_; - DISALLOW_COPY_AND_ASSIGN(TileManager); }; diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index 0ee0483..7e35c38 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -28,7 +28,6 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient() 1, false, false, - false, &stats_instrumentation_), pile_(new FakeInfinitePicturePileImpl()) { } diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc index 355d331..ce5b51d 100644 --- a/cc/test/fake_tile_manager.cc +++ b/cc/test/fake_tile_manager.cc @@ -7,6 +7,6 @@ namespace cc { FakeTileManager::FakeTileManager(TileManagerClient* client) - : TileManager(client, NULL, 1, false, false, false, NULL) { + : TileManager(client, NULL, 1, false, false, NULL) { } } diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index a966089..2b708bb 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -299,11 +299,6 @@ void LayerTreeHostImpl::ManageTiles() { memory_used_bytes); } -void LayerTreeHostImpl::SetAnticipatedDrawTime(base::TimeTicks time) { - if (tile_manager_) - tile_manager_->SetAnticipatedDrawTime(time); -} - void LayerTreeHostImpl::StartPageScaleAnimation(gfx::Vector2d target_offset, bool anchor_point, float page_scale, @@ -1375,7 +1370,6 @@ bool LayerTreeHostImpl::InitializeRenderer( tile_manager_.reset(new TileManager(this, resource_provider.get(), settings_.num_raster_threads, - settings_.use_cheapness_estimator, settings_.use_color_estimator, settings_.prediction_benchmarking, rendering_stats_instrumentation_)); diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index df3f23f..612d718 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -152,7 +152,6 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, void SetViewportDamage(gfx::Rect damage_rect); void ManageTiles(); - void SetAnticipatedDrawTime(base::TimeTicks time); // Returns false if problems occured preparing the frame, and we should try // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index 8751577..ea0c90a 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -32,7 +32,6 @@ LayerTreeSettings::LayerTreeSettings() solid_color_scrollbar_color(SK_ColorWHITE), solid_color_scrollbar_thickness_dip(-1), calculate_top_controls_position(false), - use_cheapness_estimator(false), use_color_estimator(false), use_memory_management(true), prediction_benchmarking(false), diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index db9cb65..75db11f9 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -37,7 +37,6 @@ class CC_EXPORT LayerTreeSettings { SkColor solid_color_scrollbar_color; int solid_color_scrollbar_thickness_dip; bool calculate_top_controls_position; - bool use_cheapness_estimator; bool use_color_estimator; bool use_memory_management; bool prediction_benchmarking; diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index b6d30bf..3b051f7 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -1025,9 +1025,6 @@ ThreadProxy::ScheduledActionDrawAndSwapForced() { } void ThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { - if (layer_tree_host_impl_) - layer_tree_host_impl_->SetAnticipatedDrawTime(time); - if (current_resource_update_controller_on_impl_thread_) current_resource_update_controller_on_impl_thread_ ->PerformMoreUpdates(time); diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc index a5ab0e1..88976d6 100644 --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc @@ -136,7 +136,6 @@ std::string DeriveCommandLine(const GURL& start_url, // content/browser/renderer_host/render_process_host_impl.cc. cc::switches::kBackgroundColorInsteadOfCheckerboard, cc::switches::kCompositeToMailbox, - cc::switches::kDisableCheapnessEstimator, cc::switches::kDisableColorEstimator, cc::switches::kDisableImplSidePainting, cc::switches::kDisablePinchZoomScrollbars, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 4fdd872..c505f90 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -926,7 +926,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // also be added to chrome/browser/chromeos/login/chrome_restart_request.cc. cc::switches::kBackgroundColorInsteadOfCheckerboard, cc::switches::kCompositeToMailbox, - cc::switches::kDisableCheapnessEstimator, cc::switches::kDisableColorEstimator, cc::switches::kDisableImplSidePainting, cc::switches::kDisableThreadedAnimation, diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 10846c6..3fe9238 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -128,8 +128,6 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create( settings.right_aligned_scheduling_enabled = cmd->HasSwitch(cc::switches::kEnableRightAlignedScheduling); settings.impl_side_painting = cc::switches::IsImplSidePaintingEnabled(); - settings.use_cheapness_estimator = - !cmd->HasSwitch(cc::switches::kDisableCheapnessEstimator); settings.use_color_estimator = !cmd->HasSwitch(cc::switches::kDisableColorEstimator); settings.prediction_benchmarking = |