| Index: remoting/host/security_key/security_key_message_reader_impl.cc
|
| diff --git a/remoting/host/security_key/remote_security_key_message_reader_impl.cc b/remoting/host/security_key/security_key_message_reader_impl.cc
|
| similarity index 78%
|
| rename from remoting/host/security_key/remote_security_key_message_reader_impl.cc
|
| rename to remoting/host/security_key/security_key_message_reader_impl.cc
|
| index fc19760af38d6f5a24eefc25387ccf2257f3916e..d129c87cedbbf4078e5a441a3f9b1740505ceab8 100644
|
| --- a/remoting/host/security_key/remote_security_key_message_reader_impl.cc
|
| +++ b/remoting/host/security_key/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_impl.h"
|
| +#include "remoting/host/security_key/security_key_message_reader_impl.h"
|
|
|
| #include <cstdint>
|
| #include <string>
|
| @@ -18,10 +18,10 @@
|
|
|
| namespace remoting {
|
|
|
| -RemoteSecurityKeyMessageReaderImpl::RemoteSecurityKeyMessageReaderImpl(
|
| +SecurityKeyMessageReaderImpl::SecurityKeyMessageReaderImpl(
|
| base::File input_file)
|
| : read_stream_(std::move(input_file)),
|
| - reader_thread_("RemoteSecurityKeyMessageReaderImpl"),
|
| + reader_thread_("SecurityKeyMessageReaderImpl"),
|
| weak_factory_(this) {
|
| base::Thread::Options options;
|
| options.message_loop_type = base::MessageLoop::TYPE_IO;
|
| @@ -31,7 +31,7 @@ RemoteSecurityKeyMessageReaderImpl::RemoteSecurityKeyMessageReaderImpl(
|
| main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
|
| }
|
|
|
| -RemoteSecurityKeyMessageReaderImpl::~RemoteSecurityKeyMessageReaderImpl() {
|
| +SecurityKeyMessageReaderImpl::~SecurityKeyMessageReaderImpl() {
|
| DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| // In order to ensure the reader thread is stopped cleanly, we want to stop
|
| @@ -39,7 +39,7 @@ RemoteSecurityKeyMessageReaderImpl::~RemoteSecurityKeyMessageReaderImpl() {
|
| reader_thread_.Stop();
|
| }
|
|
|
| -void RemoteSecurityKeyMessageReaderImpl::Start(
|
| +void SecurityKeyMessageReaderImpl::Start(
|
| const SecurityKeyMessageCallback& message_callback,
|
| const base::Closure& error_callback) {
|
| DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
|
| @@ -50,11 +50,11 @@ void RemoteSecurityKeyMessageReaderImpl::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(&RemoteSecurityKeyMessageReaderImpl::ReadMessage,
|
| + FROM_HERE, base::Bind(&SecurityKeyMessageReaderImpl::ReadMessage,
|
| base::Unretained(this)));
|
| }
|
|
|
| -void RemoteSecurityKeyMessageReaderImpl::ReadMessage() {
|
| +void SecurityKeyMessageReaderImpl::ReadMessage() {
|
| DCHECK(read_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| while (true) {
|
| @@ -92,13 +92,13 @@ void RemoteSecurityKeyMessageReaderImpl::ReadMessage() {
|
| // Notify callback of the new message received.
|
| main_task_runner_->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&RemoteSecurityKeyMessageReaderImpl::InvokeMessageCallback,
|
| + base::Bind(&SecurityKeyMessageReaderImpl::InvokeMessageCallback,
|
| weak_factory_.GetWeakPtr(), base::Passed(&message)));
|
| }
|
| }
|
|
|
| -bool RemoteSecurityKeyMessageReaderImpl::ReadFromStream(char* buffer,
|
| - size_t bytes_to_read) {
|
| +bool SecurityKeyMessageReaderImpl::ReadFromStream(char* buffer,
|
| + size_t bytes_to_read) {
|
| DCHECK(buffer);
|
| DCHECK_GT(bytes_to_read, 0u);
|
|
|
| @@ -121,22 +121,21 @@ bool RemoteSecurityKeyMessageReaderImpl::ReadFromStream(char* buffer,
|
| return true;
|
| }
|
|
|
| -void RemoteSecurityKeyMessageReaderImpl::NotifyError() {
|
| +void SecurityKeyMessageReaderImpl::NotifyError() {
|
| DCHECK(read_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| main_task_runner_->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&RemoteSecurityKeyMessageReaderImpl::InvokeErrorCallback,
|
| - weak_factory_.GetWeakPtr()));
|
| + FROM_HERE, base::Bind(&SecurityKeyMessageReaderImpl::InvokeErrorCallback,
|
| + weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void RemoteSecurityKeyMessageReaderImpl::InvokeMessageCallback(
|
| +void SecurityKeyMessageReaderImpl::InvokeMessageCallback(
|
| std::unique_ptr<SecurityKeyMessage> message) {
|
| DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
|
| message_callback_.Run(std::move(message));
|
| }
|
|
|
| -void RemoteSecurityKeyMessageReaderImpl::InvokeErrorCallback() {
|
| +void SecurityKeyMessageReaderImpl::InvokeErrorCallback() {
|
| DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
|
| error_callback_.Run();
|
| }
|
|
|