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

Unified Diff: remoting/host/security_key/remote_security_key_message_reader_impl.cc

Issue 1852283003: Updating Message Reader and Writer classes to use an interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback Created 4 years, 8 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
Index: remoting/host/security_key/remote_security_key_message_reader_impl.cc
diff --git a/remoting/host/security_key/remote_security_key_message_reader.cc b/remoting/host/security_key/remote_security_key_message_reader_impl.cc
similarity index 81%
copy from remoting/host/security_key/remote_security_key_message_reader.cc
copy to remoting/host/security_key/remote_security_key_message_reader_impl.cc
index 149788707904c787f6046dbfb5fee53a05abe3e2..2eb441856aa102ddf8b88b9201c03364a1ea223a 100644
--- a/remoting/host/security_key/remote_security_key_message_reader.cc
+++ b/remoting/host/security_key/remote_security_key_message_reader_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/host/security_key/remote_security_key_message_reader.h"
+#include "remoting/host/security_key/remote_security_key_message_reader_impl.h"
#include <cstdint>
#include <string>
@@ -18,10 +18,10 @@
namespace remoting {
-RemoteSecurityKeyMessageReader::RemoteSecurityKeyMessageReader(
+RemoteSecurityKeyMessageReaderImpl::RemoteSecurityKeyMessageReaderImpl(
base::File input_file)
: read_stream_(std::move(input_file)),
- reader_thread_("RemoteSecurityKeyMessageReader"),
+ reader_thread_("RemoteSecurityKeyMessageReaderImpl"),
weak_factory_(this) {
base::Thread::Options options;
options.message_loop_type = base::MessageLoop::TYPE_IO;
@@ -31,7 +31,7 @@ RemoteSecurityKeyMessageReader::RemoteSecurityKeyMessageReader(
main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
-RemoteSecurityKeyMessageReader::~RemoteSecurityKeyMessageReader() {
+RemoteSecurityKeyMessageReaderImpl::~RemoteSecurityKeyMessageReaderImpl() {
DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
// In order to ensure the reader thread is stopped cleanly, we close the
@@ -40,9 +40,9 @@ RemoteSecurityKeyMessageReader::~RemoteSecurityKeyMessageReader() {
reader_thread_.Stop();
}
-void RemoteSecurityKeyMessageReader::Start(
- SecurityKeyMessageCallback message_callback,
- base::Closure error_callback) {
+void RemoteSecurityKeyMessageReaderImpl::Start(
+ const SecurityKeyMessageCallback& message_callback,
+ const base::Closure& error_callback) {
DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
message_callback_ = message_callback;
@@ -51,11 +51,11 @@ void RemoteSecurityKeyMessageReader::Start(
// base::Unretained is safe since this class owns the thread running this task
// which will be destroyed before this instance is.
read_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RemoteSecurityKeyMessageReader::ReadMessage,
+ FROM_HERE, base::Bind(&RemoteSecurityKeyMessageReaderImpl::ReadMessage,
base::Unretained(this)));
}
-void RemoteSecurityKeyMessageReader::ReadMessage() {
+void RemoteSecurityKeyMessageReaderImpl::ReadMessage() {
DCHECK(read_task_runner_->RunsTasksOnCurrentThread());
while (true) {
@@ -106,27 +106,27 @@ void RemoteSecurityKeyMessageReader::ReadMessage() {
// Notify callback of the new message received.
main_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&RemoteSecurityKeyMessageReader::InvokeMessageCallback,
+ base::Bind(&RemoteSecurityKeyMessageReaderImpl::InvokeMessageCallback,
weak_factory_.GetWeakPtr(), base::Passed(&message)));
}
}
-void RemoteSecurityKeyMessageReader::NotifyError() {
+void RemoteSecurityKeyMessageReaderImpl::NotifyError() {
DCHECK(read_task_runner_->RunsTasksOnCurrentThread());
main_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&RemoteSecurityKeyMessageReader::InvokeErrorCallback,
+ base::Bind(&RemoteSecurityKeyMessageReaderImpl::InvokeErrorCallback,
weak_factory_.GetWeakPtr()));
}
-void RemoteSecurityKeyMessageReader::InvokeMessageCallback(
+void RemoteSecurityKeyMessageReaderImpl::InvokeMessageCallback(
scoped_ptr<SecurityKeyMessage> message) {
DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
message_callback_.Run(std::move(message));
}
-void RemoteSecurityKeyMessageReader::InvokeErrorCallback() {
+void RemoteSecurityKeyMessageReaderImpl::InvokeErrorCallback() {
DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
error_callback_.Run();
}

Powered by Google App Engine
This is Rietveld 408576698