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

Unified Diff: cc/base/blocking_task_runner.cc

Issue 1535833002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-5
Patch Set: rebase Created 4 years, 11 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 | « cc/base/blocking_task_runner.h ('k') | cc/base/completion_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/blocking_task_runner.cc
diff --git a/cc/base/blocking_task_runner.cc b/cc/base/blocking_task_runner.cc
deleted file mode 100644
index d19d237546c4bd6a1a0f0ba425101384322135ce..0000000000000000000000000000000000000000
--- a/cc/base/blocking_task_runner.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2013 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 "cc/base/blocking_task_runner.h"
-
-#include <utility>
-
-#include "base/callback.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
-
-namespace cc {
-
-// static
-scoped_ptr<BlockingTaskRunner> BlockingTaskRunner::Create(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- return make_scoped_ptr(new BlockingTaskRunner(task_runner));
-}
-
-BlockingTaskRunner::BlockingTaskRunner(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : thread_id_(base::PlatformThread::CurrentId()),
- task_runner_(task_runner),
- capture_(0) {
-}
-
-BlockingTaskRunner::~BlockingTaskRunner() {
-}
-
-bool BlockingTaskRunner::BelongsToCurrentThread() {
- return base::PlatformThread::CurrentId() == thread_id_;
-}
-
-bool BlockingTaskRunner::PostTask(const tracked_objects::Location& from_here,
- const base::Closure& task) {
- base::AutoLock lock(lock_);
- DCHECK(task_runner_.get() || capture_);
- if (!capture_)
- return task_runner_->PostTask(from_here, task);
- captured_tasks_.push_back(task);
- return true;
-}
-
-void BlockingTaskRunner::SetCapture(bool capture) {
- DCHECK(BelongsToCurrentThread());
-
- std::vector<base::Closure> tasks;
-
- {
- base::AutoLock lock(lock_);
- capture_ += capture ? 1 : -1;
- DCHECK_GE(capture_, 0);
-
- if (capture_)
- return;
-
- // We're done capturing, so grab all the captured tasks and run them.
- tasks.swap(captured_tasks_);
- }
- for (size_t i = 0; i < tasks.size(); ++i)
- tasks[i].Run();
-}
-
-BlockingTaskRunner::CapturePostTasks::CapturePostTasks(
- BlockingTaskRunner* blocking_runner)
- : blocking_runner_(blocking_runner) {
- blocking_runner_->SetCapture(true);
-}
-
-BlockingTaskRunner::CapturePostTasks::~CapturePostTasks() {
- blocking_runner_->SetCapture(false);
-}
-
-} // namespace cc
« no previous file with comments | « cc/base/blocking_task_runner.h ('k') | cc/base/completion_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698