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

Unified Diff: webrtc/base/worker.cc

Issue 2370793002: Delete unused base/worker.{cc,h}. (Closed)
Patch Set: Created 4 years, 3 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 | « webrtc/base/worker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/worker.cc
diff --git a/webrtc/base/worker.cc b/webrtc/base/worker.cc
deleted file mode 100644
index f31c43feda8cfed3c3e7e943009f1471f6c62066..0000000000000000000000000000000000000000
--- a/webrtc/base/worker.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2004 The WebRTC Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/base/worker.h"
-
-#include "webrtc/base/common.h"
-#include "webrtc/base/logging.h"
-#include "webrtc/base/thread.h"
-
-namespace rtc {
-
-enum {
- MSG_HAVEWORK = 0,
-};
-
-Worker::Worker() : worker_thread_(NULL) {}
-
-Worker::~Worker() {
- // We need to already be stopped before being destroyed. We cannot call
- // StopWork() from here because the subclass's data has already been
- // destructed, so OnStop() cannot be called.
- ASSERT(!worker_thread_);
-}
-
-bool Worker::StartWork() {
- rtc::Thread *me = rtc::Thread::Current();
- if (worker_thread_) {
- if (worker_thread_ == me) {
- // Already working on this thread, so nothing to do.
- return true;
- } else {
- LOG(LS_ERROR) << "Automatically switching threads is not supported";
- ASSERT(false);
- return false;
- }
- }
- worker_thread_ = me;
- OnStart();
- return true;
-}
-
-bool Worker::StopWork() {
- if (!worker_thread_) {
- // Already not working, so nothing to do.
- return true;
- } else if (worker_thread_ != rtc::Thread::Current()) {
- LOG(LS_ERROR) << "Stopping from a different thread is not supported";
- ASSERT(false);
- return false;
- }
- OnStop();
- worker_thread_->Clear(this, MSG_HAVEWORK);
- worker_thread_ = NULL;
- return true;
-}
-
-void Worker::HaveWork() {
- ASSERT(worker_thread_ != NULL);
- worker_thread_->Post(RTC_FROM_HERE, this, MSG_HAVEWORK);
-}
-
-void Worker::OnMessage(rtc::Message *msg) {
- ASSERT(msg->message_id == MSG_HAVEWORK);
- ASSERT(worker_thread_ == rtc::Thread::Current());
- OnHaveWork();
-}
-
-} // namespace rtc
« no previous file with comments | « webrtc/base/worker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698