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

Unified Diff: components/mus/gles2/command_buffer_task_runner.cc

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months 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 | « components/mus/gles2/command_buffer_task_runner.h ('k') | components/mus/gles2/gl_surface_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gles2/command_buffer_task_runner.cc
diff --git a/components/mus/gles2/command_buffer_task_runner.cc b/components/mus/gles2/command_buffer_task_runner.cc
deleted file mode 100644
index df1dc548b6a62830acb82de8d45d4944cf513cd8..0000000000000000000000000000000000000000
--- a/components/mus/gles2/command_buffer_task_runner.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_task_runner.h"
-
-#include "base/bind.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-
-namespace mus {
-
-CommandBufferTaskRunner::CommandBufferTaskRunner()
- : task_runner_(base::ThreadTaskRunnerHandle::Get()),
- need_post_task_(true) {
-}
-
-bool CommandBufferTaskRunner::PostTask(
- const CommandBufferDriver* driver,
- const TaskCallback& task) {
- base::AutoLock locker(lock_);
- driver_map_[driver].push_back(task);
- ScheduleTaskIfNecessaryLocked();
- return true;
-}
-
-CommandBufferTaskRunner::~CommandBufferTaskRunner() {}
-
-bool CommandBufferTaskRunner::RunOneTaskInternalLocked() {
- DCHECK(thread_checker_.CalledOnValidThread());
- lock_.AssertAcquired();
-
- for (auto it = driver_map_.begin(); it != driver_map_.end(); ++it) {
- if (!it->first->IsScheduled())
- continue;
- TaskQueue& task_queue = it->second;
- DCHECK(!task_queue.empty());
- const TaskCallback& callback = task_queue.front();
- bool complete = false;
- {
- base::AutoUnlock unlocker(lock_);
- complete = callback.Run();
- }
- if (complete) {
- // Only remove the task if it is complete.
- task_queue.pop_front();
- if (task_queue.empty())
- driver_map_.erase(it);
- }
- return true;
- }
- return false;
-}
-
-void CommandBufferTaskRunner::ScheduleTaskIfNecessaryLocked() {
- lock_.AssertAcquired();
- if (!need_post_task_)
- return;
- task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferTaskRunner::RunCommandBufferTask, this));
- need_post_task_ = false;
-}
-
-void CommandBufferTaskRunner::RunCommandBufferTask() {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::AutoLock locker(lock_);
-
- // Try executing all tasks in |driver_map_| until |RunOneTaskInternalLock()|
- // returns false (Returning false means |driver_map_| is empty or all tasks
- // in it aren't executable currently).
- while (RunOneTaskInternalLocked())
- ;
- need_post_task_ = true;
-}
-
-} // namespace mus
« no previous file with comments | « components/mus/gles2/command_buffer_task_runner.h ('k') | components/mus/gles2/gl_surface_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698