Skip to content

Commit 8aac734

Browse files
committed
Rename AsioThread to Thread.
1 parent d727a74 commit 8aac734

17 files changed

+53
-51
lines changed

source/base/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,10 @@ list(APPEND SOURCE_BASE_THREADING
624624
threading/asio_event_dispatcher.h
625625
threading/asio_task_runner.cc
626626
threading/asio_task_runner.h
627-
threading/asio_thread.cc
628-
threading/asio_thread.h
629627
threading/simple_thread.cc
630628
threading/simple_thread.h
629+
threading/thread.cc
630+
threading/thread.h
631631
threading/thread_checker.cc
632632
threading/thread_checker.h)
633633

source/base/audio/audio_capturer_wrapper.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace base {
2828
//--------------------------------------------------------------------------------------------------
2929
AudioCapturerWrapper::AudioCapturerWrapper(std::shared_ptr<IpcChannelProxy> channel_proxy)
3030
: channel_proxy_(std::move(channel_proxy)),
31-
thread_(std::make_unique<AsioThread>(AsioThread::EventDispatcher::ASIO, this))
31+
thread_(std::make_unique<Thread>(Thread::AsioDispatcher, this))
3232
{
3333
LOG(LS_INFO) << "Ctor";
3434
DCHECK(channel_proxy_);
@@ -53,7 +53,7 @@ void AudioCapturerWrapper::start()
5353
//--------------------------------------------------------------------------------------------------
5454
void AudioCapturerWrapper::onBeforeThreadRunning()
5555
{
56-
thread_->setPriority(AsioThread::HighestPriority);
56+
thread_->setPriority(Thread::HighestPriority);
5757

5858
capturer_ = AudioCapturer::create();
5959
if (!capturer_)

source/base/audio/audio_capturer_wrapper.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
#ifndef BASE_AUDIO_AUDIO_CAPTURER_WRAPPER_H
2020
#define BASE_AUDIO_AUDIO_CAPTURER_WRAPPER_H
2121

22-
#include "base/threading/asio_thread.h"
22+
#include "base/threading/thread.h"
2323
#include "proto/desktop_internal.pb.h"
2424

2525
namespace base {
2626

2727
class AudioCapturer;
2828
class IpcChannelProxy;
2929

30-
class AudioCapturerWrapper final : public AsioThread::Delegate
30+
class AudioCapturerWrapper final : public Thread::Delegate
3131
{
3232
public:
3333
explicit AudioCapturerWrapper(std::shared_ptr<IpcChannelProxy> channel_proxy);
@@ -42,7 +42,7 @@ class AudioCapturerWrapper final : public AsioThread::Delegate
4242

4343
private:
4444
std::shared_ptr<IpcChannelProxy> channel_proxy_;
45-
std::unique_ptr<AsioThread> thread_;
45+
std::unique_ptr<Thread> thread_;
4646
std::unique_ptr<AudioCapturer> capturer_;
4747
proto::internal::DesktopToService outgoing_message_;
4848

source/base/ipc/ipc_channel.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "base/ipc/ipc_channel_proxy.h"
2424
#include "base/strings/unicode.h"
2525
#include "base/threading/asio_event_dispatcher.h"
26-
#include "base/threading/asio_thread.h"
26+
#include "base/threading/thread.h"
2727

2828
#include <asio/read.hpp>
2929
#include <asio/write.hpp>
@@ -176,7 +176,7 @@ void IpcChannel::Handler::onReadData(const std::error_code& error_code, size_t b
176176
IpcChannel::IpcChannel(QObject* parent)
177177
: QObject(parent),
178178
stream_(AsioEventDispatcher::currentIoContext()),
179-
proxy_(new IpcChannelProxy(AsioThread::currentTaskRunner(), this)),
179+
proxy_(new IpcChannelProxy(Thread::currentTaskRunner(), this)),
180180
handler_(base::make_local_shared<Handler>(this))
181181
{
182182
LOG(LS_INFO) << "Ctor";
@@ -187,7 +187,7 @@ IpcChannel::IpcChannel(const QString& channel_name, Stream&& stream, QObject* pa
187187
: QObject(parent),
188188
channel_name_(channel_name),
189189
stream_(std::move(stream)),
190-
proxy_(new IpcChannelProxy(AsioThread::currentTaskRunner(), this)),
190+
proxy_(new IpcChannelProxy(Thread::currentTaskRunner(), this)),
191191
is_connected_(true),
192192
handler_(base::make_local_shared<Handler>(this))
193193
{

source/base/net/tcp_channel.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "base/net/tcp_channel_proxy.h"
2727
#include "base/strings/unicode.h"
2828
#include "base/threading/asio_event_dispatcher.h"
29-
#include "base/threading/asio_thread.h"
29+
#include "base/threading/thread.h"
3030

3131
#include <asio/connect.hpp>
3232
#include <asio/read.hpp>
@@ -164,7 +164,7 @@ void TcpChannel::Handler::onKeepAliveTimeout(const std::error_code& error_code)
164164
//--------------------------------------------------------------------------------------------------
165165
TcpChannel::TcpChannel(QObject* parent)
166166
: NetworkChannel(parent),
167-
proxy_(new TcpChannelProxy(base::AsioThread::currentTaskRunner(), this)),
167+
proxy_(new TcpChannelProxy(base::Thread::currentTaskRunner(), this)),
168168
io_context_(base::AsioEventDispatcher::currentIoContext()),
169169
socket_(io_context_),
170170
resolver_(std::make_unique<asio::ip::tcp::resolver>(io_context_)),
@@ -178,7 +178,7 @@ TcpChannel::TcpChannel(QObject* parent)
178178
//--------------------------------------------------------------------------------------------------
179179
TcpChannel::TcpChannel(asio::ip::tcp::socket&& socket, QObject* parent)
180180
: NetworkChannel(parent),
181-
proxy_(new TcpChannelProxy(base::AsioThread::currentTaskRunner(), this)),
181+
proxy_(new TcpChannelProxy(base::Thread::currentTaskRunner(), this)),
182182
io_context_(base::AsioEventDispatcher::currentIoContext()),
183183
socket_(std::move(socket)),
184184
connected_(true),

source/base/threading/asio_thread.cc renamed to source/base/threading/thread.cc

+12-10
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,40 @@
1616
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
//
1818

19-
#include "base/threading/asio_thread.h"
19+
#include "base/threading/thread.h"
2020

2121
#include "base/threading/asio_event_dispatcher.h"
2222
#include "base/threading/asio_task_runner.h"
2323
#include "base/application.h"
2424
#include "base/logging.h"
2525

26-
#if defined(Q_OS_WIN)
26+
#if defined(Q_OS_WINDOWS)
2727
#include "base/win/scoped_com_initializer.h"
28-
#endif // defined(Q_OS_WIN)
28+
#endif // defined(Q_OS_WINDOWS)
2929

3030
namespace base {
3131

3232
//--------------------------------------------------------------------------------------------------
33-
AsioThread::AsioThread(EventDispatcher event_dispatcher, Delegate* delegate, QObject* parent)
33+
Thread::Thread(EventDispatcher dispatcher, Delegate* delegate, QObject* parent)
3434
: QThread(parent),
3535
delegate_(delegate)
3636
{
37-
if (event_dispatcher == EventDispatcher::ASIO)
37+
if (dispatcher == AsioDispatcher)
3838
setEventDispatcher(new AsioEventDispatcher());
3939
}
4040

4141
//--------------------------------------------------------------------------------------------------
42-
void AsioThread::stop()
42+
void Thread::stop()
4343
{
4444
quit();
4545
wait();
4646
}
4747

4848
//--------------------------------------------------------------------------------------------------
4949
// static
50-
std::shared_ptr<TaskRunner> AsioThread::currentTaskRunner()
50+
std::shared_ptr<TaskRunner> Thread::currentTaskRunner()
5151
{
52-
AsioThread* thread = dynamic_cast<AsioThread*>(QThread::currentThread());
52+
Thread* thread = dynamic_cast<Thread*>(QThread::currentThread());
5353
if (thread)
5454
return thread->taskRunner();
5555

@@ -60,18 +60,20 @@ std::shared_ptr<TaskRunner> AsioThread::currentTaskRunner()
6060
}
6161

6262
//--------------------------------------------------------------------------------------------------
63-
std::shared_ptr<base::TaskRunner> AsioThread::taskRunner()
63+
std::shared_ptr<base::TaskRunner> Thread::taskRunner()
6464
{
6565
return task_runner_;
6666
}
6767

6868
//--------------------------------------------------------------------------------------------------
69-
void AsioThread::run()
69+
void Thread::run()
7070
{
7171
task_runner_ = std::make_shared<AsioTaskRunner>();
7272

73+
#if defined(Q_OS_WINDOWS)
7374
win::ScopedCOMInitializer com_initializer;
7475
CHECK(com_initializer.isSucceeded());
76+
#endif // defined(Q_OS_WINDOWS)
7577

7678
if (delegate_)
7779
delegate_->onBeforeThreadRunning();

source/base/threading/asio_thread.h renamed to source/base/threading/thread.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
//
1818

19-
#ifndef BASE_THREADING_ASIO_THREAD_H
20-
#define BASE_THREADING_ASIO_THREAD_H
19+
#ifndef BASE_THREADING_THREAD_H
20+
#define BASE_THREADING_THREAD_H
2121

2222
#include "base/macros_magic.h"
2323
#include "base/task_runner.h"
@@ -26,10 +26,10 @@
2626

2727
namespace base {
2828

29-
class AsioThread final : public QThread
29+
class Thread final : public QThread
3030
{
3131
public:
32-
enum class EventDispatcher { ASIO, QT };
32+
enum EventDispatcher { AsioDispatcher, QtDispatcher };
3333

3434
class Delegate
3535
{
@@ -49,7 +49,7 @@ class AsioThread final : public QThread
4949
}
5050
};
5151

52-
AsioThread(EventDispatcher event_dispatcher, Delegate* delegate, QObject* parent = nullptr);
52+
Thread(EventDispatcher dispatcher, Delegate* delegate, QObject* parent = nullptr);
5353

5454
void stop();
5555

@@ -64,9 +64,9 @@ class AsioThread final : public QThread
6464
std::shared_ptr<TaskRunner> task_runner_;
6565
Delegate* delegate_ = nullptr;
6666

67-
DISALLOW_COPY_AND_ASSIGN(AsioThread);
67+
DISALLOW_COPY_AND_ASSIGN(Thread);
6868
};
6969

7070
} // namespace base
7171

72-
#endif // BASE_THREADING_ASIO_THREAD_H
72+
#endif // BASE_THREADING_THREAD_H

source/client/online_checker/online_checker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace client {
2525

2626
//--------------------------------------------------------------------------------------------------
2727
OnlineChecker::OnlineChecker(std::shared_ptr<base::TaskRunner> ui_task_runner)
28-
: io_thread_(base::AsioThread::EventDispatcher::ASIO, this),
28+
: io_thread_(base::Thread::AsioDispatcher, this),
2929
ui_task_runner_(std::move(ui_task_runner))
3030
{
3131
LOG(LS_INFO) << "Ctor";

source/client/online_checker/online_checker.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "base/macros_magic.h"
2323
#include "base/scoped_task_runner.h"
24-
#include "base/threading/asio_thread.h"
24+
#include "base/threading/thread.h"
2525
#include "client/online_checker/online_checker_direct.h"
2626
#include "client/online_checker/online_checker_router.h"
2727

@@ -33,7 +33,7 @@
3333
namespace client {
3434

3535
class OnlineChecker final
36-
: public base::AsioThread::Delegate,
36+
: public base::Thread::Delegate,
3737
public OnlineCheckerDirect::Delegate,
3838
public OnlineCheckerRouter::Delegate
3939
{
@@ -76,7 +76,7 @@ class OnlineChecker final
7676
void onRouterCheckerFinished() final;
7777

7878
private:
79-
base::AsioThread io_thread_;
79+
base::Thread io_thread_;
8080
std::shared_ptr<base::TaskRunner> io_task_runner_;
8181
base::ScopedTaskRunner ui_task_runner_;
8282

source/common/clipboard_monitor.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ namespace common {
3636
namespace {
3737

3838
#if defined(Q_OS_WIN)
39-
const base::AsioThread::EventDispatcher kEventDispatcher = base::AsioThread::EventDispatcher::QT;
39+
const base::Thread::EventDispatcher kEventDispatcher = base::Thread::QtDispatcher;
4040
#else
41-
const base::AsioThread::EventDispatcher kEventDispatcher = base::AsioThread::EventDispatcher::ASIO;
41+
const base::Thread::EventDispatcher kEventDispatcher = base::Thread::AsioDispatcher;
4242
#endif
4343

4444
} // namespace
4545

4646
//--------------------------------------------------------------------------------------------------
4747
ClipboardMonitor::ClipboardMonitor(QObject* parent)
4848
: QObject(parent),
49-
thread_(std::make_unique<base::AsioThread>(kEventDispatcher, this))
49+
thread_(std::make_unique<base::Thread>(kEventDispatcher, this))
5050
{
5151
LOG(LS_INFO) << "Ctor";
5252
}

source/common/clipboard_monitor.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
#ifndef COMMON_CLIPBOARD_MONITOR_H
2020
#define COMMON_CLIPBOARD_MONITOR_H
2121

22-
#include "base/threading/asio_thread.h"
22+
#include "base/threading/thread.h"
2323
#include "common/clipboard.h"
2424

2525
namespace common {
2626

2727
class ClipboardMonitor final
2828
: public QObject,
29-
public base::AsioThread::Delegate
29+
public base::Thread::Delegate
3030
{
3131
Q_OBJECT
3232

@@ -50,7 +50,7 @@ class ClipboardMonitor final
5050
void onAfterThreadRunning() final;
5151

5252
private:
53-
std::unique_ptr<base::AsioThread> thread_;
53+
std::unique_ptr<base::Thread> thread_;
5454
std::unique_ptr<common::Clipboard> clipboard_;
5555

5656
DISALLOW_COPY_AND_ASSIGN(ClipboardMonitor);

source/host/desktop_session_agent.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const char* controlActionToString(proto::internal::DesktopControl::Action action
7272
//--------------------------------------------------------------------------------------------------
7373
DesktopSessionAgent::DesktopSessionAgent(QObject* parent)
7474
: QObject(parent),
75-
ui_thread_(base::AsioThread::EventDispatcher::QT, this),
75+
ui_thread_(base::Thread::QtDispatcher, this),
7676
screen_capture_timer_(new QTimer(this)),
7777
incoming_message_(std::make_unique<proto::internal::ServiceToDesktop>()),
7878
outgoing_message_(std::make_unique<proto::internal::DesktopToService>())

source/host/desktop_session_agent.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "base/desktop/screen_capturer_wrapper.h"
2424
#include "base/ipc/ipc_channel.h"
2525
#include "base/ipc/shared_memory_factory.h"
26-
#include "base/threading/asio_thread.h"
26+
#include "base/threading/thread.h"
2727
#include "common/clipboard_monitor.h"
2828
#include "proto/desktop_internal.pb.h"
2929

@@ -55,7 +55,7 @@ class DesktopSessionAgent final
5555
public base::IpcChannel::Listener,
5656
public base::SharedMemoryFactory::Delegate,
5757
public base::ScreenCapturerWrapper::Delegate,
58-
public base::AsioThread::Delegate
58+
public base::Thread::Delegate
5959
{
6060
Q_OBJECT
6161

@@ -103,7 +103,7 @@ private slots:
103103
bool is_session_enabled_ = false;
104104

105105
#if defined(OS_WIN)
106-
base::AsioThread ui_thread_;
106+
base::Thread ui_thread_;
107107
std::unique_ptr<base::win::MessageWindow> message_window_;
108108
#endif // defined(OS_WIN)
109109

source/qt_base/application.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ bool isSameApplication(const QLocalSocket* socket)
111111
//--------------------------------------------------------------------------------------------------
112112
Application::Application(int& argc, char* argv[])
113113
: QApplication(argc, argv),
114-
io_thread_(base::AsioThread::EventDispatcher::ASIO, nullptr)
114+
io_thread_(base::Thread::AsioDispatcher, nullptr)
115115
{
116116
LOG(LS_INFO) << "Ctor";
117117

source/qt_base/application.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef QT_BASE_APPLICATION_H
2020
#define QT_BASE_APPLICATION_H
2121

22-
#include "base/threading/asio_thread.h"
22+
#include "base/threading/thread.h"
2323
#include "qt_base/locale_loader.h"
2424

2525
#include <QApplication>
@@ -71,7 +71,7 @@ private slots:
7171
QLockFile* lock_file_ = nullptr;
7272
QLocalServer* server_ = nullptr;
7373

74-
base::AsioThread io_thread_;
74+
base::Thread io_thread_;
7575
std::unique_ptr<base::ScopedCryptoInitializer> crypto_initializer_;
7676
std::unique_ptr<LocaleLoader> locale_loader_;
7777
std::shared_ptr<base::TaskRunner> ui_task_runner_;

source/relay/sessions_worker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SessionsWorker::SessionsWorker(const QString& listen_interface,
3636
statistics_enabled_(statistics_enabled),
3737
statistics_interval_(statistics_interval),
3838
shared_pool_(std::move(shared_pool)),
39-
thread_(std::make_unique<base::AsioThread>(base::AsioThread::EventDispatcher::ASIO, this))
39+
thread_(std::make_unique<base::Thread>(base::Thread::AsioDispatcher, this))
4040
{
4141
LOG(LS_INFO) << "Ctor";
4242
DCHECK(peer_port_ && shared_pool_);

0 commit comments

Comments
 (0)