diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 23:53:03 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 23:53:03 +0000 |
commit | ff13e49b5490c1874a36a64afd0d4a127cc8c410 (patch) | |
tree | 6fecf9becd4bd46c394670325c443a02829062cd /cc/resources/worker_pool.cc | |
parent | 614ac3987f3e4f8c1339d8b832d8325f7e214510 (diff) | |
download | chromium_src-ff13e49b5490c1874a36a64afd0d4a127cc8c410.zip chromium_src-ff13e49b5490c1874a36a64afd0d4a127cc8c410.tar.gz chromium_src-ff13e49b5490c1874a36a64afd0d4a127cc8c410.tar.bz2 |
cc: Prioritize tasks with more dependents.
This makes the worker pool prioritize tasks with more dependents
when multiple tasks with the same priority are ready to run. The
result is that images used by multiple tiles will be decoded
before images only used by one tile.
This also refactors WorkerPoolTest to support testing of priority
code and adds useful unit tests.
BUG=255972
TEST=cc_unittests --gtest_filter=WorkerPoolTest.Priority
Review URL: https://chromiumcodereview.appspot.com/18294002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/worker_pool.cc')
-rw-r--r-- | cc/resources/worker_pool.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cc/resources/worker_pool.cc b/cc/resources/worker_pool.cc index 90e3032..44a655d 100644 --- a/cc/resources/worker_pool.cc +++ b/cc/resources/worker_pool.cc @@ -98,7 +98,11 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { bool operator()(const GraphNode* a, const GraphNode* b) { // In this system, numerically lower priority is run first. - return a->priority() > b->priority(); + if (a->priority() != b->priority()) + return a->priority() > b->priority(); + + // Run task with most dependents first when priority is the same. + return a->dependents().size() < b->dependents().size(); } }; |