| 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();
|
| }
|
|
|