summaryrefslogtreecommitdiff
path: root/libs/hwui/thread/TaskManager.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-07-29 16:48:58 -0700
committerJohn Reck <jreck@google.com>2015-07-30 09:51:52 -0700
commit272a685f17cc4828257e521a6f62b7b17870f75e (patch)
tree490cc3f92f5c50debc07421395ab54c3fd7f2fd6 /libs/hwui/thread/TaskManager.cpp
parentc36df952292b69920d4764a8a37361073fcf4f2c (diff)
Replace most usages of utils/Vector.h
Change-Id: I540d1b3523244d6c71fc52d6fb30555271c25644
Diffstat (limited to 'libs/hwui/thread/TaskManager.cpp')
-rw-r--r--libs/hwui/thread/TaskManager.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index e9dde294b2aa..a07845ecf659 100644
--- a/libs/hwui/thread/TaskManager.cpp
+++ b/libs/hwui/thread/TaskManager.cpp
@@ -39,7 +39,7 @@ TaskManager::TaskManager() {
for (int i = 0; i < workerCount; i++) {
String8 name;
name.appendFormat("hwuiTask%d", i + 1);
- mThreads.add(new WorkerThread(name));
+ mThreads.push_back(new WorkerThread(name));
}
}
@@ -89,15 +89,14 @@ status_t TaskManager::WorkerThread::readyToRun() {
bool TaskManager::WorkerThread::threadLoop() {
mSignal.wait();
- Vector<TaskWrapper> tasks;
+ std::vector<TaskWrapper> tasks;
{
Mutex::Autolock l(mLock);
- tasks = mTasks;
- mTasks.clear();
+ tasks.swap(mTasks);
}
for (size_t i = 0; i < tasks.size(); i++) {
- const TaskWrapper& task = tasks.itemAt(i);
+ const TaskWrapper& task = tasks[i];
task.mProcessor->process(task.mTask);
}
@@ -111,14 +110,13 @@ bool TaskManager::WorkerThread::addTask(TaskWrapper task) {
return false;
}
- ssize_t index;
{
Mutex::Autolock l(mLock);
- index = mTasks.add(task);
+ mTasks.push_back(task);
}
mSignal.signal();
- return index >= 0;
+ return true;
}
size_t TaskManager::WorkerThread::getTaskCount() const {