Fixing nested namespace and thread checker macros in //remoting/protocol
Since working in this directory I've noticed that the presubmits will
'fail' if you modify a file with a nested namespace with the suggestion
that you should use the new style (namespace1::namespace2). I'd like to
be able to make quick modifications when needed without also dealing
with namespace formatting so I decided to fix this in a separate CL.
Along the same lines, I noticed that we aren't using the suggested
ThreadChecker macros consistently so I fixed that as well.
This CL also contains a small number of comment reflows and simple
modernization changes. I didn't do this exhaustively but there are a
handful which I noticed while fixing the other problems
No functional changes are expected as a result of these changes.
Change-Id: Ib99429b79fc9a3c55596602e279be8487866660c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3852429
Commit-Queue: Joe Downing <[email protected]>
Reviewed-by: Lambros Lambrou <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1039396}
diff --git a/remoting/protocol/audio_decode_scheduler.cc b/remoting/protocol/audio_decode_scheduler.cc
index 12d6cfa..f3a7492c 100644
--- a/remoting/protocol/audio_decode_scheduler.cc
+++ b/remoting/protocol/audio_decode_scheduler.cc
@@ -14,8 +14,7 @@
#include "remoting/proto/audio.pb.h"
#include "remoting/protocol/audio_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
AudioDecodeScheduler::AudioDecodeScheduler(
scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
@@ -24,12 +23,12 @@
audio_consumer_(audio_consumer) {}
AudioDecodeScheduler::~AudioDecodeScheduler() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
audio_decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release());
}
void AudioDecodeScheduler::Initialize(const protocol::SessionConfig& config) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!decoder_);
decoder_ = AudioDecoder::CreateAudioDecoder(config);
}
@@ -37,7 +36,7 @@
void AudioDecodeScheduler::ProcessAudioPacket(
std::unique_ptr<AudioPacket> packet,
base::OnceClosure done) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
base::PostTaskAndReplyWithResult(
audio_decode_task_runner_.get(), FROM_HERE,
@@ -50,7 +49,7 @@
void AudioDecodeScheduler::ProcessDecodedPacket(
base::OnceClosure done,
std::unique_ptr<AudioPacket> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!packet || !audio_consumer_) {
std::move(done).Run();
@@ -60,5 +59,4 @@
audio_consumer_->ProcessAudioPacket(std::move(packet), std::move(done));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_decode_scheduler.h b/remoting/protocol/audio_decode_scheduler.h
index deb90d3..7819f04 100644
--- a/remoting/protocol/audio_decode_scheduler.h
+++ b/remoting/protocol/audio_decode_scheduler.h
@@ -54,7 +54,7 @@
// Decoder used on the audio thread.
std::unique_ptr<AudioDecoder> decoder_;
- base::ThreadChecker thread_checker_;
+ THREAD_CHECKER(thread_checker_);
base::WeakPtrFactory<AudioDecodeScheduler> weak_factory_{this};
};
diff --git a/remoting/protocol/audio_decode_scheduler_unittest.cc b/remoting/protocol/audio_decode_scheduler_unittest.cc
index 5d8b68b..1e05906 100644
--- a/remoting/protocol/audio_decode_scheduler_unittest.cc
+++ b/remoting/protocol/audio_decode_scheduler_unittest.cc
@@ -17,8 +17,7 @@
#include "remoting/protocol/session_config.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -124,9 +123,8 @@
audio_scheduler.reset();
audio_consumer.reset();
- // TODO(nicholss): This test does not really test anything. Add a way to get
- // a count of the calls to AddAudioPacket.
+ // TODO(nicholss): This test does not really test anything. Add a way to get a
+ // count of the calls to AddAudioPacket.
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_pump.cc b/remoting/protocol/audio_pump.cc
index 32d86de6..db172c3c 100644
--- a/remoting/protocol/audio_pump.cc
+++ b/remoting/protocol/audio_pump.cc
@@ -83,8 +83,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Limit the data stored in the pending send buffers to 250ms.
const int kMaxBufferedIntervalMs = 250;
@@ -110,8 +109,6 @@
void EncodeAudioPacket(std::unique_ptr<AudioPacket> packet);
- base::ThreadChecker thread_checker_;
-
base::WeakPtr<AudioPump> pump_;
scoped_refptr<base::SingleThreadTaskRunner> pump_task_runner_;
@@ -127,6 +124,8 @@
std::unique_ptr<media::ChannelMixer> mixer_;
media::ChannelLayout mixer_input_layout_ = media::CHANNEL_LAYOUT_NONE;
+
+ THREAD_CHECKER(thread_checker_);
};
AudioPump::Core::Core(base::WeakPtr<AudioPump> pump,
@@ -138,35 +137,35 @@
audio_encoder_(std::move(audio_encoder)),
enabled_(true),
bytes_pending_(0) {
- thread_checker_.DetachFromThread();
+ DETACH_FROM_THREAD(thread_checker_);
}
AudioPump::Core::~Core() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void AudioPump::Core::Start() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
audio_source_->Start(
base::BindRepeating(&Core::EncodeAudioPacket, base::Unretained(this)));
}
void AudioPump::Core::Pause(bool pause) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
enabled_ = !pause;
}
void AudioPump::Core::OnPacketSent(int size) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
bytes_pending_ -= size;
DCHECK_GE(bytes_pending_, 0);
}
void AudioPump::Core::EncodeAudioPacket(std::unique_ptr<AudioPacket> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(packet);
int max_buffered_bytes =
@@ -197,7 +196,7 @@
std::unique_ptr<AudioPacket> AudioPump::Core::Downmix(
std::unique_ptr<AudioPacket> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(packet);
DCHECK_EQ(packet->data_size(), 1);
DCHECK_EQ(packet->bytes_per_sample(), AudioPacket::BYTES_PER_SAMPLE_2);
@@ -241,13 +240,13 @@
}
AudioPump::~AudioPump() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
audio_task_runner_->DeleteSoon(FROM_HERE, core_.release());
}
void AudioPump::Pause(bool pause) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
audio_task_runner_->PostTask(
FROM_HERE,
@@ -255,7 +254,7 @@
}
void AudioPump::SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(packet);
audio_stub_->ProcessAudioPacket(
@@ -269,5 +268,4 @@
base::BindOnce(&Core::OnPacketSent, base::Unretained(core_.get()), size));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_pump.h b/remoting/protocol/audio_pump.h
index c1f4f59..b6988b6 100644
--- a/remoting/protocol/audio_pump.h
+++ b/remoting/protocol/audio_pump.h
@@ -27,10 +27,10 @@
class AudioStub;
class AudioSource;
-// AudioPump is responsible for fetching audio data from the AudioCapturer
-// and encoding it before passing it to the AudioStub for delivery to the
-// client. Audio data will be downmixed to stereo if needed. Audio is captured
-// and encoded on the audio thread and then passed to AudioStub on the network
+// AudioPump is responsible for fetching audio data from the AudioCapturer and
+// encoding it before passing it to the AudioStub for delivery to the client.
+// Audio data will be downmixed to stereo if needed. Audio is captured and
+// encoded on the audio thread and then passed to AudioStub on the network
// thread.
class AudioPump : public AudioStream {
public:
@@ -58,13 +58,13 @@
// Callback for BufferedSocketWriter.
void OnPacketSent(int size);
- base::ThreadChecker thread_checker_;
-
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
raw_ptr<AudioStub> audio_stub_;
std::unique_ptr<Core> core_;
+ THREAD_CHECKER(thread_checker_);
+
base::WeakPtrFactory<AudioPump> weak_factory_{this};
};
diff --git a/remoting/protocol/audio_pump_unittest.cc b/remoting/protocol/audio_pump_unittest.cc
index b432cba4..55b412d 100644
--- a/remoting/protocol/audio_pump_unittest.cc
+++ b/remoting/protocol/audio_pump_unittest.cc
@@ -21,12 +21,11 @@
#include "remoting/protocol/fake_audio_source.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
-// Creates a dummy packet with 1k data
+// Creates a dummy packet with 1k data.
std::unique_ptr<AudioPacket> MakeAudioPacket(int channel_count = 2) {
std::unique_ptr<AudioPacket> packet(new AudioPacket);
packet->add_data()->resize(1024);
@@ -186,5 +185,4 @@
ASSERT_EQ(sent_packets_.size(), std::size(kChannels));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc
index 59390fc5..da4c333 100644
--- a/remoting/protocol/audio_reader.cc
+++ b/remoting/protocol/audio_reader.cc
@@ -15,8 +15,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/session_config.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
AudioReader::AudioReader(AudioStub* audio_stub)
: ChannelDispatcherBase(kAudioChannelName), audio_stub_(audio_stub) {}
@@ -31,5 +30,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_reader.h b/remoting/protocol/audio_reader.h
index d119f501..9487015e 100644
--- a/remoting/protocol/audio_reader.h
+++ b/remoting/protocol/audio_reader.h
@@ -9,8 +9,7 @@
#include "base/memory/raw_ptr.h"
#include "remoting/protocol/channel_dispatcher_base.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioStub;
@@ -29,7 +28,6 @@
raw_ptr<AudioStub> audio_stub_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_AUDIO_READER_H_
diff --git a/remoting/protocol/audio_stream.h b/remoting/protocol/audio_stream.h
index 3dd312d..2ad303c 100644
--- a/remoting/protocol/audio_stream.h
+++ b/remoting/protocol/audio_stream.h
@@ -5,15 +5,14 @@
#ifndef REMOTING_PROTOCOL_AUDIO_STREAM_H_
#define REMOTING_PROTOCOL_AUDIO_STREAM_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
-// AudioStream is responsible for fetching audio data from an AudioSource,
-// and sending it to the client.
+// AudioStream is responsible for fetching audio data from an AudioSource, and
+// sending it to the client.
class AudioStream {
public:
- AudioStream() {}
- virtual ~AudioStream() {}
+ AudioStream() = default;
+ virtual ~AudioStream() = default;
// Pauses or resumes audio on a running session. This leaves the audio
// capturer running, and only affects whether or not the captured audio is
@@ -21,7 +20,6 @@
virtual void Pause(bool pause) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_AUDIO_STREAM_H_
diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc
index b3b4c27..b7ed864 100644
--- a/remoting/protocol/audio_writer.cc
+++ b/remoting/protocol/audio_writer.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/session_config.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
AudioWriter::AudioWriter() : ChannelDispatcherBase(kAudioChannelName) {}
AudioWriter::~AudioWriter() = default;
@@ -38,5 +37,4 @@
LOG(ERROR) << "Received unexpected message on the audio channel.";
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/audio_writer.h b/remoting/protocol/audio_writer.h
index 7cf63dcd..b8b9d1f 100644
--- a/remoting/protocol/audio_writer.h
+++ b/remoting/protocol/audio_writer.h
@@ -13,8 +13,7 @@
#include "remoting/protocol/audio_stub.h"
#include "remoting/protocol/channel_dispatcher_base.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class SessionConfig;
@@ -40,7 +39,6 @@
void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_AUDIO_WRITER_H_
diff --git a/remoting/protocol/auth_util.cc b/remoting/protocol/auth_util.cc
index d7eba4d..3a910e0c 100644
--- a/remoting/protocol/auth_util.cc
+++ b/remoting/protocol/auth_util.cc
@@ -12,8 +12,7 @@
#include "net/base/net_errors.h"
#include "net/socket/ssl_socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
const char kClientAuthSslExporterLabel[] =
"EXPORTER-remoting-channel-auth-client";
@@ -65,5 +64,4 @@
return std::string(out_bytes, out_bytes + kAuthDigestLength);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/auth_util.h b/remoting/protocol/auth_util.h
index 772d1cb..df414554 100644
--- a/remoting/protocol/auth_util.h
+++ b/remoting/protocol/auth_util.h
@@ -15,8 +15,7 @@
class SSLSocket;
} // namespace net
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Labels for use when exporting the SSL shared secret.
extern const char kClientAuthSslExporterLabel[];
@@ -41,7 +40,6 @@
const base::StringPiece& label,
const base::StringPiece& shared_secret);
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_AUTH_UTIL_H_
diff --git a/remoting/protocol/authenticator.cc b/remoting/protocol/authenticator.cc
index cbefd5a..648e760 100644
--- a/remoting/protocol/authenticator.cc
+++ b/remoting/protocol/authenticator.cc
@@ -7,8 +7,7 @@
#include "remoting/base/constants.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
const jingle_xmpp::StaticQName kAuthenticationQName = { kChromotingXmlNamespace,
@@ -32,5 +31,4 @@
return message->FirstNamed(kAuthenticationQName);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/authenticator.h b/remoting/protocol/authenticator.h
index e9c3301..c970fa41 100644
--- a/remoting/protocol/authenticator.h
+++ b/remoting/protocol/authenticator.h
@@ -14,8 +14,7 @@
class XmlElement;
} // namespace jingle_xmpp
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class Authenticator;
class ChannelAuthenticator;
@@ -161,7 +160,6 @@
const std::string& remote_jid) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc
index e72584e5..4b3ef66f 100644
--- a/remoting/protocol/authenticator_test_base.cc
+++ b/remoting/protocol/authenticator_test_base.cc
@@ -27,8 +27,7 @@
using testing::_;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -179,5 +178,4 @@
client_socket_ = std::move(socket);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/capability_names.h b/remoting/protocol/capability_names.h
index 2b1bec7..ef7186e 100644
--- a/remoting/protocol/capability_names.h
+++ b/remoting/protocol/capability_names.h
@@ -5,8 +5,7 @@
#ifndef REMOTING_PROTOCOL_CAPABILITY_NAMES_H_
#define REMOTING_PROTOCOL_CAPABILITY_NAMES_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Used for negotiating client-host capabilities for touch events.
constexpr char kTouchEventsCapability[] = "touchEvents";
@@ -35,7 +34,6 @@
// implemented and working on the host side.
constexpr char kMultiStreamCapability[] = "multiStream_inProgress";
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CAPABILITY_NAMES_H_
diff --git a/remoting/protocol/capture_scheduler.cc b/remoting/protocol/capture_scheduler.cc
index 178cfaa14..767709f 100644
--- a/remoting/protocol/capture_scheduler.cc
+++ b/remoting/protocol/capture_scheduler.cc
@@ -40,8 +40,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// We assume that the number of available cores is constant.
CaptureScheduler::CaptureScheduler(
@@ -62,17 +61,17 @@
}
CaptureScheduler::~CaptureScheduler() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void CaptureScheduler::Start() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
ScheduleNextCapture();
}
void CaptureScheduler::Pause(bool pause) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_paused_ != pause) {
is_paused_ = pause;
@@ -86,7 +85,7 @@
}
void CaptureScheduler::OnCaptureCompleted() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
capture_pending_ = false;
capture_time_.Record(
@@ -98,7 +97,7 @@
}
void CaptureScheduler::OnFrameEncoded(VideoPacket* packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Set packet_id for the outgoing packet.
packet->set_frame_id(next_frame_id_);
@@ -114,13 +113,13 @@
}
void CaptureScheduler::OnFrameSent() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
ScheduleNextCapture();
}
void CaptureScheduler::ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
--num_unacknowledged_frames_;
DCHECK_GE(num_unacknowledged_frames_, 0);
@@ -142,7 +141,7 @@
}
void CaptureScheduler::ScheduleNextCapture() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_paused_ || capture_pending_ ||
num_encoding_frames_ >= kMaxFramesInEncodingQueue) {
@@ -172,7 +171,7 @@
}
void CaptureScheduler::CaptureNextFrame() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_paused_);
DCHECK(!capture_pending_);
@@ -181,5 +180,4 @@
capture_closure_.Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/capture_scheduler.h b/remoting/protocol/capture_scheduler.h
index d79cafc..006f39b 100644
--- a/remoting/protocol/capture_scheduler.h
+++ b/remoting/protocol/capture_scheduler.h
@@ -112,7 +112,7 @@
// Frame ID to be assigned to the next outgoing video frame.
uint32_t next_frame_id_;
- base::ThreadChecker thread_checker_;
+ THREAD_CHECKER(thread_checker_);
};
} // namespace protocol
diff --git a/remoting/protocol/capture_scheduler_unittest.cc b/remoting/protocol/capture_scheduler_unittest.cc
index d9a8930..2777793 100644
--- a/remoting/protocol/capture_scheduler_unittest.cc
+++ b/remoting/protocol/capture_scheduler_unittest.cc
@@ -18,8 +18,7 @@
#include "remoting/proto/video.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
static const int kTestInputs[] = { 100, 50, 30, 20, 10, 30, 60, 80 };
static const int kMinumumFrameIntervalMs = 50;
@@ -196,5 +195,4 @@
EXPECT_TRUE(capture_timer_->IsRunning());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_authenticator.h b/remoting/protocol/channel_authenticator.h
index 8da6fad..ea6c780 100644
--- a/remoting/protocol/channel_authenticator.h
+++ b/remoting/protocol/channel_authenticator.h
@@ -9,8 +9,7 @@
#include "base/callback_forward.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PStreamSocket;
@@ -32,7 +31,6 @@
DoneCallback done_callback) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_
diff --git a/remoting/protocol/channel_dispatcher_base.cc b/remoting/protocol/channel_dispatcher_base.cc
index a6d0909..f2e3af4 100644
--- a/remoting/protocol/channel_dispatcher_base.cc
+++ b/remoting/protocol/channel_dispatcher_base.cc
@@ -11,8 +11,7 @@
#include "remoting/protocol/message_channel_factory.h"
#include "remoting/protocol/message_pipe.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ChannelDispatcherBase::ChannelDispatcherBase(const std::string& channel_name)
: channel_name_(channel_name) {}
@@ -62,5 +61,4 @@
event_handler_->OnChannelClosed(this);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc
index 0b6df46..be37477 100644
--- a/remoting/protocol/channel_multiplexer.cc
+++ b/remoting/protocol/channel_multiplexer.cc
@@ -21,8 +21,7 @@
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/p2p_stream_socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
const int kChannelIdUnknown = -1;
@@ -473,5 +472,4 @@
traffic_annotation);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h
index 44dd65bc..5003f48d 100644
--- a/remoting/protocol/channel_multiplexer.h
+++ b/remoting/protocol/channel_multiplexer.h
@@ -15,8 +15,7 @@
#include "remoting/protocol/message_reader.h"
#include "remoting/protocol/stream_channel_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ChannelMultiplexer : public StreamChannelFactory {
public:
@@ -92,8 +91,6 @@
base::WeakPtrFactory<ChannelMultiplexer> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
-
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc
index 9874bcc..4d4776c 100644
--- a/remoting/protocol/channel_multiplexer_unittest.cc
+++ b/remoting/protocol/channel_multiplexer_unittest.cc
@@ -30,8 +30,7 @@
using testing::AtMost;
using testing::InvokeWithoutArgs;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -341,5 +340,4 @@
base::RunLoop().RunUntilIdle();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_socket_adapter.cc b/remoting/protocol/channel_socket_adapter.cc
index 945a963e..ac31f44 100644
--- a/remoting/protocol/channel_socket_adapter.cc
+++ b/remoting/protocol/channel_socket_adapter.cc
@@ -11,12 +11,11 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
TransportChannelSocketAdapter::TransportChannelSocketAdapter(
cricket::IceTransportInternal* ice_transport)
- : channel_(ice_transport), closed_error_code_(net::OK) {
+ : channel_(ice_transport) {
DCHECK(channel_);
channel_->SignalReadPacket.connect(
@@ -28,7 +27,7 @@
}
TransportChannelSocketAdapter::~TransportChannelSocketAdapter() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (destruction_callback_)
std::move(destruction_callback_).Run();
}
@@ -42,7 +41,7 @@
const scoped_refptr<net::IOBuffer>& buf,
int buffer_size,
const net::CompletionRepeatingCallback& callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(buf);
DCHECK(!callback.is_null());
CHECK(read_callback_.is_null());
@@ -63,7 +62,7 @@
const scoped_refptr<net::IOBuffer>& buffer,
int buffer_size,
const net::CompletionRepeatingCallback& callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(buffer);
DCHECK(!callback.is_null());
CHECK(write_callback_.is_null());
@@ -98,7 +97,7 @@
}
void TransportChannelSocketAdapter::Close(int error_code) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!channel_) // Already closed.
return;
@@ -130,7 +129,7 @@
size_t data_size,
const int64_t& packet_time,
int flags) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_EQ(transport, channel_);
if (!read_callback_.is_null()) {
DCHECK(read_buffer_.get());
@@ -156,7 +155,7 @@
void TransportChannelSocketAdapter::OnWritableState(
rtc::PacketTransportInternal* transport) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Try to send the packet if there is a pending write.
if (!write_callback_.is_null()) {
rtc::PacketOptions options;
@@ -177,10 +176,9 @@
void TransportChannelSocketAdapter::OnChannelDestroyed(
cricket::IceTransportInternal* channel) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_EQ(channel, channel_);
Close(net::ERR_CONNECTION_ABORTED);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/channel_socket_adapter.h b/remoting/protocol/channel_socket_adapter.h
index 5a08994..aafd741 100644
--- a/remoting/protocol/channel_socket_adapter.h
+++ b/remoting/protocol/channel_socket_adapter.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/threading/thread_checker.h"
+#include "net/base/net_errors.h"
#include "remoting/protocol/p2p_datagram_socket.h"
// TODO(zhihuang):Replace #include by forward declaration once proper
// inheritance is defined for cricket::IceTransportInternal and
@@ -24,8 +25,7 @@
#include "third_party/webrtc/rtc_base/socket_address.h"
#include "third_party/webrtc/rtc_base/third_party/sigslot/sigslot.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// TransportChannelSocketAdapter implements P2PDatagramSocket interface on
// top of cricket::IceTransportInternal. It is used by IceTransport to provide
@@ -33,7 +33,7 @@
class TransportChannelSocketAdapter : public P2PDatagramSocket,
public sigslot::has_slots<> {
public:
- // Doesn't take ownership of the |channel|. The |channel| must outlive
+ // Doesn't take ownership of |ice_transport|. |ice_transport| must outlive
// this adapter.
explicit TransportChannelSocketAdapter(
cricket::IceTransportInternal* ice_transport);
@@ -71,8 +71,6 @@
void OnWritableState(rtc::PacketTransportInternal* transport);
void OnChannelDestroyed(cricket::IceTransportInternal* ice_transport);
- base::ThreadChecker thread_checker_;
-
raw_ptr<cricket::IceTransportInternal> channel_;
base::OnceClosure destruction_callback_;
@@ -85,10 +83,11 @@
scoped_refptr<net::IOBuffer> write_buffer_;
int write_buffer_size_;
- int closed_error_code_;
+ int closed_error_code_ = net::OK;
+
+ THREAD_CHECKER(thread_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CHANNEL_SOCKET_ADAPTER_H_
diff --git a/remoting/protocol/channel_socket_adapter_unittest.cc b/remoting/protocol/channel_socket_adapter_unittest.cc
index 715a08d..f10baaa3 100644
--- a/remoting/protocol/channel_socket_adapter_unittest.cc
+++ b/remoting/protocol/channel_socket_adapter_unittest.cc
@@ -24,8 +24,7 @@
using testing::_;
using testing::Return;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
const int kBufferSize = 4096;
@@ -114,5 +113,4 @@
ASSERT_EQ(net::OK, result);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_port_allocator_factory.cc b/remoting/protocol/chromium_port_allocator_factory.cc
index 525d77cb..71d4e81 100644
--- a/remoting/protocol/chromium_port_allocator_factory.cc
+++ b/remoting/protocol/chromium_port_allocator_factory.cc
@@ -9,8 +9,7 @@
#include "remoting/protocol/port_allocator.h"
#include "remoting/protocol/transport_context.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory() = default;
ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() = default;
@@ -28,5 +27,4 @@
transport_context);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_port_allocator_factory.h b/remoting/protocol/chromium_port_allocator_factory.h
index 6803c0e..6c4ad69 100644
--- a/remoting/protocol/chromium_port_allocator_factory.h
+++ b/remoting/protocol/chromium_port_allocator_factory.h
@@ -11,8 +11,7 @@
#include "base/memory/ref_counted.h"
#include "remoting/protocol/port_allocator_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ChromiumPortAllocatorFactory : public PortAllocatorFactory {
public:
@@ -30,7 +29,6 @@
base::WeakPtr<SessionOptionsProvider> session_options_provider) override;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
diff --git a/remoting/protocol/chromium_socket_factory.cc b/remoting/protocol/chromium_socket_factory.cc
index 44bc2e5..e4c2e69 100644
--- a/remoting/protocol/chromium_socket_factory.cc
+++ b/remoting/protocol/chromium_socket_factory.cc
@@ -31,8 +31,7 @@
#include "third_party/webrtc/rtc_base/net_helpers.h"
#include "third_party/webrtc/rtc_base/socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -463,5 +462,4 @@
return new rtc::AsyncResolver();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/chromium_socket_factory.h b/remoting/protocol/chromium_socket_factory.h
index 0871e8a0..616fc530 100644
--- a/remoting/protocol/chromium_socket_factory.h
+++ b/remoting/protocol/chromium_socket_factory.h
@@ -11,8 +11,7 @@
#include "base/memory/weak_ptr.h"
#include "third_party/webrtc/api/packet_socket_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class SessionOptionsProvider;
@@ -48,7 +47,6 @@
base::WeakPtr<SessionOptionsProvider> session_options_provider_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CHROMIUM_SOCKET_FACTORY_H_
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc
index 5eb2d9a..75d27dd 100644
--- a/remoting/protocol/chromium_socket_factory_unittest.cc
+++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -21,8 +21,7 @@
#include "third_party/webrtc/rtc_base/socket_address.h"
#include "third_party/webrtc/rtc_base/time_utils.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -191,5 +190,4 @@
ASSERT_EQ(last_packet_time_, rtc::TimeMicros());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_authentication_config.cc b/remoting/protocol/client_authentication_config.cc
index a0b49687..fbd5925 100644
--- a/remoting/protocol/client_authentication_config.cc
+++ b/remoting/protocol/client_authentication_config.cc
@@ -4,13 +4,11 @@
#include "remoting/protocol/client_authentication_config.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClientAuthenticationConfig::ClientAuthenticationConfig() = default;
ClientAuthenticationConfig::ClientAuthenticationConfig(
const ClientAuthenticationConfig& other) = default;
ClientAuthenticationConfig::~ClientAuthenticationConfig() = default;
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_authentication_config.h b/remoting/protocol/client_authentication_config.h
index f18a1c1..791e6a582 100644
--- a/remoting/protocol/client_authentication_config.h
+++ b/remoting/protocol/client_authentication_config.h
@@ -10,8 +10,7 @@
#include "base/callback.h"
#include "remoting/protocol/token_validator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
typedef base::RepeatingCallback<void(const std::string& secret)>
SecretFetchedCallback;
@@ -61,7 +60,6 @@
FetchThirdPartyTokenCallback fetch_third_party_token_callback;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_AUTHENTICATION_CONFIG_H_
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc
index 6341cee1..5889397 100644
--- a/remoting/protocol/client_control_dispatcher.cc
+++ b/remoting/protocol/client_control_dispatcher.cc
@@ -17,8 +17,7 @@
#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/message_serialization.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -153,5 +152,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h
index b49c2ce..c40c8b49 100644
--- a/remoting/protocol/client_control_dispatcher.h
+++ b/remoting/protocol/client_control_dispatcher.h
@@ -12,8 +12,7 @@
#include "remoting/protocol/cursor_shape_stub.h"
#include "remoting/protocol/host_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClientStub;
@@ -63,7 +62,6 @@
raw_ptr<ClipboardStub> clipboard_stub_ = nullptr;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_
diff --git a/remoting/protocol/client_event_dispatcher.cc b/remoting/protocol/client_event_dispatcher.cc
index 1250088..639d6f3 100644
--- a/remoting/protocol/client_event_dispatcher.cc
+++ b/remoting/protocol/client_event_dispatcher.cc
@@ -12,8 +12,7 @@
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/message_pipe.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClientEventDispatcher::ClientEventDispatcher()
: ChannelDispatcherBase(kEventChannelName) {}
@@ -55,5 +54,4 @@
LOG(ERROR) << "Received unexpected message on the event channel.";
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_event_dispatcher.h b/remoting/protocol/client_event_dispatcher.h
index acd39dc..d1bfcc7 100644
--- a/remoting/protocol/client_event_dispatcher.h
+++ b/remoting/protocol/client_event_dispatcher.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/input_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// ClientEventDispatcher manages the event channel on the client
// side. It implements InputStub for outgoing input messages.
@@ -33,7 +32,6 @@
void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_EVENT_DISPATCHER_H_
diff --git a/remoting/protocol/client_stub.h b/remoting/protocol/client_stub.h
index db8e309..dbb85b4 100644
--- a/remoting/protocol/client_stub.h
+++ b/remoting/protocol/client_stub.h
@@ -14,8 +14,7 @@
#include "remoting/protocol/cursor_shape_stub.h"
#include "remoting/protocol/keyboard_layout_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class Capabilities;
class ExtensionMessage;
@@ -50,7 +49,6 @@
virtual void SetTransportInfo(const TransportInfo& transport_info) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_STUB_H_
diff --git a/remoting/protocol/client_video_dispatcher.cc b/remoting/protocol/client_video_dispatcher.cc
index 40eaac9..ac3a520 100644
--- a/remoting/protocol/client_video_dispatcher.cc
+++ b/remoting/protocol/client_video_dispatcher.cc
@@ -18,8 +18,7 @@
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/video_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
struct ClientVideoDispatcher::PendingFrame {
PendingFrame(int frame_id)
@@ -113,5 +112,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_dispatcher.h b/remoting/protocol/client_video_dispatcher.h
index 34d40f3..a158a18 100644
--- a/remoting/protocol/client_video_dispatcher.h
+++ b/remoting/protocol/client_video_dispatcher.h
@@ -14,8 +14,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClientStub;
class VideoStub;
@@ -50,7 +49,6 @@
base::WeakPtrFactory<ClientVideoDispatcher> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
diff --git a/remoting/protocol/client_video_dispatcher_unittest.cc b/remoting/protocol/client_video_dispatcher_unittest.cc
index 349358e..dccd2ec 100644
--- a/remoting/protocol/client_video_dispatcher_unittest.cc
+++ b/remoting/protocol/client_video_dispatcher_unittest.cc
@@ -23,8 +23,7 @@
#include "remoting/protocol/video_stub.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClientVideoDispatcherTest : public testing::Test,
public VideoStub,
@@ -235,5 +234,4 @@
EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_stats_dispatcher.cc b/remoting/protocol/client_video_stats_dispatcher.cc
index 12e76d80..a984c021 100644
--- a/remoting/protocol/client_video_stats_dispatcher.cc
+++ b/remoting/protocol/client_video_stats_dispatcher.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/video_stats_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClientVideoStatsDispatcher::ClientVideoStatsDispatcher(
const std::string& stream_name,
@@ -43,5 +42,4 @@
HostFrameStats::FromFrameStatsMessage(*stats_proto));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/client_video_stats_dispatcher.h b/remoting/protocol/client_video_stats_dispatcher.h
index a571ac9..74f684c 100644
--- a/remoting/protocol/client_video_stats_dispatcher.h
+++ b/remoting/protocol/client_video_stats_dispatcher.h
@@ -12,8 +12,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class VideoStatsStub;
@@ -34,7 +33,6 @@
raw_ptr<VideoStatsStub> video_stats_stub_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIENT_VIDEO_STATS_DISPATCHER_H_
diff --git a/remoting/protocol/clipboard_echo_filter.cc b/remoting/protocol/clipboard_echo_filter.cc
index 1827530..0eddcf2e 100644
--- a/remoting/protocol/clipboard_echo_filter.cc
+++ b/remoting/protocol/clipboard_echo_filter.cc
@@ -6,8 +6,7 @@
#include "remoting/proto/event.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClipboardEchoFilter::ClipboardEchoFilter()
: host_stub_(nullptr),
@@ -73,5 +72,4 @@
filter_->InjectClipboardEventToHost(event);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_echo_filter.h b/remoting/protocol/clipboard_echo_filter.h
index 82999bc50..4605c9c 100644
--- a/remoting/protocol/clipboard_echo_filter.h
+++ b/remoting/protocol/clipboard_echo_filter.h
@@ -12,11 +12,10 @@
#include "base/memory/raw_ptr.h"
#include "remoting/protocol/clipboard_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
-// ClipboardEchoFilter stops the host sending a clipboard item to the
-// client, if that item was the latest item received from the client.
+// ClipboardEchoFilter stops the host sending a clipboard item to the client, if
+// that item was the latest item received from the client.
class ClipboardEchoFilter {
public:
ClipboardEchoFilter();
@@ -72,7 +71,6 @@
std::string client_latest_data_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_
diff --git a/remoting/protocol/clipboard_echo_filter_unittest.cc b/remoting/protocol/clipboard_echo_filter_unittest.cc
index d92dc5c..07187c4 100644
--- a/remoting/protocol/clipboard_echo_filter_unittest.cc
+++ b/remoting/protocol/clipboard_echo_filter_unittest.cc
@@ -13,8 +13,7 @@
using ::testing::_;
using ::testing::InSequence;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
using test::EqualsClipboardEvent;
@@ -106,5 +105,4 @@
filter.client_filter()->InjectClipboardEvent(event);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_filter.cc b/remoting/protocol/clipboard_filter.cc
index 12ce370..70b987b 100644
--- a/remoting/protocol/clipboard_filter.cc
+++ b/remoting/protocol/clipboard_filter.cc
@@ -6,8 +6,7 @@
#include "remoting/proto/internal.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClipboardFilter::ClipboardFilter() = default;
@@ -38,5 +37,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_filter.h b/remoting/protocol/clipboard_filter.h
index 6dadbbf5..0514e30 100644
--- a/remoting/protocol/clipboard_filter.h
+++ b/remoting/protocol/clipboard_filter.h
@@ -10,8 +10,7 @@
#include "remoting/protocol/clipboard_stub.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Forwards clipboard events to |clipboard_stub|, if configured. Event
// forwarding may also be disabled independently of the configured
@@ -46,7 +45,6 @@
absl::optional<size_t> max_size_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIPBOARD_FILTER_H_
diff --git a/remoting/protocol/clipboard_filter_unittest.cc b/remoting/protocol/clipboard_filter_unittest.cc
index dcae907..3188034 100644
--- a/remoting/protocol/clipboard_filter_unittest.cc
+++ b/remoting/protocol/clipboard_filter_unittest.cc
@@ -12,8 +12,7 @@
using ::testing::_;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
using test::EqualsClipboardEvent;
@@ -102,5 +101,4 @@
clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo"));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_stub.h b/remoting/protocol/clipboard_stub.h
index 0edbfa1..eb335b3 100644
--- a/remoting/protocol/clipboard_stub.h
+++ b/remoting/protocol/clipboard_stub.h
@@ -8,26 +8,24 @@
#ifndef REMOTING_PROTOCOL_CLIPBOARD_STUB_H_
#define REMOTING_PROTOCOL_CLIPBOARD_STUB_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClipboardEvent;
class ClipboardStub {
public:
- ClipboardStub() {}
+ ClipboardStub() = default;
ClipboardStub(const ClipboardStub&) = delete;
ClipboardStub& operator=(const ClipboardStub&) = delete;
- virtual ~ClipboardStub() {}
+ virtual ~ClipboardStub() = default;
// Implementations must not assume the presence of |event|'s fields, nor that
// |event.data| is correctly encoded according to the specified MIME-type.
virtual void InjectClipboardEvent(const ClipboardEvent& event) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIPBOARD_STUB_H_
diff --git a/remoting/protocol/clipboard_thread_proxy.cc b/remoting/protocol/clipboard_thread_proxy.cc
index 077cb91..5e4970b8 100644
--- a/remoting/protocol/clipboard_thread_proxy.cc
+++ b/remoting/protocol/clipboard_thread_proxy.cc
@@ -7,8 +7,7 @@
#include "base/bind.h"
#include "remoting/proto/event.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClipboardThreadProxy::~ClipboardThreadProxy() = default;
@@ -34,5 +33,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/clipboard_thread_proxy.h b/remoting/protocol/clipboard_thread_proxy.h
index 34fffe0..62ee569d 100644
--- a/remoting/protocol/clipboard_thread_proxy.h
+++ b/remoting/protocol/clipboard_thread_proxy.h
@@ -12,8 +12,7 @@
#include "base/task/task_runner.h"
#include "remoting/protocol/clipboard_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClipboardThreadProxy : public ClipboardStub {
public:
@@ -42,7 +41,6 @@
scoped_refptr<base::TaskRunner> clipboard_stub_task_runner_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc
index a594bff..56e3632 100644
--- a/remoting/protocol/connection_tester.cc
+++ b/remoting/protocol/connection_tester.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/p2p_stream_socket.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
StreamConnectionTester::StreamConnectionTester(P2PStreamSocket* client_socket,
P2PStreamSocket* host_socket,
@@ -205,5 +204,4 @@
FAIL();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 192f3d5f..104e324 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -17,9 +17,7 @@
class DesktopCapturer;
} // namespace webrtc
-namespace remoting {
-
-namespace protocol {
+namespace remoting::protocol {
class AudioSource;
class AudioStream;
@@ -123,7 +121,6 @@
virtual WebrtcEventLogData* rtc_event_log() = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index e585ab5..2b17912 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -6,8 +6,7 @@
#include "base/notreached.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
#define RETURN_STRING_LITERAL(x) \
case x: \
@@ -26,5 +25,4 @@
return nullptr;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h
index ebf39fd..bdaea4e 100644
--- a/remoting/protocol/connection_to_host.h
+++ b/remoting/protocol/connection_to_host.h
@@ -16,8 +16,7 @@
class SingleThreadTaskRunner;
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioStub;
class ClientStub;
@@ -105,7 +104,6 @@
virtual State state() const = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc
index 41c0aef..a3893e9 100644
--- a/remoting/protocol/connection_unittest.cc
+++ b/remoting/protocol/connection_unittest.cc
@@ -40,8 +40,7 @@
using ::testing::NotNull;
using ::testing::StrictMock;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -715,5 +714,4 @@
WaitNextVideoFrame();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/content_description.h b/remoting/protocol/content_description.h
index 2874317..a0ad4fd 100644
--- a/remoting/protocol/content_description.h
+++ b/remoting/protocol/content_description.h
@@ -15,8 +15,7 @@
class XmlElement;
} // namespace jingle_xmpp
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// ContentDescription used for chromoting sessions. It contains the information
// from the content description stanza in the session initialization handshake.
@@ -56,7 +55,6 @@
std::list<ChannelConfig>* const configs);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
diff --git a/remoting/protocol/content_description_unittest.cc b/remoting/protocol/content_description_unittest.cc
index e3d6237..bce9c4f 100644
--- a/remoting/protocol/content_description_unittest.cc
+++ b/remoting/protocol/content_description_unittest.cc
@@ -13,8 +13,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
TEST(ContentDescriptionTest, FormatAndParse) {
std::unique_ptr<CandidateSessionConfig> config =
@@ -104,6 +103,4 @@
EXPECT_TRUE(parsed->config()->audio_configs().front() == ChannelConfig());
}
-} // namespace protocol
-} // namespace remoting
-
+} // namespace remoting::protocol
diff --git a/remoting/protocol/cursor_shape_stub.h b/remoting/protocol/cursor_shape_stub.h
index 0be4cf4..092a02c 100644
--- a/remoting/protocol/cursor_shape_stub.h
+++ b/remoting/protocol/cursor_shape_stub.h
@@ -7,24 +7,22 @@
#ifndef REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
#define REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class CursorShapeInfo;
class CursorShapeStub {
public:
- CursorShapeStub() {}
+ CursorShapeStub() = default;
CursorShapeStub(const CursorShapeStub&) = delete;
CursorShapeStub& operator=(const CursorShapeStub&) = delete;
- virtual ~CursorShapeStub() {}
+ virtual ~CursorShapeStub() = default;
virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_CURSOR_SHAPE_STUB_H_
diff --git a/remoting/protocol/data_channel_manager.cc b/remoting/protocol/data_channel_manager.cc
index a6556cf..efe2433 100644
--- a/remoting/protocol/data_channel_manager.cc
+++ b/remoting/protocol/data_channel_manager.cc
@@ -9,8 +9,7 @@
#include "base/check.h"
#include "remoting/protocol/message_pipe.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
DataChannelManager::DataChannelManager() = default;
DataChannelManager::~DataChannelManager() = default;
@@ -35,5 +34,4 @@
return false;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/data_channel_manager.h b/remoting/protocol/data_channel_manager.h
index 9891b335..3eca491 100644
--- a/remoting/protocol/data_channel_manager.h
+++ b/remoting/protocol/data_channel_manager.h
@@ -11,8 +11,7 @@
#include "base/callback.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class MessagePipe;
@@ -41,7 +40,6 @@
std::vector<std::pair<std::string, CreateHandlerCallback>> constructors_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_DATA_CHANNEL_MANAGER_H_
diff --git a/remoting/protocol/data_channel_manager_unittest.cc b/remoting/protocol/data_channel_manager_unittest.cc
index a83c136..ec01185 100644
--- a/remoting/protocol/data_channel_manager_unittest.cc
+++ b/remoting/protocol/data_channel_manager_unittest.cc
@@ -17,8 +17,7 @@
#include "remoting/protocol/named_message_pipe_handler.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -264,5 +263,4 @@
TestDataChannelManagerMultipleRegistrations(true);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/datagram_channel_factory.h b/remoting/protocol/datagram_channel_factory.h
index af5c5a0..ef18d48 100644
--- a/remoting/protocol/datagram_channel_factory.h
+++ b/remoting/protocol/datagram_channel_factory.h
@@ -10,8 +10,7 @@
#include "base/callback_forward.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PDatagramSocket;
@@ -20,7 +19,7 @@
typedef base::OnceCallback<void(std::unique_ptr<P2PDatagramSocket>)>
ChannelCreatedCallback;
- DatagramChannelFactory() {}
+ DatagramChannelFactory() = default;
DatagramChannelFactory(const DatagramChannelFactory&) = delete;
DatagramChannelFactory& operator=(const DatagramChannelFactory&) = delete;
@@ -40,10 +39,9 @@
virtual void CancelChannelCreation(const std::string& name) = 0;
protected:
- virtual ~DatagramChannelFactory() {}
+ virtual ~DatagramChannelFactory() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/errors.cc b/remoting/protocol/errors.cc
index f82b59b0..5e11033 100644
--- a/remoting/protocol/errors.cc
+++ b/remoting/protocol/errors.cc
@@ -6,8 +6,7 @@
#include "remoting/base/name_value_map.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -44,5 +43,4 @@
return NameToValue(kErrorCodeNames, name, result);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/errors.h b/remoting/protocol/errors.h
index 4eaa3adb..177977e 100644
--- a/remoting/protocol/errors.h
+++ b/remoting/protocol/errors.h
@@ -7,8 +7,7 @@
#include <string>
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// The UI implementations maintain corresponding definitions of this
// enumeration in remoting/protocol/errors.cc and
@@ -43,7 +42,6 @@
// Returns the literal string of |error|.
const char* ErrorCodeToString(ErrorCode error);
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ERRORS_H_
diff --git a/remoting/protocol/fake_audio_source.cc b/remoting/protocol/fake_audio_source.cc
index e2887e89..568d548 100644
--- a/remoting/protocol/fake_audio_source.cc
+++ b/remoting/protocol/fake_audio_source.cc
@@ -4,8 +4,7 @@
#include "remoting/protocol/fake_audio_source.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeAudioSource::FakeAudioSource() = default;
FakeAudioSource::~FakeAudioSource() = default;
@@ -15,5 +14,4 @@
return true;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_audio_source.h b/remoting/protocol/fake_audio_source.h
index c3b6fea..baae869 100644
--- a/remoting/protocol/fake_audio_source.h
+++ b/remoting/protocol/fake_audio_source.h
@@ -8,8 +8,7 @@
#include "base/callback.h"
#include "remoting/protocol/audio_source.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeAudioSource : public AudioSource {
public:
@@ -29,7 +28,6 @@
PacketCapturedCallback callback_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_AUDIO_SOURCE_H_
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index eaff44a..8df487b 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -19,8 +19,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeChannelAuthenticator::FakeChannelAuthenticator(bool accept, bool async)
: result_(accept ? net::OK : net::ERR_FAILED), async_(async) {}
@@ -246,5 +245,4 @@
return std::move(authenticator);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_authenticator.h b/remoting/protocol/fake_authenticator.h
index 352f1faa..f1a1d69 100644
--- a/remoting/protocol/fake_authenticator.h
+++ b/remoting/protocol/fake_authenticator.h
@@ -10,8 +10,7 @@
#include "remoting/protocol/authenticator.h"
#include "remoting/protocol/channel_authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeChannelAuthenticator : public ChannelAuthenticator {
public:
@@ -147,7 +146,6 @@
const FakeAuthenticator::Config config_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_
diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc
index 0a5ed6c..bfd3158 100644
--- a/remoting/protocol/fake_connection_to_client.cc
+++ b/remoting/protocol/fake_connection_to_client.cc
@@ -13,10 +13,9 @@
#include "remoting/protocol/video_frame_pump.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
-FakeVideoStream::FakeVideoStream() {}
+FakeVideoStream::FakeVideoStream() = default;
FakeVideoStream::~FakeVideoStream() = default;
void FakeVideoStream::SetEventTimestampsSource(
@@ -116,5 +115,4 @@
return nullptr;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h
index 0276cf52..7dc727d4 100644
--- a/remoting/protocol/fake_connection_to_client.h
+++ b/remoting/protocol/fake_connection_to_client.h
@@ -17,8 +17,7 @@
#include "remoting/protocol/video_stream.h"
#include "remoting/protocol/video_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeVideoStream : public protocol::VideoStream {
public:
@@ -126,7 +125,6 @@
ErrorCode disconnect_error_ = OK;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/fake_connection_to_host.cc b/remoting/protocol/fake_connection_to_host.cc
index b63b038..fd6360c 100644
--- a/remoting/protocol/fake_connection_to_host.cc
+++ b/remoting/protocol/fake_connection_to_host.cc
@@ -7,8 +7,7 @@
#include "remoting/protocol/authenticator.h"
#include "remoting/protocol/transport_context.h"
-namespace remoting {
-namespace test {
+namespace remoting::test {
FakeConnectionToHost::FakeConnectionToHost()
: session_config_(protocol::SessionConfig::ForTest()) {}
@@ -106,5 +105,4 @@
}
}
-} // namespace test
-} // namespace remoting
+} // namespace remoting::test
diff --git a/remoting/protocol/fake_connection_to_host.h b/remoting/protocol/fake_connection_to_host.h
index 9f9717e9..5f60d97 100644
--- a/remoting/protocol/fake_connection_to_host.h
+++ b/remoting/protocol/fake_connection_to_host.h
@@ -12,8 +12,7 @@
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/protocol_mock_objects.h"
-namespace remoting {
-namespace test {
+namespace remoting::test {
class FakeConnectionToHost : public protocol::ConnectionToHost {
public:
@@ -62,7 +61,6 @@
std::unique_ptr<protocol::SessionConfig> session_config_;
};
-} // namespace test
-} // namespace remoting
+} // namespace remoting::test
#endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/fake_datagram_socket.cc b/remoting/protocol/fake_datagram_socket.cc
index 9baee53..d4378c6 100644
--- a/remoting/protocol/fake_datagram_socket.cc
+++ b/remoting/protocol/fake_datagram_socket.cc
@@ -15,8 +15,7 @@
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeDatagramSocket::FakeDatagramSocket()
: input_pos_(0), task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
@@ -187,5 +186,4 @@
channels_.erase(name);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_datagram_socket.h b/remoting/protocol/fake_datagram_socket.h
index e67251de..4de50423 100644
--- a/remoting/protocol/fake_datagram_socket.h
+++ b/remoting/protocol/fake_datagram_socket.h
@@ -19,8 +19,7 @@
class SingleThreadTaskRunner;
}
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// FakeDatagramSocket implement P2PStreamSocket interface. All data written to
// FakeDatagramSocket is stored in a buffer returned by written_packets().
@@ -147,7 +146,6 @@
base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_
diff --git a/remoting/protocol/fake_desktop_capturer.cc b/remoting/protocol/fake_desktop_capturer.cc
index 17533d4..7c446ba 100644
--- a/remoting/protocol/fake_desktop_capturer.cc
+++ b/remoting/protocol/fake_desktop_capturer.cc
@@ -15,8 +15,7 @@
#include "base/time/time.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// FakeDesktopCapturer generates a white picture of size kWidth x kHeight
// with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed
@@ -180,5 +179,4 @@
return false;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe.cc b/remoting/protocol/fake_message_pipe.cc
index 075511d5..2c3310e 100644
--- a/remoting/protocol/fake_message_pipe.cc
+++ b/remoting/protocol/fake_message_pipe.cc
@@ -14,8 +14,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeMessagePipe::FakeMessagePipe(bool asynchronous)
: asynchronous_(asynchronous) {}
@@ -132,5 +131,4 @@
event_handler_->OnMessagePipeClosed();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe.h b/remoting/protocol/fake_message_pipe.h
index d45d671..8236180 100644
--- a/remoting/protocol/fake_message_pipe.h
+++ b/remoting/protocol/fake_message_pipe.h
@@ -18,8 +18,7 @@
} // namespace protobuf
} // namespace google
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeMessagePipeWrapper;
@@ -72,7 +71,6 @@
base::queue<std::string> sent_messages_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_
diff --git a/remoting/protocol/fake_message_pipe_wrapper.cc b/remoting/protocol/fake_message_pipe_wrapper.cc
index 0d0c676..85cc908 100644
--- a/remoting/protocol/fake_message_pipe_wrapper.cc
+++ b/remoting/protocol/fake_message_pipe_wrapper.cc
@@ -11,8 +11,7 @@
#include "remoting/base/compound_buffer.h"
#include "remoting/protocol/fake_message_pipe.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeMessagePipeWrapper::FakeMessagePipeWrapper(FakeMessagePipe* pipe)
: pipe_(pipe) {
@@ -42,5 +41,4 @@
pipe_->ClosePipe();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_message_pipe_wrapper.h b/remoting/protocol/fake_message_pipe_wrapper.h
index 64ec7585..ec00cb3 100644
--- a/remoting/protocol/fake_message_pipe_wrapper.h
+++ b/remoting/protocol/fake_message_pipe_wrapper.h
@@ -16,8 +16,7 @@
} // namespace protobuf
} // namespace google
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeMessagePipe;
@@ -41,7 +40,6 @@
const raw_ptr<FakeMessagePipe> pipe_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_WRAPPER_H_
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index 00f919b..325b843 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -14,8 +14,7 @@
#include "remoting/protocol/session_plugin.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
const char kTestJid[] = "[email protected]/chromoting123";
const char kTestAuthKey[] = "test_auth_key";
@@ -136,5 +135,4 @@
attachments_[round] = std::move(attachment);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index dd101a17..f600191 100644
--- a/remoting/protocol/fake_session.h
+++ b/remoting/protocol/fake_session.h
@@ -18,8 +18,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/transport.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
extern const char kTestJid[];
@@ -85,7 +84,6 @@
base::WeakPtrFactory<FakeSession> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_SESSION_H_
diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc
index f1ad9d9..7d9b854 100644
--- a/remoting/protocol/fake_stream_socket.cc
+++ b/remoting/protocol/fake_stream_socket.cc
@@ -17,8 +17,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeStreamSocket::FakeStreamSocket()
: task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
@@ -206,5 +205,4 @@
channels_.erase(name);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_stream_socket.h b/remoting/protocol/fake_stream_socket.h
index 5b9833f..6830459 100644
--- a/remoting/protocol/fake_stream_socket.h
+++ b/remoting/protocol/fake_stream_socket.h
@@ -19,8 +19,7 @@
class SingleThreadTaskRunner;
}
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// FakeStreamSocket implement P2PStreamSocket interface. All data written to
// FakeStreamSocket is stored in a buffer returned by written_data(). Read()
@@ -155,7 +154,6 @@
base::WeakPtrFactory<FakeStreamChannelFactory> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_STREAM_SOCKET_H_
diff --git a/remoting/protocol/fake_video_renderer.cc b/remoting/protocol/fake_video_renderer.cc
index 3a6bc99e..f74028cd3 100644
--- a/remoting/protocol/fake_video_renderer.cc
+++ b/remoting/protocol/fake_video_renderer.cc
@@ -11,22 +11,21 @@
#include "remoting/proto/video.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FakeVideoStub::FakeVideoStub() = default;
FakeVideoStub::~FakeVideoStub() = default;
void FakeVideoStub::set_on_frame_callback(
const base::RepeatingClosure& on_frame_callback) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
on_frame_callback_ = on_frame_callback;
}
void FakeVideoStub::ProcessVideoPacket(
std::unique_ptr<VideoPacket> video_packet,
base::OnceClosure done) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
received_packets_.push_back(std::move(video_packet));
if (!done.is_null())
std::move(done).Run();
@@ -39,19 +38,19 @@
void FakeFrameConsumer::set_on_frame_callback(
const base::RepeatingClosure& on_frame_callback) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
on_frame_callback_ = on_frame_callback;
}
std::unique_ptr<webrtc::DesktopFrame> FakeFrameConsumer::AllocateFrame(
const webrtc::DesktopSize& size) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return std::make_unique<webrtc::BasicDesktopFrame>(size);
}
void FakeFrameConsumer::DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
base::OnceClosure done) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
received_frames_.push_back(std::move(frame));
if (done)
std::move(done).Run();
@@ -60,7 +59,7 @@
}
FrameConsumer::PixelFormat FakeFrameConsumer::GetPixelFormat() {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return FORMAT_BGRA;
}
@@ -73,7 +72,7 @@
}
void FakeFrameStatsConsumer::OnVideoFrameStats(const FrameStats& stats) {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
received_stats_.push_back(stats);
if (!on_stats_callback_.is_null())
on_stats_callback_.Run();
@@ -91,19 +90,18 @@
void FakeVideoRenderer::OnSessionConfig(const SessionConfig& config) {}
FakeVideoStub* FakeVideoRenderer::GetVideoStub() {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return &video_stub_;
}
FakeFrameConsumer* FakeVideoRenderer::GetFrameConsumer() {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return &frame_consumer_;
}
FakeFrameStatsConsumer* FakeVideoRenderer::GetFrameStatsConsumer() {
- CHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return &frame_stats_consumer_;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/fake_video_renderer.h b/remoting/protocol/fake_video_renderer.h
index 0e2af76..0f9cbb69 100644
--- a/remoting/protocol/fake_video_renderer.h
+++ b/remoting/protocol/fake_video_renderer.h
@@ -15,8 +15,7 @@
#include "remoting/protocol/video_renderer.h"
#include "remoting/protocol/video_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FakeVideoStub : public VideoStub {
public:
@@ -34,10 +33,10 @@
base::OnceClosure done) override;
private:
- base::ThreadChecker thread_checker_;
-
std::list<std::unique_ptr<VideoPacket>> received_packets_;
base::RepeatingClosure on_frame_callback_;
+
+ THREAD_CHECKER(thread_checker_);
};
class FakeFrameConsumer : public FrameConsumer {
@@ -59,10 +58,10 @@
PixelFormat GetPixelFormat() override;
private:
- base::ThreadChecker thread_checker_;
-
std::list<std::unique_ptr<webrtc::DesktopFrame>> received_frames_;
base::RepeatingClosure on_frame_callback_;
+
+ THREAD_CHECKER(thread_checker_);
};
class FakeFrameStatsConsumer : public FrameStatsConsumer {
@@ -78,10 +77,10 @@
void OnVideoFrameStats(const FrameStats& stats) override;
private:
- base::ThreadChecker thread_checker_;
-
std::list<FrameStats> received_stats_;
base::RepeatingClosure on_stats_callback_;
+
+ THREAD_CHECKER(thread_checker_);
};
class FakeVideoRenderer : public VideoRenderer {
@@ -98,14 +97,13 @@
FakeFrameStatsConsumer* GetFrameStatsConsumer() override;
private:
- base::ThreadChecker thread_checker_;
-
FakeVideoStub video_stub_;
FakeFrameConsumer frame_consumer_;
FakeFrameStatsConsumer frame_stats_consumer_;
+
+ THREAD_CHECKER(thread_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FAKE_VIDEO_RENDERER_H_
diff --git a/remoting/protocol/file_transfer_helpers.cc b/remoting/protocol/file_transfer_helpers.cc
index cfb31ea..a4a5e7a 100644
--- a/remoting/protocol/file_transfer_helpers.cc
+++ b/remoting/protocol/file_transfer_helpers.cc
@@ -4,8 +4,7 @@
#include "remoting/protocol/file_transfer_helpers.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
FileTransfer_Error MakeFileTransferError(
base::Location location,
@@ -33,5 +32,4 @@
return stream;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/file_transfer_helpers.h b/remoting/protocol/file_transfer_helpers.h
index 4fd2d925..420a8dbf 100644
--- a/remoting/protocol/file_transfer_helpers.h
+++ b/remoting/protocol/file_transfer_helpers.h
@@ -13,8 +13,7 @@
#include "remoting/proto/file_transfer.pb.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
template <typename SuccessType>
using FileTransferResult = Result<SuccessType, FileTransfer_Error>;
@@ -26,7 +25,6 @@
std::ostream& operator<<(std::ostream& stream, const FileTransfer_Error& error);
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FILE_TRANSFER_HELPERS_H_
diff --git a/remoting/protocol/frame_consumer.h b/remoting/protocol/frame_consumer.h
index fc148bd..5106d35 100644
--- a/remoting/protocol/frame_consumer.h
+++ b/remoting/protocol/frame_consumer.h
@@ -14,15 +14,14 @@
class DesktopSize;
} // namespace webrtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FrameConsumer {
public:
FrameConsumer(const FrameConsumer&) = delete;
FrameConsumer& operator=(const FrameConsumer&) = delete;
- virtual ~FrameConsumer() {}
+ virtual ~FrameConsumer() = default;
// List of supported pixel formats needed by various platforms.
enum PixelFormat {
@@ -40,10 +39,9 @@
virtual PixelFormat GetPixelFormat() = 0;
protected:
- FrameConsumer() {}
+ FrameConsumer() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_FRAME_CONSUMER_H_
diff --git a/remoting/protocol/frame_stats.cc b/remoting/protocol/frame_stats.cc
index df995e3a..26473f0 100644
--- a/remoting/protocol/frame_stats.cc
+++ b/remoting/protocol/frame_stats.cc
@@ -7,8 +7,7 @@
#include "remoting/proto/video.pb.h"
#include "remoting/proto/video_stats.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ClientFrameStats::ClientFrameStats() = default;
ClientFrameStats::ClientFrameStats(const ClientFrameStats&) = default;
@@ -152,5 +151,4 @@
FrameStats::FrameStats(const FrameStats&) = default;
FrameStats::~FrameStats() = default;
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/frame_stats_unittest.cc b/remoting/protocol/frame_stats_unittest.cc
index c3de501..e38bd2d 100644
--- a/remoting/protocol/frame_stats_unittest.cc
+++ b/remoting/protocol/frame_stats_unittest.cc
@@ -6,8 +6,7 @@
#include "remoting/proto/video_stats.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class FrameStatsTest : public testing::Test {};
@@ -42,5 +41,4 @@
EXPECT_EQ(stats.frame_quality, newStats.frame_quality);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc
index 622a49a..3da6b9e 100644
--- a/remoting/protocol/host_control_dispatcher.cc
+++ b/remoting/protocol/host_control_dispatcher.cc
@@ -15,8 +15,7 @@
#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/message_serialization.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
HostControlDispatcher::HostControlDispatcher()
: ChannelDispatcherBase(kControlChannelName) {}
@@ -131,5 +130,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h
index 5c1355fe..cca07906 100644
--- a/remoting/protocol/host_control_dispatcher.h
+++ b/remoting/protocol/host_control_dispatcher.h
@@ -14,15 +14,14 @@
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/cursor_shape_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class HostStub;
class PairingResponse;
-// HostControlDispatcher dispatches incoming messages on the control
-// channel to HostStub or ClipboardStub, and also implements ClientStub and
-// CursorShapeStub for outgoing messages.
+// HostControlDispatcher dispatches incoming messages on the control channel to
+// HostStub or ClipboardStub, and also implements ClientStub and CursorShapeStub
+// for outgoing messages.
class HostControlDispatcher : public ChannelDispatcherBase,
public ClientStub {
public:
@@ -55,8 +54,8 @@
clipboard_stub_ = clipboard_stub;
}
- // Sets the HostStub that will be called for each incoming control
- // message. |host_stub| must outlive this object.
+ // Sets the HostStub that will be called for each incoming control message.
+ // |host_stub| must outlive this object.
void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; }
// Sets the maximum size of outgoing messages, which defaults to 64KiB. This
@@ -73,12 +72,11 @@
raw_ptr<ClipboardStub> clipboard_stub_ = nullptr;
raw_ptr<HostStub> host_stub_ = nullptr;
- // 64 KiB is the default message size expected to be supported in absence of
- // a higher value negotiated via SDP.
+ // 64 KiB is the default message size expected to be supported in absence of a
+ // higher value negotiated via SDP.
std::size_t max_message_size_ = 64 * 1024;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc
index 5069304..b5c1642 100644
--- a/remoting/protocol/host_event_dispatcher.cc
+++ b/remoting/protocol/host_event_dispatcher.cc
@@ -13,8 +13,7 @@
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/message_serialization.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
HostEventDispatcher::HostEventDispatcher()
: ChannelDispatcherBase(kEventChannelName),
@@ -58,5 +57,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h
index a70855e..c30a01b 100644
--- a/remoting/protocol/host_event_dispatcher.h
+++ b/remoting/protocol/host_event_dispatcher.h
@@ -11,13 +11,12 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/input_event_timestamps.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class InputStub;
-// HostEventDispatcher dispatches incoming messages on the event
-// channel to InputStub.
+// HostEventDispatcher dispatches incoming messages on the event channel to
+// InputStub.
class HostEventDispatcher : public ChannelDispatcherBase {
public:
HostEventDispatcher();
@@ -52,7 +51,6 @@
raw_ptr<InputStub> input_stub_ = nullptr;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
diff --git a/remoting/protocol/host_stub.h b/remoting/protocol/host_stub.h
index fcae747c..46ebc26 100644
--- a/remoting/protocol/host_stub.h
+++ b/remoting/protocol/host_stub.h
@@ -9,8 +9,7 @@
#ifndef REMOTING_PROTOCOL_HOST_STUB_H_
#define REMOTING_PROTOCOL_HOST_STUB_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioControl;
class Capabilities;
@@ -23,7 +22,7 @@
class HostStub {
public:
- HostStub() {}
+ HostStub() = default;
HostStub(const HostStub&) = delete;
HostStub& operator=(const HostStub&) = delete;
@@ -59,10 +58,9 @@
const SelectDesktopDisplayRequest& select_display) = 0;
protected:
- virtual ~HostStub() {}
+ virtual ~HostStub() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_HOST_STUB_H_
diff --git a/remoting/protocol/host_video_dispatcher.cc b/remoting/protocol/host_video_dispatcher.cc
index bc23cfd..697d7fb2 100644
--- a/remoting/protocol/host_video_dispatcher.cc
+++ b/remoting/protocol/host_video_dispatcher.cc
@@ -15,8 +15,7 @@
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/video_feedback_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
HostVideoDispatcher::HostVideoDispatcher()
: ChannelDispatcherBase(kVideoChannelName) {}
@@ -37,5 +36,4 @@
video_feedback_stub_->ProcessVideoAck(std::move(ack));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/host_video_dispatcher.h b/remoting/protocol/host_video_dispatcher.h
index c186ea3..2acda1f 100644
--- a/remoting/protocol/host_video_dispatcher.h
+++ b/remoting/protocol/host_video_dispatcher.h
@@ -10,8 +10,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/video_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class VideoFeedbackStub;
@@ -38,7 +37,6 @@
raw_ptr<VideoFeedbackStub> video_feedback_stub_ = nullptr;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_HOST_VIDEO_DISPATCHER_H_
diff --git a/remoting/protocol/host_video_stats_dispatcher.cc b/remoting/protocol/host_video_stats_dispatcher.cc
index c1d433d..1ee38f96 100644
--- a/remoting/protocol/host_video_stats_dispatcher.cc
+++ b/remoting/protocol/host_video_stats_dispatcher.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/video_stats_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
HostVideoStatsDispatcher::HostVideoStatsDispatcher(
const std::string& stream_name)
@@ -40,5 +39,4 @@
void HostVideoStatsDispatcher::OnIncomingMessage(
std::unique_ptr<CompoundBuffer> message) {}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/host_video_stats_dispatcher.h b/remoting/protocol/host_video_stats_dispatcher.h
index 6d4d626..11ab4a8 100644
--- a/remoting/protocol/host_video_stats_dispatcher.h
+++ b/remoting/protocol/host_video_stats_dispatcher.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/channel_dispatcher_base.h"
#include "remoting/protocol/video_stats_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class HostVideoStatsDispatcher : public ChannelDispatcherBase,
public VideoStatsStub {
@@ -34,7 +33,6 @@
base::WeakPtrFactory<HostVideoStatsDispatcher> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_HOST_VIDEO_STATS_DISPATCHER_H_
diff --git a/remoting/protocol/ice_config.cc b/remoting/protocol/ice_config.cc
index 9b49beb..471bd8a 100644
--- a/remoting/protocol/ice_config.cc
+++ b/remoting/protocol/ice_config.cc
@@ -16,8 +16,7 @@
#include "net/base/url_util.h"
#include "remoting/proto/remoting/v1/network_traversal_messages.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -262,5 +261,4 @@
return ice_config;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_config_request.h b/remoting/protocol/ice_config_request.h
index f969a951..76015293 100644
--- a/remoting/protocol/ice_config_request.h
+++ b/remoting/protocol/ice_config_request.h
@@ -7,8 +7,7 @@
#include "base/callback_forward.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
struct IceConfig;
@@ -26,7 +25,6 @@
virtual void Send(OnIceConfigCallback callback) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ICE_CONFIG_REQUEST_H_
diff --git a/remoting/protocol/ice_config_unittest.cc b/remoting/protocol/ice_config_unittest.cc
index 4ab649c..5b529fe 100644
--- a/remoting/protocol/ice_config_unittest.cc
+++ b/remoting/protocol/ice_config_unittest.cc
@@ -8,8 +8,7 @@
#include "remoting/proto/remoting/v1/network_traversal_messages.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
TEST(IceConfigTest, ParseValid) {
const char kTestConfigJson[] =
@@ -235,5 +234,4 @@
EXPECT_EQ(2000, config2.max_bitrate_kbps);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc
index e392899c..58529ff 100644
--- a/remoting/protocol/ice_connection_to_client.cc
+++ b/remoting/protocol/ice_connection_to_client.cc
@@ -26,8 +26,7 @@
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/video_frame_pump.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -69,22 +68,22 @@
}
IceConnectionToClient::~IceConnectionToClient() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void IceConnectionToClient::SetEventHandler(
ConnectionToClient::EventHandler* event_handler) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_handler_ = event_handler;
}
protocol::Session* IceConnectionToClient::session() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return session_.get();
}
void IceConnectionToClient::Disconnect(ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// This should trigger OnConnectionClosed() event and this object
// may be destroyed as the result.
@@ -94,7 +93,7 @@
std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream(
const std::string& stream_name,
std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::unique_ptr<VideoEncoder> video_encoder =
VideoEncoder::Create(session_->config());
@@ -109,7 +108,7 @@
std::unique_ptr<AudioStream> IceConnectionToClient::StartAudioStream(
std::unique_ptr<AudioSource> audio_source) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Audio channel is disabled.
if (!audio_writer_)
@@ -125,23 +124,23 @@
// Return pointer to ClientStub.
ClientStub* IceConnectionToClient::client_stub() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return control_dispatcher_.get();
}
void IceConnectionToClient::set_clipboard_stub(
protocol::ClipboardStub* clipboard_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
control_dispatcher_->set_clipboard_stub(clipboard_stub);
}
void IceConnectionToClient::set_host_stub(protocol::HostStub* host_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
control_dispatcher_->set_host_stub(host_stub);
}
void IceConnectionToClient::set_input_stub(protocol::InputStub* input_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_dispatcher_->set_input_stub(input_stub);
}
@@ -154,7 +153,7 @@
}
void IceConnectionToClient::OnSessionStateChange(Session::State state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(event_handler_);
switch (state) {
@@ -200,25 +199,25 @@
}
void IceConnectionToClient::OnIceTransportError(ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Disconnect(error);
}
void IceConnectionToClient::OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
NotifyIfChannelsReady();
}
void IceConnectionToClient::OnChannelClosed(
ChannelDispatcherBase* channel_dispatcher) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Disconnect(OK);
}
void IceConnectionToClient::NotifyIfChannelsReady() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!control_dispatcher_ || !control_dispatcher_->is_connected())
return;
@@ -241,5 +240,4 @@
audio_writer_.reset();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_client.h b/remoting/protocol/ice_connection_to_client.h
index a2da4be..5a0a88e 100644
--- a/remoting/protocol/ice_connection_to_client.h
+++ b/remoting/protocol/ice_connection_to_client.h
@@ -19,17 +19,15 @@
#include "remoting/protocol/ice_transport.h"
#include "remoting/protocol/session.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioWriter;
class HostControlDispatcher;
class HostEventDispatcher;
class HostVideoDispatcher;
-// This class represents a remote viewer connection to the chromoting
-// host. It sets up all protocol channels and connects them to the
-// stubs.
+// This class represents a remote viewer connection to the chromoting host. It
+// sets up all protocol channels and connects them to the stubs.
class IceConnectionToClient : public ConnectionToClient,
public Session::EventHandler,
public IceTransport::EventHandler,
@@ -83,8 +81,6 @@
void CloseChannels();
- base::ThreadChecker thread_checker_;
-
// Event handler for handling events sent from this object.
raw_ptr<ConnectionToClient::EventHandler> event_handler_;
@@ -99,9 +95,10 @@
std::unique_ptr<HostEventDispatcher> event_dispatcher_;
std::unique_ptr<HostVideoDispatcher> video_dispatcher_;
std::unique_ptr<AudioWriter> audio_writer_;
+
+ THREAD_CHECKER(thread_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/ice_connection_to_host.cc b/remoting/protocol/ice_connection_to_host.cc
index 0aaad8a..c728d75 100644
--- a/remoting/protocol/ice_connection_to_host.cc
+++ b/remoting/protocol/ice_connection_to_host.cc
@@ -25,8 +25,7 @@
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/video_renderer.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
IceConnectionToHost::IceConnectionToHost() = default;
@@ -235,5 +234,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_connection_to_host.h b/remoting/protocol/ice_connection_to_host.h
index 5de9521..e7bdbad 100644
--- a/remoting/protocol/ice_connection_to_host.h
+++ b/remoting/protocol/ice_connection_to_host.h
@@ -25,8 +25,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/session_config.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioDecodeScheduler;
class AudioReader;
@@ -114,7 +113,6 @@
SEQUENCE_CHECKER(sequence_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/ice_transport.cc b/remoting/protocol/ice_transport.cc
index 30be726..40dd569b 100644
--- a/remoting/protocol/ice_transport.cc
+++ b/remoting/protocol/ice_transport.cc
@@ -15,8 +15,7 @@
#include "remoting/protocol/stream_message_pipe_adapter.h"
#include "remoting/protocol/transport_context.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Delay after candidate creation before sending transport-info message to
// accumulate multiple candidates. This is an optimization to reduce number of
@@ -53,7 +52,8 @@
weak_factory_.GetWeakPtr()));
}
-bool IceTransport::ProcessTransportInfo(jingle_xmpp::XmlElement* transport_info_xml) {
+bool IceTransport::ProcessTransportInfo(
+ jingle_xmpp::XmlElement* transport_info_xml) {
IceTransportInfo transport_info;
if (!transport_info.ParseXml(transport_info_xml))
return false;
@@ -204,5 +204,4 @@
event_handler_->OnIceTransportError(error ? CHANNEL_CONNECTION_ERROR : OK);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_transport.h b/remoting/protocol/ice_transport.h
index 478a7664..60018a3d 100644
--- a/remoting/protocol/ice_transport.h
+++ b/remoting/protocol/ice_transport.h
@@ -16,8 +16,7 @@
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/transport.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ChannelMultiplexer;
class PseudoTcpChannelFactory;
@@ -113,7 +112,6 @@
base::WeakPtrFactory<IceTransport> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ICE_TRANSPORT_H_
diff --git a/remoting/protocol/ice_transport_channel.cc b/remoting/protocol/ice_transport_channel.cc
index 48e34f3..c67c204 100644
--- a/remoting/protocol/ice_transport_channel.cc
+++ b/remoting/protocol/ice_transport_channel.cc
@@ -22,8 +22,7 @@
#include "third_party/webrtc/p2p/base/packet_transport_internal.h"
#include "third_party/webrtc/p2p/base/port.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -58,7 +57,7 @@
IceTransportChannel::~IceTransportChannel() {
DCHECK(delegate_);
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
delegate_->OnChannelDeleted(this);
@@ -72,7 +71,7 @@
void IceTransportChannel::Connect(const std::string& name,
Delegate* delegate,
ConnectedCallback callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!name.empty());
DCHECK(delegate);
DCHECK(!callback.is_null());
@@ -144,7 +143,7 @@
void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag,
const std::string& password) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
remote_ice_username_fragment_ = ufrag;
remote_ice_password_ = password;
@@ -155,7 +154,7 @@
void IceTransportChannel::AddRemoteCandidate(
const cricket::Candidate& candidate) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// To enforce the no-relay setting, it's not enough to not produce relay
// candidates. It's also necessary to discard remote relay candidates.
@@ -172,19 +171,19 @@
}
const std::string& IceTransportChannel::name() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return name_;
}
bool IceTransportChannel::is_connected() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return callback_.is_null();
}
void IceTransportChannel::OnCandidateGathered(
cricket::IceTransportInternal* ice_transport,
const cricket::Candidate& candidate) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
delegate_->OnChannelCandidate(this, candidate);
}
@@ -274,5 +273,4 @@
channel_->SetIceCredentials(ice_username_fragment_, ice_password);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ice_transport_channel.h b/remoting/protocol/ice_transport_channel.h
index 7f7d5afb..fe3eb50 100644
--- a/remoting/protocol/ice_transport_channel.h
+++ b/remoting/protocol/ice_transport_channel.h
@@ -28,8 +28,7 @@
class PortAllocator;
} // namespace cricket
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PDatagramSocket;
class TransportContext;
@@ -133,12 +132,11 @@
int connect_attempts_left_;
base::RepeatingTimer reconnect_timer_;
- base::ThreadChecker thread_checker_;
+ THREAD_CHECKER(thread_checker_);
base::WeakPtrFactory<IceTransportChannel> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_
diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc
index f0ea39ab..3045e93 100644
--- a/remoting/protocol/ice_transport_unittest.cc
+++ b/remoting/protocol/ice_transport_unittest.cc
@@ -32,8 +32,7 @@
using testing::_;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -371,5 +370,4 @@
tester.RunAndCheckResults();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_timestamps.cc b/remoting/protocol/input_event_timestamps.cc
index e4dcbb69..ba8867d 100644
--- a/remoting/protocol/input_event_timestamps.cc
+++ b/remoting/protocol/input_event_timestamps.cc
@@ -4,8 +4,7 @@
#include "remoting/protocol/input_event_timestamps.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
InputEventTimestampsSourceImpl::InputEventTimestampsSourceImpl() = default;
InputEventTimestampsSourceImpl::~InputEventTimestampsSourceImpl() = default;
@@ -21,5 +20,4 @@
return result;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_timestamps.h b/remoting/protocol/input_event_timestamps.h
index 2bf84cf..6e588f6 100644
--- a/remoting/protocol/input_event_timestamps.h
+++ b/remoting/protocol/input_event_timestamps.h
@@ -8,8 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Used on the host side to track timestamps for input events.
struct InputEventTimestamps {
@@ -29,7 +28,7 @@
class InputEventTimestampsSource
: public base::RefCountedThreadSafe<InputEventTimestampsSource> {
public:
- InputEventTimestampsSource() {}
+ InputEventTimestampsSource() = default;
// Returns event timestamps for the input event that was received since the
// previous call. Null InputEventTimestamps value is returned if no input
@@ -39,7 +38,7 @@
protected:
friend base::RefCountedThreadSafe<InputEventTimestampsSource>;
- virtual ~InputEventTimestampsSource() {}
+ virtual ~InputEventTimestampsSource() = default;
};
// Simple implementations of InputEventTimestampsSource that just stores the
@@ -60,7 +59,6 @@
InputEventTimestamps last_timestamps_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_
diff --git a/remoting/protocol/input_event_tracker.cc b/remoting/protocol/input_event_tracker.cc
index 57269d0..e5c3047 100644
--- a/remoting/protocol/input_event_tracker.cc
+++ b/remoting/protocol/input_event_tracker.cc
@@ -7,8 +7,7 @@
#include "base/check.h"
#include "remoting/proto/event.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
InputEventTracker::InputEventTracker() = default;
@@ -164,5 +163,4 @@
input_stub_->InjectTouchEvent(event);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_event_tracker.h b/remoting/protocol/input_event_tracker.h
index 2a7b728..eb54a63 100644
--- a/remoting/protocol/input_event_tracker.h
+++ b/remoting/protocol/input_event_tracker.h
@@ -15,8 +15,7 @@
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "ui/events/keycodes/dom/dom_code.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Filtering InputStub which tracks mouse and keyboard input events before
// passing them on to |input_stub|, and can dispatch release events to
@@ -68,7 +67,6 @@
std::set<uint32_t> touch_point_ids_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
diff --git a/remoting/protocol/input_event_tracker_unittest.cc b/remoting/protocol/input_event_tracker_unittest.cc
index 47a4ed4c..bf8ed40 100644
--- a/remoting/protocol/input_event_tracker_unittest.cc
+++ b/remoting/protocol/input_event_tracker_unittest.cc
@@ -16,8 +16,7 @@
using ::testing::ExpectationSet;
using ::testing::InSequence;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
using test::EqualsKeyEventWithCapsLock;
using test::EqualsMouseEvent;
@@ -353,5 +352,4 @@
input_tracker.ReleaseAll();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_filter.cc b/remoting/protocol/input_filter.cc
index d5bd16c3..cc1b0f7 100644
--- a/remoting/protocol/input_filter.cc
+++ b/remoting/protocol/input_filter.cc
@@ -4,8 +4,7 @@
#include "remoting/protocol/input_filter.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
InputFilter::InputFilter() : input_stub_(nullptr), enabled_(true) {
}
@@ -36,5 +35,4 @@
input_stub_->InjectTouchEvent(event);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_filter.h b/remoting/protocol/input_filter.h
index bb5cb567..d144377 100644
--- a/remoting/protocol/input_filter.h
+++ b/remoting/protocol/input_filter.h
@@ -9,8 +9,7 @@
#include "base/memory/raw_ptr.h"
#include "remoting/protocol/input_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Forwards input events to |input_stub|, if configured. Input forwarding may
// also be disabled independently of the |input_stub| being set. InputFilters
@@ -49,7 +48,6 @@
bool enabled_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_INPUT_FILTER_H_
diff --git a/remoting/protocol/input_filter_unittest.cc b/remoting/protocol/input_filter_unittest.cc
index 952a1ebd..95f27d05 100644
--- a/remoting/protocol/input_filter_unittest.cc
+++ b/remoting/protocol/input_filter_unittest.cc
@@ -14,8 +14,7 @@
using ::testing::_;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
using test::EqualsKeyEvent;
using test::EqualsMouseMoveEvent;
@@ -82,5 +81,4 @@
InjectTestSequence(&input_filter);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/input_stub.h b/remoting/protocol/input_stub.h
index 5469489..878097b 100644
--- a/remoting/protocol/input_stub.h
+++ b/remoting/protocol/input_stub.h
@@ -8,8 +8,7 @@
#ifndef REMOTING_PROTOCOL_INPUT_STUB_H_
#define REMOTING_PROTOCOL_INPUT_STUB_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class KeyEvent;
class TextEvent;
@@ -18,22 +17,21 @@
class InputStub {
public:
- InputStub() {}
+ InputStub() = default;
InputStub(const InputStub&) = delete;
InputStub& operator=(const InputStub&) = delete;
- virtual ~InputStub() {}
+ virtual ~InputStub() = default;
- // Implementations must never assume the presence of any |event| fields,
- // nor assume that their contents are valid.
+ // Implementations must never assume the presence of any |event| fields, nor
+ // assume that their contents are valid.
virtual void InjectKeyEvent(const KeyEvent& event) = 0;
virtual void InjectTextEvent(const TextEvent& event) = 0;
virtual void InjectMouseEvent(const MouseEvent& event) = 0;
virtual void InjectTouchEvent(const TouchEvent& event) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_INPUT_STUB_H_
diff --git a/remoting/protocol/it2me_host_authenticator_factory.cc b/remoting/protocol/it2me_host_authenticator_factory.cc
index f48f0c27..24c0faf 100644
--- a/remoting/protocol/it2me_host_authenticator_factory.cc
+++ b/remoting/protocol/it2me_host_authenticator_factory.cc
@@ -12,8 +12,7 @@
#include "remoting/protocol/negotiating_host_authenticator.h"
#include "remoting/protocol/validating_authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory(
const std::string& local_cert,
@@ -40,5 +39,4 @@
remote_jid, std::move(validation_callback_), std::move(authenticator));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc
index 7a0ef5dd..cebab92c 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -18,8 +18,7 @@
using jingle_xmpp::QName;
using jingle_xmpp::XmlElement;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -560,5 +559,4 @@
return result;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h
index 3731526..cbc4f4b 100644
--- a/remoting/protocol/jingle_messages.h
+++ b/remoting/protocol/jingle_messages.h
@@ -14,8 +14,7 @@
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
#include "third_party/webrtc/api/candidate.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ContentDescription;
@@ -153,7 +152,6 @@
std::list<NamedCandidate> candidates;
};
-} // protocol
-} // remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_
diff --git a/remoting/protocol/jingle_messages_unittest.cc b/remoting/protocol/jingle_messages_unittest.cc
index d7513798..20da694 100644
--- a/remoting/protocol/jingle_messages_unittest.cc
+++ b/remoting/protocol/jingle_messages_unittest.cc
@@ -17,8 +17,7 @@
using jingle_xmpp::XmlAttr;
using jingle_xmpp::XmlElement;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -634,5 +633,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 90603619..d23d449c 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -32,8 +32,7 @@
using jingle_xmpp::XmlElement;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -199,25 +198,25 @@
message_queue_(new OrderedMessageQueue) {}
JingleSession::~JingleSession() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
session_manager_->SessionDestroyed(this);
}
void JingleSession::SetEventHandler(Session::EventHandler* event_handler) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(event_handler);
event_handler_ = event_handler;
}
ErrorCode JingleSession::error() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return error_;
}
void JingleSession::StartConnection(
const SignalingAddress& peer_address,
std::unique_ptr<Authenticator> authenticator) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(authenticator.get());
DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY);
@@ -244,7 +243,7 @@
const std::string& message_id,
const JingleMessage& initiate_message,
std::unique_ptr<Authenticator> authenticator) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(initiate_message.description.get());
DCHECK(authenticator.get());
DCHECK_EQ(authenticator->state(), Authenticator::WAITING_MESSAGE);
@@ -322,17 +321,17 @@
}
const std::string& JingleSession::jid() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return peer_address_.id();
}
const SessionConfig& JingleSession::config() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return *config_;
}
void JingleSession::SetTransport(Transport* transport) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!transport_);
DCHECK(transport);
transport_ = transport;
@@ -340,7 +339,7 @@
void JingleSession::SendTransportInfo(
std::unique_ptr<jingle_xmpp::XmlElement> transport_info) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_EQ(state_, AUTHENTICATED);
std::unique_ptr<JingleMessage> message(new JingleMessage(
@@ -363,7 +362,7 @@
}
void JingleSession::Close(protocol::ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (is_session_active()) {
// Send session-terminate message with the appropriate error code.
@@ -417,7 +416,7 @@
}
void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (message->action != JingleMessage::SESSION_TERMINATE) {
// When the host accepts session-initiate message from a client JID it
@@ -454,7 +453,7 @@
JingleMessage::ActionType request_type,
IqRequest* request,
const jingle_xmpp::XmlElement* response) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Delete the request from the list of pending requests.
pending_requests_.erase(
@@ -491,7 +490,7 @@
void JingleSession::OnTransportInfoResponse(IqRequest* request,
const jingle_xmpp::XmlElement* response) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!transport_info_requests_.empty());
// Consider transport-info requests sent before this one lost and delete
@@ -537,7 +536,7 @@
void JingleSession::ProcessIncomingMessage(
std::unique_ptr<JingleMessage> message,
ReplyCallback reply_callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (peer_address_ != message->from) {
// Ignore messages received from a different Jid.
@@ -718,7 +717,7 @@
}
void JingleSession::ProcessAuthenticationStep() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK_NE(authenticator_->state(), Authenticator::PROCESSING_MESSAGE);
if (state_ != ACCEPTED && state_ != AUTHENTICATING) {
@@ -774,7 +773,7 @@
}
void JingleSession::SetState(State new_state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (new_state != state_) {
DCHECK_NE(state_, CLOSED);
@@ -829,5 +828,4 @@
return outgoing_id_prefix_ + "_" + base::NumberToString(++next_outgoing_id_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 39349f5..a6fedb6f 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -22,15 +22,14 @@
#include "remoting/protocol/session_config.h"
#include "remoting/signaling/iq_sender.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class JingleSessionManager;
class Transport;
-// JingleSessionManager and JingleSession implement the subset of the
-// Jingle protocol used in Chromoting. Instances of this class are
-// created by the JingleSessionManager.
+// JingleSessionManager and JingleSession implement the subset of the Jingle
+// protocol used in Chromoting. Instances of this class are created by the
+// JingleSessionManager.
class JingleSession : public Session {
public:
JingleSession(const JingleSession&) = delete;
@@ -136,8 +135,6 @@
// sequence ID encoded.
std::string GetNextOutgoingId();
- base::ThreadChecker thread_checker_;
-
raw_ptr<JingleSessionManager> session_manager_;
SignalingAddress peer_address_;
raw_ptr<Session::EventHandler> event_handler_;
@@ -185,10 +182,11 @@
// The SessionPlugins attached to this session.
std::vector<SessionPlugin*> plugins_;
+ THREAD_CHECKER(thread_checker_);
+
base::WeakPtrFactory<JingleSession> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index 41141c8..6f615b9 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -20,8 +20,7 @@
using jingle_xmpp::QName;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
JingleSessionManager::JingleSessionManager(SignalStrategy* signal_strategy)
: signal_strategy_(signal_strategy),
@@ -152,5 +151,4 @@
sessions_.erase(session->session_id_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index fbc8190..adc1522 100644
--- a/remoting/protocol/jingle_session_unittest.cc
+++ b/remoting/protocol/jingle_session_unittest.cc
@@ -48,8 +48,7 @@
using testing::SetArgPointee;
using testing::WithArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -637,5 +636,4 @@
ASSERT_EQ(1U, host_signal_strategy_->received_messages().size());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/keyboard_layout_stub.h b/remoting/protocol/keyboard_layout_stub.h
index 999db726..f4e2c21 100644
--- a/remoting/protocol/keyboard_layout_stub.h
+++ b/remoting/protocol/keyboard_layout_stub.h
@@ -7,8 +7,7 @@
#ifndef REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_
#define REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class KeyboardLayout;
@@ -25,7 +24,6 @@
KeyboardLayoutStub() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_KEYBOARD_LAYOUT_STUB_H_
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc
index 3aa9455..6af34f07 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.cc
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -19,8 +19,7 @@
#include "remoting/signaling/signaling_id_util.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// static
std::unique_ptr<AuthenticatorFactory>
@@ -125,5 +124,4 @@
Authenticator::RejectionReason::INVALID_CREDENTIALS));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_channel_factory.h b/remoting/protocol/message_channel_factory.h
index d0cd6f0..52f0655 100644
--- a/remoting/protocol/message_channel_factory.h
+++ b/remoting/protocol/message_channel_factory.h
@@ -10,8 +10,7 @@
#include "base/callback_forward.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class MessagePipe;
@@ -36,7 +35,6 @@
virtual void CancelChannelCreation(const std::string& name) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/message_decoder.cc b/remoting/protocol/message_decoder.cc
index c8c609c..cbc89cbb 100644
--- a/remoting/protocol/message_decoder.cc
+++ b/remoting/protocol/message_decoder.cc
@@ -12,13 +12,9 @@
#include "remoting/proto/internal.pb.h"
#include "third_party/webrtc/rtc_base/byte_order.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
-MessageDecoder::MessageDecoder()
- : next_payload_(0),
- next_payload_known_(false) {
-}
+MessageDecoder::MessageDecoder() = default;
MessageDecoder::~MessageDecoder() = default;
@@ -68,5 +64,4 @@
return true;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_decoder.h b/remoting/protocol/message_decoder.h
index de5f9c2..59cf6b5 100644
--- a/remoting/protocol/message_decoder.h
+++ b/remoting/protocol/message_decoder.h
@@ -10,31 +10,29 @@
#include "remoting/base/compound_buffer.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
-// MessageDecoder uses CompoundBuffer to split the data received from
-// the network into separate messages. Each message is expected to be
-// decoded in the stream as follows:
+// MessageDecoder uses CompoundBuffer to split the data received from the
+// network into separate messages. Each message is expected to be decoded in the
+// stream as follows:
// +--------------+--------------+
// | message_size | message_data |
// +--------------+--------------+
//
-// Here, message_size is 4-byte integer that represents size of
-// message_data in bytes. message_data - content of the message.
+// Here, message_size is 4-byte integer that represents size of message_data in
+// bytes. message_data - content of the message.
class MessageDecoder {
public:
MessageDecoder();
virtual ~MessageDecoder();
- // Add next chunk of data. MessageDecoder retains |data| until all
- // its bytes are consumed.
+ // Add next chunk of data. MessageDecoder retains |data| until all its bytes
+ // are consumed.
void AddData(scoped_refptr<net::IOBuffer> data, int data_size);
- // Returns next message from the stream. Ownership of the result is
- // passed to the caller. Returns nullptr if there are no complete
- // messages yet, otherwise returns a buffer that contains one
- // message.
+ // Returns next message from the stream. Ownership of the result is passed to
+ // the caller. Returns nullptr if there are no complete messages yet,
+ // otherwise returns a buffer that contains one message.
CompoundBuffer* GetNextMessage();
private:
@@ -48,11 +46,10 @@
// |next_payload_| stores the size of the next payload if known.
// |next_payload_known_| is true if the size of the next payload is known.
// After one payload is read this is reset to false.
- int next_payload_;
- bool next_payload_known_;
+ int next_payload_ = 0;
+ bool next_payload_known_ = false;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MESSAGE_DECODER_H_
diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc
index 7eb73f8..93b0945 100644
--- a/remoting/protocol/message_decoder_unittest.cc
+++ b/remoting/protocol/message_decoder_unittest.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/message_serialization.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
static const unsigned int kTestKey = 142;
@@ -121,5 +120,4 @@
SimulateReadSequence(kReads, std::size(kReads));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc
index 8305dc3..9ad2c85 100644
--- a/remoting/protocol/message_reader.cc
+++ b/remoting/protocol/message_reader.cc
@@ -19,12 +19,11 @@
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/p2p_stream_socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
static const int kReadBufferSize = 4096;
-MessageReader::MessageReader() {}
+MessageReader::MessageReader() = default;
MessageReader::~MessageReader() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
@@ -116,5 +115,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_reader.h b/remoting/protocol/message_reader.h
index 9fbfe6f..af6de2e4 100644
--- a/remoting/protocol/message_reader.h
+++ b/remoting/protocol/message_reader.h
@@ -18,22 +18,21 @@
class IOBuffer;
} // namespace net
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PStreamSocket;
-// MessageReader reads data from the socket asynchronously and calls
-// callback for each message it receives. It stops calling the
-// callback as soon as the socket is closed, so the socket should
-// always be closed before the callback handler is destroyed.
+// MessageReader reads data from the socket asynchronously and calls the
+// callback for each message it receives. It stops calling the callback as soon
+// as the socket is closed, so the socket should always be closed before the
+// callback handler is destroyed.
//
-// In order to throttle the stream, MessageReader doesn't try to read
-// new data from the socket until all previously received messages are
-// processed by the receiver (|done_task| is called for each message).
-// It is still possible that the MessageReceivedCallback is called
-// twice (so that there is more than one outstanding message),
-// e.g. when we the sender sends multiple messages in one TCP packet.
+// In order to throttle the stream, MessageReader doesn't try to read new data
+// from the socket until all previously received messages are processed by the
+// receiver (|done_task| is called for each message). It is still possible that
+// the MessageReceivedCallback is called twice (so that there is more than one
+// outstanding message), e.g. when we the sender sends multiple messages in one
+// TCP packet.
class MessageReader {
public:
typedef base::RepeatingCallback<void(std::unique_ptr<CompoundBuffer> message)>
@@ -83,7 +82,6 @@
base::WeakPtrFactory<MessageReader> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MESSAGE_READER_H_
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc
index 907dfc7..adafe946 100644
--- a/remoting/protocol/message_reader_unittest.cc
+++ b/remoting/protocol/message_reader_unittest.cc
@@ -24,8 +24,7 @@
using testing::Mock;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
const char kTestMessage1[] = "Message1";
@@ -199,5 +198,4 @@
base::RunLoop().RunUntilIdle();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_serialization.cc b/remoting/protocol/message_serialization.cc
index 9acf4208..cf4a327 100644
--- a/remoting/protocol/message_serialization.cc
+++ b/remoting/protocol/message_serialization.cc
@@ -9,8 +9,7 @@
#include "net/base/io_buffer.h"
#include "third_party/webrtc/rtc_base/byte_order.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage(
const google::protobuf::MessageLite& msg) {
@@ -26,5 +25,4 @@
return buffer;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/message_serialization.h b/remoting/protocol/message_serialization.h
index 6c1fe41..9a91ba3 100644
--- a/remoting/protocol/message_serialization.h
+++ b/remoting/protocol/message_serialization.h
@@ -13,8 +13,7 @@
#include "remoting/base/compound_buffer.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
template <class T>
std::unique_ptr<T> ParseMessage(CompoundBuffer* buffer) {
@@ -35,7 +34,6 @@
scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage(
const google::protobuf::MessageLite& msg);
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MESSAGE_SERIALIZATION_H_
diff --git a/remoting/protocol/monitored_video_stub.cc b/remoting/protocol/monitored_video_stub.cc
index bca113f..cae8986 100644
--- a/remoting/protocol/monitored_video_stub.cc
+++ b/remoting/protocol/monitored_video_stub.cc
@@ -10,8 +10,7 @@
#include "base/check.h"
#include "remoting/proto/video.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
MonitoredVideoStub::MonitoredVideoStub(VideoStub* video_stub,
base::TimeDelta connectivity_check_delay,
@@ -27,12 +26,12 @@
}
MonitoredVideoStub::~MonitoredVideoStub() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void MonitoredVideoStub::ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
base::OnceClosure done) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
connectivity_check_timer_.Reset();
@@ -42,7 +41,7 @@
}
void MonitoredVideoStub::OnConnectivityCheckTimeout() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
NotifyChannelState(false);
}
@@ -53,5 +52,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/monitored_video_stub.h b/remoting/protocol/monitored_video_stub.h
index 289346c..11dddd4 100644
--- a/remoting/protocol/monitored_video_stub.h
+++ b/remoting/protocol/monitored_video_stub.h
@@ -11,12 +11,7 @@
#include "base/timer/timer.h"
#include "remoting/protocol/video_stub.h"
-namespace base {
-class ThreadChecker;
-} // namespace base
-
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// MonitoredVideoStub is responsible for notifying the event handler if no
// frames have been received within |connectivity_check_delay|.
@@ -54,12 +49,12 @@
raw_ptr<VideoStub> video_stub_;
ChannelStateCallback callback_;
- base::ThreadChecker thread_checker_;
bool is_connected_;
base::DelayTimer connectivity_check_timer_;
+
+ THREAD_CHECKER(thread_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MONITORED_VIDEO_STUB_H_
diff --git a/remoting/protocol/monitored_video_stub_unittest.cc b/remoting/protocol/monitored_video_stub_unittest.cc
index 6739c3f..7e82d37 100644
--- a/remoting/protocol/monitored_video_stub_unittest.cc
+++ b/remoting/protocol/monitored_video_stub_unittest.cc
@@ -24,8 +24,7 @@
using ::testing::AtMost;
using ::testing::InvokeWithoutArgs;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
static const int64_t kTestOverrideDelayMilliseconds = 1;
@@ -97,5 +96,4 @@
base::RunLoop().Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/mouse_input_filter.cc b/remoting/protocol/mouse_input_filter.cc
index 647980b2..ca51989 100644
--- a/remoting/protocol/mouse_input_filter.cc
+++ b/remoting/protocol/mouse_input_filter.cc
@@ -11,8 +11,7 @@
#include "remoting/base/logging.h"
#include "remoting/proto/event.pb.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
MouseInputFilter::MouseInputFilter() = default;
@@ -79,5 +78,4 @@
return base::clamp(y, 0, output_bounds_.y());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/mouse_input_filter.h b/remoting/protocol/mouse_input_filter.h
index aa66bfc..27605328 100644
--- a/remoting/protocol/mouse_input_filter.h
+++ b/remoting/protocol/mouse_input_filter.h
@@ -10,8 +10,7 @@
#include "remoting/protocol/input_filter.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Filtering InputStub implementation which scales mouse events based on the
// supplied input and output dimensions, and clamps their coordinates to the
@@ -53,7 +52,6 @@
webrtc::DesktopVector output_offset_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_MOUSE_INPUT_FILTER_H_
diff --git a/remoting/protocol/mouse_input_filter_unittest.cc b/remoting/protocol/mouse_input_filter_unittest.cc
index 0760373..177ec1c 100644
--- a/remoting/protocol/mouse_input_filter_unittest.cc
+++ b/remoting/protocol/mouse_input_filter_unittest.cc
@@ -14,8 +14,7 @@
using ::testing::_;
using ::testing::InSequence;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
using test::EqualsMouseMoveEvent;
@@ -265,5 +264,4 @@
RunMouseTests(std::size(expected), injected, expected);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/named_message_pipe_handler.cc b/remoting/protocol/named_message_pipe_handler.cc
index 8058fc6..91498bf 100644
--- a/remoting/protocol/named_message_pipe_handler.cc
+++ b/remoting/protocol/named_message_pipe_handler.cc
@@ -11,8 +11,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "remoting/base/compound_buffer.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
NamedMessagePipeHandler::NamedMessagePipeHandler(
const std::string& name,
@@ -26,7 +25,7 @@
NamedMessagePipeHandler::~NamedMessagePipeHandler() = default;
void NamedMessagePipeHandler::Close() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (connected()) {
OnDisconnecting();
is_connected_ = false;
@@ -36,7 +35,7 @@
void NamedMessagePipeHandler::Send(const google::protobuf::MessageLite& message,
base::OnceClosure done) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(connected());
pipe_->Send(const_cast<google::protobuf::MessageLite*>(&message),
std::move(done));
@@ -50,7 +49,7 @@
void NamedMessagePipeHandler::OnDisconnecting() {}
void NamedMessagePipeHandler::OnMessagePipeOpen() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!is_connected_);
is_connected_ = true;
OnConnected();
@@ -58,7 +57,7 @@
void NamedMessagePipeHandler::OnMessageReceived(
std::unique_ptr<CompoundBuffer> message) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
OnIncomingMessage(std::move(message));
}
@@ -66,5 +65,4 @@
Close();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/named_message_pipe_handler.h b/remoting/protocol/named_message_pipe_handler.h
index e240cc6..49c2c68 100644
--- a/remoting/protocol/named_message_pipe_handler.h
+++ b/remoting/protocol/named_message_pipe_handler.h
@@ -69,8 +69,9 @@
const std::string name_;
std::unique_ptr<MessagePipe> pipe_;
- base::ThreadChecker thread_checker_;
bool is_connected_ = false;
+
+ THREAD_CHECKER(thread_checker_);
};
} // namespace protocol
diff --git a/remoting/protocol/negotiating_authenticator_base.cc b/remoting/protocol/negotiating_authenticator_base.cc
index d5c1b17..eeda7263 100644
--- a/remoting/protocol/negotiating_authenticator_base.cc
+++ b/remoting/protocol/negotiating_authenticator_base.cc
@@ -18,8 +18,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -165,5 +164,4 @@
return current_authenticator_->CreateChannelAuthenticator();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_authenticator_base.h b/remoting/protocol/negotiating_authenticator_base.h
index 0312cf3..58a57c2 100644
--- a/remoting/protocol/negotiating_authenticator_base.h
+++ b/remoting/protocol/negotiating_authenticator_base.h
@@ -17,8 +17,7 @@
struct StaticQName;
} // namespace jingle_xmpp
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// This class provides the common base for a meta-authenticator that allows
// clients and hosts that support multiple authentication methods to negotiate a
@@ -143,7 +142,6 @@
RejectionReason rejection_reason_ = RejectionReason::INVALID_CREDENTIALS;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc
index 135c8136b..511217cd 100644
--- a/remoting/protocol/negotiating_authenticator_unittest.cc
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -26,8 +26,7 @@
using testing::DeleteArg;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -320,5 +319,4 @@
VerifyRejected(Authenticator::RejectionReason::INVALID_CREDENTIALS);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
index 47efd58..0616380 100644
--- a/remoting/protocol/negotiating_client_authenticator.cc
+++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -22,8 +22,7 @@
#include "remoting/protocol/v2_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
const std::string& local_id,
@@ -220,5 +219,4 @@
return !config_.pairing_client_id.empty() && !config_.pairing_secret.empty();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/negotiating_client_authenticator.h b/remoting/protocol/negotiating_client_authenticator.h
index 3ea09e2..fb9f015 100644
--- a/remoting/protocol/negotiating_client_authenticator.h
+++ b/remoting/protocol/negotiating_client_authenticator.h
@@ -15,8 +15,7 @@
#include "remoting/protocol/negotiating_authenticator_base.h"
#include "remoting/protocol/third_party_client_authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Client-side implementation of NegotiatingAuthenticatorBase.
// See comments in negotiating_authenticator_base.h for a general explanation.
@@ -77,7 +76,6 @@
base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/negotiating_host_authenticator.cc b/remoting/protocol/negotiating_host_authenticator.cc
index efd3ec8..9ab4ac2 100644
--- a/remoting/protocol/negotiating_host_authenticator.cc
+++ b/remoting/protocol/negotiating_host_authenticator.cc
@@ -23,8 +23,7 @@
#include "remoting/protocol/v2_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
NegotiatingHostAuthenticator::NegotiatingHostAuthenticator(
const std::string& local_id,
@@ -246,5 +245,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/network_settings.h b/remoting/protocol/network_settings.h
index 4645efb..7838112c 100644
--- a/remoting/protocol/network_settings.h
+++ b/remoting/protocol/network_settings.h
@@ -10,8 +10,7 @@
#include "base/time/time.h"
#include "remoting/protocol/port_range.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
struct NetworkSettings {
@@ -58,7 +57,6 @@
int ice_reconnect_attempts = 2;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_NETWORK_SETTINGS_H_
diff --git a/remoting/protocol/p2p_datagram_socket.h b/remoting/protocol/p2p_datagram_socket.h
index 10e39da..fae09c5 100644
--- a/remoting/protocol/p2p_datagram_socket.h
+++ b/remoting/protocol/p2p_datagram_socket.h
@@ -11,8 +11,7 @@
class IOBuffer;
} // namespace net
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Peer-to-peer socket with datagram semantics.
class P2PDatagramSocket {
@@ -45,7 +44,6 @@
const net::CompletionRepeatingCallback& callback) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_P2P_DATAGRAM_SOCKET_H_
diff --git a/remoting/protocol/p2p_stream_socket.h b/remoting/protocol/p2p_stream_socket.h
index 2f4bbc3..f7e5feb 100644
--- a/remoting/protocol/p2p_stream_socket.h
+++ b/remoting/protocol/p2p_stream_socket.h
@@ -12,8 +12,7 @@
class IOBuffer;
} // namespace net
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Peer-to-peer socket with stream semantics.
class P2PStreamSocket {
@@ -48,7 +47,6 @@
const net::NetworkTrafficAnnotationTag& traffic_annotation) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_
diff --git a/remoting/protocol/pairing_authenticator_base.cc b/remoting/protocol/pairing_authenticator_base.cc
index 6f7ce15..8f59401d 100644
--- a/remoting/protocol/pairing_authenticator_base.cc
+++ b/remoting/protocol/pairing_authenticator_base.cc
@@ -12,8 +12,7 @@
#include "remoting/base/constants.h"
#include "remoting/protocol/channel_authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
const jingle_xmpp::StaticQName kPairingFailedTag =
@@ -77,7 +76,8 @@
weak_factory_.GetWeakPtr(), std::move(resume_callback)));
}
-std::unique_ptr<jingle_xmpp::XmlElement> PairingAuthenticatorBase::GetNextMessage() {
+std::unique_ptr<jingle_xmpp::XmlElement>
+PairingAuthenticatorBase::GetNextMessage() {
DCHECK_EQ(state(), MESSAGE_READY);
std::unique_ptr<jingle_xmpp::XmlElement> result =
spake2_authenticator_->GetNextMessage();
@@ -94,7 +94,8 @@
return spake2_authenticator_->CreateChannelAuthenticator();
}
-void PairingAuthenticatorBase::MaybeAddErrorMessage(jingle_xmpp::XmlElement* message) {
+void PairingAuthenticatorBase::MaybeAddErrorMessage(
+ jingle_xmpp::XmlElement* message) {
if (!error_message_.empty()) {
jingle_xmpp::XmlElement* pairing_failed_tag =
new jingle_xmpp::XmlElement(kPairingFailedTag);
@@ -134,5 +135,4 @@
std::move(resume_callback).Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_authenticator_base.h b/remoting/protocol/pairing_authenticator_base.h
index 9424deb3..db31bd0 100644
--- a/remoting/protocol/pairing_authenticator_base.h
+++ b/remoting/protocol/pairing_authenticator_base.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// The pairing authenticator builds on top of V2Authenticator to add
// support for PIN-less authentication via device pairing:
@@ -86,7 +85,6 @@
base::WeakPtrFactory<PairingAuthenticatorBase> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/pairing_client_authenticator.cc b/remoting/protocol/pairing_client_authenticator.cc
index bd6874e..aff300c8 100644
--- a/remoting/protocol/pairing_client_authenticator.cc
+++ b/remoting/protocol/pairing_client_authenticator.cc
@@ -11,8 +11,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
PairingClientAuthenticator::PairingClientAuthenticator(
const ClientAuthenticationConfig& client_auth_config,
@@ -74,5 +73,4 @@
std::move(resume_callback).Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_client_authenticator.h b/remoting/protocol/pairing_client_authenticator.h
index 31ae776c..dbfa62c 100644
--- a/remoting/protocol/pairing_client_authenticator.h
+++ b/remoting/protocol/pairing_client_authenticator.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/client_authentication_config.h"
#include "remoting/protocol/pairing_authenticator_base.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class PairingClientAuthenticator : public PairingAuthenticatorBase {
public:
@@ -58,7 +57,6 @@
base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/pairing_host_authenticator.cc b/remoting/protocol/pairing_host_authenticator.cc
index 788d401..4a68046 100644
--- a/remoting/protocol/pairing_host_authenticator.cc
+++ b/remoting/protocol/pairing_host_authenticator.cc
@@ -12,8 +12,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
PairingHostAuthenticator::PairingHostAuthenticator(
scoped_refptr<PairingRegistry> pairing_registry,
@@ -96,5 +95,4 @@
std::move(resume_callback).Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_host_authenticator.h b/remoting/protocol/pairing_host_authenticator.h
index 26e789bb..3df87db 100644
--- a/remoting/protocol/pairing_host_authenticator.h
+++ b/remoting/protocol/pairing_host_authenticator.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/pairing_authenticator_base.h"
#include "remoting/protocol/pairing_registry.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class PairingRegistry;
@@ -58,7 +57,6 @@
base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
diff --git a/remoting/protocol/pairing_registry.cc b/remoting/protocol/pairing_registry.cc
index c64ef763..bac1729 100644
--- a/remoting/protocol/pairing_registry.cc
+++ b/remoting/protocol/pairing_registry.cc
@@ -20,8 +20,7 @@
#include "base/values.h"
#include "crypto/random.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// How many bytes of random data to use for the shared secret.
const int kKeySize = 16;
@@ -293,5 +292,4 @@
std::move(pending_requests_.front()));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pairing_registry.h b/remoting/protocol/pairing_registry.h
index 21991d3c..2d84fca 100644
--- a/remoting/protocol/pairing_registry.h
+++ b/remoting/protocol/pairing_registry.h
@@ -22,8 +22,7 @@
class SingleThreadTaskRunner;
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// PairingRegistry holds information about paired clients to support
// PIN-less authentication. For each paired client, the registry holds
@@ -185,7 +184,6 @@
base::queue<base::OnceClosure> pending_requests_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc
index 4c11d65..9b91a48 100644
--- a/remoting/protocol/pairing_registry_unittest.cc
+++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -56,8 +56,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class PairingRegistryTest : public testing::Test {
public:
@@ -250,5 +249,4 @@
run_loop_.Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/peer_connection_controls.h b/remoting/protocol/peer_connection_controls.h
index 2d2198a5..a71a3d02 100644
--- a/remoting/protocol/peer_connection_controls.h
+++ b/remoting/protocol/peer_connection_controls.h
@@ -7,8 +7,7 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Interface for changing peer connection parameters after the connection is
// established.
@@ -33,7 +32,6 @@
virtual void RequestSdpRestart() = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PEER_CONNECTION_CONTROLS_H_
diff --git a/remoting/protocol/performance_tracker.cc b/remoting/protocol/performance_tracker.cc
index c5ac5740..177f46a 100644
--- a/remoting/protocol/performance_tracker.cc
+++ b/remoting/protocol/performance_tracker.cc
@@ -18,8 +18,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
PerformanceTracker::PerformanceTracker()
: video_bandwidth_(base::Seconds(kStatsUpdatePeriodSeconds)),
@@ -80,5 +79,4 @@
round_trip_ms_.Record(round_trip_latency.InMilliseconds());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/performance_tracker.h b/remoting/protocol/performance_tracker.h
index 428a8260..71623b1a 100644
--- a/remoting/protocol/performance_tracker.h
+++ b/remoting/protocol/performance_tracker.h
@@ -11,8 +11,7 @@
#include "remoting/base/running_samples.h"
#include "remoting/protocol/frame_stats.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// PerformanceTracker defines a bundle of performance counters and statistics
// for chromoting.
@@ -63,7 +62,6 @@
RunningSamples round_trip_ms_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
diff --git a/remoting/protocol/port_allocator.cc b/remoting/protocol/port_allocator.cc
index 8f20923..56238ee 100644
--- a/remoting/protocol/port_allocator.cc
+++ b/remoting/protocol/port_allocator.cc
@@ -13,8 +13,7 @@
#include "remoting/protocol/transport_context.h"
#include "third_party/abseil-cpp/absl/strings/string_view.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
PortAllocator::PortAllocator(
std::unique_ptr<rtc::NetworkManager> network_manager,
@@ -105,5 +104,4 @@
return config;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/port_allocator.h b/remoting/protocol/port_allocator.h
index 3b0a659..45329091 100644
--- a/remoting/protocol/port_allocator.h
+++ b/remoting/protocol/port_allocator.h
@@ -14,8 +14,7 @@
#include "third_party/abseil-cpp/absl/strings/string_view.h"
#include "third_party/webrtc/p2p/client/basic_port_allocator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class PortAllocator : public cricket::BasicPortAllocator {
public:
@@ -71,7 +70,6 @@
base::WeakPtrFactory<PortAllocatorSession> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PORT_ALLOCATOR_H_
diff --git a/remoting/protocol/port_allocator_factory.h b/remoting/protocol/port_allocator_factory.h
index 4ac6e2c..a0412e15 100644
--- a/remoting/protocol/port_allocator_factory.h
+++ b/remoting/protocol/port_allocator_factory.h
@@ -14,8 +14,7 @@
class PortAllocator;
} // namespace cricket
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class SessionOptionsProvider;
class TransportContext;
@@ -31,7 +30,6 @@
base::WeakPtr<SessionOptionsProvider> session_options_provider) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PORT_ALLOCATOR_FACTORY_H_
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc
index 049295e..f9a3606 100644
--- a/remoting/protocol/protocol_mock_objects.cc
+++ b/remoting/protocol/protocol_mock_objects.cc
@@ -13,8 +13,7 @@
#include "remoting/protocol/video_stream.h"
#include "remoting/signaling/signaling_address.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
MockAuthenticator::MockAuthenticator() = default;
MockAuthenticator::~MockAuthenticator() = default;
@@ -100,5 +99,4 @@
std::move(task).Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 388a305..011117e8 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -34,9 +34,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-
-namespace protocol {
+namespace remoting::protocol {
class MockAuthenticator : public Authenticator {
public:
@@ -281,7 +279,6 @@
base::OnceClosure task) override;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
diff --git a/remoting/protocol/pseudotcp_adapter.cc b/remoting/protocol/pseudotcp_adapter.cc
index 437931c..acf6b87 100644
--- a/remoting/protocol/pseudotcp_adapter.cc
+++ b/remoting/protocol/pseudotcp_adapter.cc
@@ -27,8 +27,7 @@
const uint16_t kDefaultMtu = 1280;
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
public base::RefCounted<Core> {
@@ -503,5 +502,4 @@
core_->SetWriteWaitsForSend(write_waits_for_send);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_adapter.h b/remoting/protocol/pseudotcp_adapter.h
index ef044f0..545155ef 100644
--- a/remoting/protocol/pseudotcp_adapter.h
+++ b/remoting/protocol/pseudotcp_adapter.h
@@ -17,8 +17,7 @@
#include "remoting/protocol/p2p_stream_socket.h"
#include "third_party/webrtc/p2p/base/pseudo_tcp.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PDatagramSocket;
@@ -89,7 +88,6 @@
SEQUENCE_CHECKER(sequence_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PSEUDOTCP_ADAPTER_H_
diff --git a/remoting/protocol/pseudotcp_adapter_unittest.cc b/remoting/protocol/pseudotcp_adapter_unittest.cc
index b51d24c8..8d45504 100644
--- a/remoting/protocol/pseudotcp_adapter_unittest.cc
+++ b/remoting/protocol/pseudotcp_adapter_unittest.cc
@@ -30,8 +30,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -441,5 +440,4 @@
} // namespace
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_channel_factory.cc b/remoting/protocol/pseudotcp_channel_factory.cc
index 6d66690..137cbe2 100644
--- a/remoting/protocol/pseudotcp_channel_factory.cc
+++ b/remoting/protocol/pseudotcp_channel_factory.cc
@@ -13,13 +13,12 @@
#include "remoting/protocol/p2p_datagram_socket.h"
#include "remoting/protocol/pseudotcp_adapter.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
-// Value is chosen to balance the extra latency against the reduced
-// load due to ACK traffic.
+// Value is chosen to balance the extra latency against the reduced load due to
+// ACK traffic.
const int kTcpAckDelayMilliseconds = 10;
// Values for the TCP send and receive buffer size. This should be tuned to
@@ -95,5 +94,4 @@
std::move(callback).Run(std::move(socket));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/pseudotcp_channel_factory.h b/remoting/protocol/pseudotcp_channel_factory.h
index b046c75..2818141 100644
--- a/remoting/protocol/pseudotcp_channel_factory.h
+++ b/remoting/protocol/pseudotcp_channel_factory.h
@@ -10,8 +10,7 @@
#include "base/memory/raw_ptr.h"
#include "remoting/protocol/stream_channel_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class DatagramChannelFactory;
class P2PDatagramSocket;
@@ -49,7 +48,6 @@
PendingSocketsMap pending_sockets_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/rejecting_authenticator.cc b/remoting/protocol/rejecting_authenticator.cc
index 98637b50..ad4b695 100644
--- a/remoting/protocol/rejecting_authenticator.cc
+++ b/remoting/protocol/rejecting_authenticator.cc
@@ -10,8 +10,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
RejectingAuthenticator::RejectingAuthenticator(RejectionReason rejection_reason)
: rejection_reason_(rejection_reason) {
@@ -56,5 +55,4 @@
return nullptr;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/rejecting_authenticator.h b/remoting/protocol/rejecting_authenticator.h
index 17c2f21..1989b7b 100644
--- a/remoting/protocol/rejecting_authenticator.h
+++ b/remoting/protocol/rejecting_authenticator.h
@@ -9,8 +9,7 @@
#include "remoting/protocol/authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Authenticator that accepts one message and rejects connection after that.
class RejectingAuthenticator : public Authenticator {
@@ -39,7 +38,6 @@
std::string auth_key_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_H_
diff --git a/remoting/protocol/remoting_ice_config_request.cc b/remoting/protocol/remoting_ice_config_request.cc
index 28e14d5..23394b956 100644
--- a/remoting/protocol/remoting_ice_config_request.cc
+++ b/remoting/protocol/remoting_ice_config_request.cc
@@ -19,8 +19,7 @@
#include "remoting/protocol/ice_config.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -109,5 +108,4 @@
std::move(on_ice_config_callback_).Run(IceConfig::Parse(*response));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/remoting_ice_config_request_unittest.cc b/remoting/protocol/remoting_ice_config_request_unittest.cc
index 1844acd..40e22af5 100644
--- a/remoting/protocol/remoting_ice_config_request_unittest.cc
+++ b/remoting/protocol/remoting_ice_config_request_unittest.cc
@@ -14,8 +14,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -88,5 +87,4 @@
EXPECT_TRUE(received_config.is_null());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/sdp_message.cc b/remoting/protocol/sdp_message.cc
index 8e0b334..c6bf667 100644
--- a/remoting/protocol/sdp_message.cc
+++ b/remoting/protocol/sdp_message.cc
@@ -12,8 +12,7 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
SdpMessage::SdpMessage(const std::string& sdp) {
sdp_lines_ = base::SplitString(
@@ -124,5 +123,4 @@
return results;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/sdp_message.h b/remoting/protocol/sdp_message.h
index f2f7fa80..e074120e 100644
--- a/remoting/protocol/sdp_message.h
+++ b/remoting/protocol/sdp_message.h
@@ -9,8 +9,7 @@
#include <string>
#include <vector>
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// SdpMessage is used to process session descriptions messages in SDP format
// generated by WebRTC (see RFC 4566). In particularly it allows configuring
@@ -60,7 +59,6 @@
bool has_video_ = false;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_SDP_MESSAGE_H_
diff --git a/remoting/protocol/sdp_message_unittest.cc b/remoting/protocol/sdp_message_unittest.cc
index 96d8082d..a6176eb7 100644
--- a/remoting/protocol/sdp_message_unittest.cc
+++ b/remoting/protocol/sdp_message_unittest.cc
@@ -6,8 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Verify that SDP is normalized by removing empty lines and normalizing
// line-endings to \r\n.
@@ -255,5 +254,4 @@
sdp_message.ToString());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/secure_channel_factory.cc b/remoting/protocol/secure_channel_factory.cc
index ec747ff..39fd05b 100644
--- a/remoting/protocol/secure_channel_factory.cc
+++ b/remoting/protocol/secure_channel_factory.cc
@@ -11,8 +11,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "remoting/protocol/p2p_stream_socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
SecureChannelFactory::SecureChannelFactory(
StreamChannelFactory* channel_factory,
@@ -79,5 +78,4 @@
std::move(callback).Run(std::move(socket));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/secure_channel_factory.h b/remoting/protocol/secure_channel_factory.h
index 8a4c76c..d6bb145 100644
--- a/remoting/protocol/secure_channel_factory.h
+++ b/remoting/protocol/secure_channel_factory.h
@@ -11,8 +11,7 @@
#include "net/base/net_errors.h"
#include "remoting/protocol/stream_channel_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class Authenticator;
class ChannelAuthenticator;
@@ -56,7 +55,6 @@
AuthenticatorMap channel_authenticators_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_SECURE_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h
index 9fa0bd5..4a5dcdd 100644
--- a/remoting/protocol/session.h
+++ b/remoting/protocol/session.h
@@ -12,8 +12,7 @@
#include "remoting/protocol/session_config.h"
#include "remoting/protocol/transport.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class SessionPlugin;
class Transport;
@@ -51,8 +50,8 @@
class EventHandler {
public:
- EventHandler() {}
- virtual ~EventHandler() {}
+ EventHandler() = default;
+ virtual ~EventHandler() = default;
// Called after session state has changed. It is safe to destroy
// the session from within the handler if |state| is AUTHENTICATING
@@ -60,12 +59,12 @@
virtual void OnSessionStateChange(State state) = 0;
};
- Session() {}
+ Session() = default;
Session(const Session&) = delete;
Session& operator=(const Session&) = delete;
- virtual ~Session() {}
+ virtual ~Session() = default;
// Set event handler for this session. |event_handler| must outlive
// this object.
@@ -97,7 +96,6 @@
virtual void AddPlugin(SessionPlugin* plugin) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_SESSION_H_
diff --git a/remoting/protocol/session_config.cc b/remoting/protocol/session_config.cc
index d78827e..d83c5d8 100644
--- a/remoting/protocol/session_config.cc
+++ b/remoting/protocol/session_config.cc
@@ -12,8 +12,7 @@
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -307,5 +306,4 @@
UpdateConfigListToPreferTransport(&audio_configs_, transport);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/session_config.h b/remoting/protocol/session_config.h
index 75e10d7..fa2d03d 100644
--- a/remoting/protocol/session_config.h
+++ b/remoting/protocol/session_config.h
@@ -9,9 +9,7 @@
#include <memory>
#include <string>
-
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
extern const int kDefaultStreamVersion;
@@ -193,7 +191,6 @@
std::list<ChannelConfig> audio_configs_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
diff --git a/remoting/protocol/session_config_unittest.cc b/remoting/protocol/session_config_unittest.cc
index 0835482..474aaa06 100644
--- a/remoting/protocol/session_config_unittest.cc
+++ b/remoting/protocol/session_config_unittest.cc
@@ -6,8 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
void TestGetFinalConfig(std::unique_ptr<SessionConfig> config) {
std::unique_ptr<CandidateSessionConfig> candidate_config =
@@ -107,5 +106,4 @@
EXPECT_TRUE(hybrid_candidate_config->IsSupported(*webrtc_config));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/session_plugin.h b/remoting/protocol/session_plugin.h
index 99d79131..6227492b 100644
--- a/remoting/protocol/session_plugin.h
+++ b/remoting/protocol/session_plugin.h
@@ -9,8 +9,7 @@
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Interface for Session plugins. Plugins allow to send and receive optional
// information that is not essential for session handshake. Messages generated
@@ -30,7 +29,6 @@
virtual void OnIncomingMessage(const jingle_xmpp::XmlElement& attachments) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_
diff --git a/remoting/protocol/spake2_authenticator.cc b/remoting/protocol/spake2_authenticator.cc
index 332cccd..4f41996 100644
--- a/remoting/protocol/spake2_authenticator.cc
+++ b/remoting/protocol/spake2_authenticator.cc
@@ -18,8 +18,7 @@
#include "third_party/boringssl/src/include/openssl/curve25519.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -314,5 +313,4 @@
return result;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/spake2_authenticator_unittest.cc b/remoting/protocol/spake2_authenticator_unittest.cc
index 25cef15..afb1201 100644
--- a/remoting/protocol/spake2_authenticator_unittest.cc
+++ b/remoting/protocol/spake2_authenticator_unittest.cc
@@ -19,8 +19,7 @@
using testing::DeleteArg;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -99,5 +98,4 @@
ASSERT_EQ(Authenticator::REJECTED, host_->state());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc
index a34c0a8..3a7e44e 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator.cc
+++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -37,8 +37,7 @@
#include "remoting/protocol/auth_util.h"
#include "remoting/protocol/p2p_stream_socket.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -463,5 +462,4 @@
std::move(done_callback_).Run(error, nullptr);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
index 8c72e35f..0c3d9ab 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
+++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
@@ -32,8 +32,7 @@
using testing::NotNull;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -213,5 +212,4 @@
ASSERT_TRUE(host_socket_.get() == nullptr);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_channel_factory.h b/remoting/protocol/stream_channel_factory.h
index 232a9ebf..63fb14cc 100644
--- a/remoting/protocol/stream_channel_factory.h
+++ b/remoting/protocol/stream_channel_factory.h
@@ -11,8 +11,7 @@
#include "base/callback.h"
#include "base/sequence_checker.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class P2PStreamSocket;
@@ -23,7 +22,7 @@
typedef base::OnceCallback<void(std::unique_ptr<P2PStreamSocket>)>
ChannelCreatedCallback;
- StreamChannelFactory() {}
+ StreamChannelFactory() = default;
StreamChannelFactory(const StreamChannelFactory&) = delete;
StreamChannelFactory& operator=(const StreamChannelFactory&) = delete;
@@ -42,12 +41,11 @@
virtual void CancelChannelCreation(const std::string& name) = 0;
protected:
- virtual ~StreamChannelFactory() {}
+ virtual ~StreamChannelFactory() = default;
SEQUENCE_CHECKER(sequence_checker_);
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_STREAM_CHANNEL_FACTORY_H_
diff --git a/remoting/protocol/stream_message_pipe_adapter.cc b/remoting/protocol/stream_message_pipe_adapter.cc
index a8713de..74e96cba 100644
--- a/remoting/protocol/stream_message_pipe_adapter.cc
+++ b/remoting/protocol/stream_message_pipe_adapter.cc
@@ -16,8 +16,7 @@
#include "remoting/protocol/p2p_stream_socket.h"
#include "remoting/protocol/stream_channel_factory.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
StreamMessagePipeAdapter::StreamMessagePipeAdapter(
std::unique_ptr<P2PStreamSocket> socket,
@@ -127,5 +126,4 @@
std::move(socket), error_callback_));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_packet_processor.h b/remoting/protocol/stream_packet_processor.h
index 56cb1ff..a8c5fab 100644
--- a/remoting/protocol/stream_packet_processor.h
+++ b/remoting/protocol/stream_packet_processor.h
@@ -17,8 +17,7 @@
struct PacketTimeUpdateParams;
} // namespace rtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Helper class to process packets from and to the StreamPacketSocket.
class StreamPacketProcessor {
@@ -46,7 +45,6 @@
const rtc::PacketTimeUpdateParams& packet_time_params) const = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_STREAM_PACKET_PROCESSOR_H_
diff --git a/remoting/protocol/stream_packet_socket.cc b/remoting/protocol/stream_packet_socket.cc
index 64fa6c7..d184778 100644
--- a/remoting/protocol/stream_packet_socket.cc
+++ b/remoting/protocol/stream_packet_socket.cc
@@ -14,8 +14,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/protocol/stun_tcp_packet_processor.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -445,5 +444,4 @@
SignalClose(this, error_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/stream_packet_socket.h b/remoting/protocol/stream_packet_socket.h
index 528d1a9..1fcca7e3 100644
--- a/remoting/protocol/stream_packet_socket.h
+++ b/remoting/protocol/stream_packet_socket.h
@@ -21,8 +21,7 @@
} // namespace net
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class StreamPacketProcessor;
@@ -117,7 +116,6 @@
int error_ = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_STREAM_PACKET_SOCKET_H_
diff --git a/remoting/protocol/stun_tcp_packet_processor.cc b/remoting/protocol/stun_tcp_packet_processor.cc
index 340fff8c..c4b91942 100644
--- a/remoting/protocol/stun_tcp_packet_processor.cc
+++ b/remoting/protocol/stun_tcp_packet_processor.cc
@@ -11,8 +11,7 @@
#include "third_party/webrtc/media/base/rtp_utils.h"
#include "third_party/webrtc/rtc_base/time_utils.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -122,5 +121,4 @@
rtc::TimeMicros());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/stun_tcp_packet_processor.h b/remoting/protocol/stun_tcp_packet_processor.h
index 159ddcaa..cc5c773 100644
--- a/remoting/protocol/stun_tcp_packet_processor.h
+++ b/remoting/protocol/stun_tcp_packet_processor.h
@@ -10,8 +10,7 @@
#include "base/memory/scoped_refptr.h"
#include "remoting/protocol/stream_packet_processor.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// StreamPacketSocket implementation for data that has already been packed in
// STUN/TURN's TCP packet. It won't add any extra header to the data but will
@@ -40,7 +39,6 @@
const rtc::PacketTimeUpdateParams& packet_time_params) const override;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_STUN_TCP_PACKET_PROCESSOR_H_
diff --git a/remoting/protocol/test_event_matchers.h b/remoting/protocol/test_event_matchers.h
index 2961a67a..cf9586f 100644
--- a/remoting/protocol/test_event_matchers.h
+++ b/remoting/protocol/test_event_matchers.h
@@ -13,9 +13,7 @@
#include "testing/gmock/include/gmock/gmock.h"
// This file contains matchers for protocol events.
-namespace remoting {
-namespace protocol {
-namespace test {
+namespace remoting::protocol::test {
MATCHER_P2(EqualsKeyEvent, usb_keycode, pressed, "") {
return arg.usb_keycode() == static_cast<uint32_t>(usb_keycode) &&
@@ -135,8 +133,6 @@
return arg.touch_points(0).id() == id;
}
-} // namespace test
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol::test
#endif // REMOTING_PROTOCOL_TEST_EVENT_MATCHERS_H_
diff --git a/remoting/protocol/third_party_authenticator_base.cc b/remoting/protocol/third_party_authenticator_base.cc
index 451b1fc4..1029d578 100644
--- a/remoting/protocol/third_party_authenticator_base.cc
+++ b/remoting/protocol/third_party_authenticator_base.cc
@@ -13,8 +13,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// static
const jingle_xmpp::StaticQName ThirdPartyAuthenticatorBase::kTokenUrlTag =
@@ -97,5 +96,4 @@
return underlying_->CreateChannelAuthenticator();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_authenticator_base.h b/remoting/protocol/third_party_authenticator_base.h
index 71e4937c..7e3803e 100644
--- a/remoting/protocol/third_party_authenticator_base.h
+++ b/remoting/protocol/third_party_authenticator_base.h
@@ -18,8 +18,7 @@
} // namespace jingle_xmpp
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Implements an authentication method that relies on a third party server for
// authentication of both client and host.
@@ -74,7 +73,6 @@
RejectionReason rejection_reason_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_
diff --git a/remoting/protocol/third_party_authenticator_unittest.cc b/remoting/protocol/third_party_authenticator_unittest.cc
index ac36078d..c9ca3d5c 100644
--- a/remoting/protocol/third_party_authenticator_unittest.cc
+++ b/remoting/protocol/third_party_authenticator_unittest.cc
@@ -41,8 +41,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ThirdPartyAuthenticatorTest : public AuthenticatorTestBase {
class FakeTokenFetcher {
@@ -223,5 +222,4 @@
ASSERT_EQ(Authenticator::REJECTED, client_->state());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_client_authenticator.cc b/remoting/protocol/third_party_client_authenticator.cc
index e1732e0..f8528cf 100644
--- a/remoting/protocol/third_party_client_authenticator.cc
+++ b/remoting/protocol/third_party_client_authenticator.cc
@@ -15,8 +15,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ThirdPartyClientAuthenticator::ThirdPartyClientAuthenticator(
const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
@@ -82,5 +81,4 @@
std::move(resume_callback).Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_client_authenticator.h b/remoting/protocol/third_party_client_authenticator.h
index 55753500..86975c3 100644
--- a/remoting/protocol/third_party_client_authenticator.h
+++ b/remoting/protocol/third_party_client_authenticator.h
@@ -14,8 +14,7 @@
#include "remoting/protocol/third_party_authenticator_base.h"
#include "remoting/protocol/token_validator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Implements the client side of the third party authentication mechanism.
// The client authenticator expects a |token_url| and |scope| in the first
@@ -59,8 +58,6 @@
base::WeakPtrFactory<ThirdPartyClientAuthenticator> weak_factory_{this};
};
-
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_
diff --git a/remoting/protocol/third_party_host_authenticator.cc b/remoting/protocol/third_party_host_authenticator.cc
index 8bcdf11..32b9ef9 100644
--- a/remoting/protocol/third_party_host_authenticator.cc
+++ b/remoting/protocol/third_party_host_authenticator.cc
@@ -14,8 +14,7 @@
#include "remoting/protocol/token_validator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ThirdPartyHostAuthenticator::ThirdPartyHostAuthenticator(
const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
@@ -89,5 +88,4 @@
underlying_->ProcessMessage(message, std::move(resume_callback));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/third_party_host_authenticator.h b/remoting/protocol/third_party_host_authenticator.h
index 8486bc0..c7be6d43 100644
--- a/remoting/protocol/third_party_host_authenticator.h
+++ b/remoting/protocol/third_party_host_authenticator.h
@@ -12,8 +12,7 @@
#include "remoting/protocol/third_party_authenticator_base.h"
#include "remoting/protocol/token_validator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Implements the host side of the third party authentication mechanism.
// The host authenticator sends the |token_url| and |scope| obtained from the
@@ -54,7 +53,6 @@
std::unique_ptr<TokenValidator> token_validator_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
diff --git a/remoting/protocol/token_validator.h b/remoting/protocol/token_validator.h
index fe79b73c..cf1bb48 100644
--- a/remoting/protocol/token_validator.h
+++ b/remoting/protocol/token_validator.h
@@ -14,9 +14,7 @@
#include "remoting/protocol/authenticator.h"
#include "url/gurl.h"
-namespace remoting {
-
-namespace protocol {
+namespace remoting::protocol {
// The |TokenValidator| encapsulates the parameters to be sent to the client
// to obtain a token, and the method to validate that token and obtain the
@@ -64,10 +62,9 @@
protected:
friend class base::RefCountedThreadSafe<TokenValidatorFactory>;
- virtual ~TokenValidatorFactory() {}
+ virtual ~TokenValidatorFactory() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_
diff --git a/remoting/protocol/transport.cc b/remoting/protocol/transport.cc
index b1328f3..0667fba 100644
--- a/remoting/protocol/transport.cc
+++ b/remoting/protocol/transport.cc
@@ -6,8 +6,7 @@
#include "base/notreached.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// static
std::string TransportRoute::GetTypeString(RouteType type) {
@@ -26,5 +25,4 @@
TransportRoute::TransportRoute() : type(DIRECT) {}
TransportRoute::~TransportRoute() = default;
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/transport.h b/remoting/protocol/transport.h
index baae9f7..546d9f92 100644
--- a/remoting/protocol/transport.h
+++ b/remoting/protocol/transport.h
@@ -16,8 +16,7 @@
class XmlElement;
} // namespace jingle_xmpp
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class Authenticator;
@@ -64,7 +63,6 @@
virtual bool ProcessTransportInfo(jingle_xmpp::XmlElement* transport_info) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_TRANSPORT_H_
diff --git a/remoting/protocol/transport_context.cc b/remoting/protocol/transport_context.cc
index 098f272..b59363a 100644
--- a/remoting/protocol/transport_context.cc
+++ b/remoting/protocol/transport_context.cc
@@ -22,8 +22,7 @@
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/webrtc/rtc_base/socket_address.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -160,5 +159,4 @@
return ice_config_.max_bitrate_kbps;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc
index 2a175d4..20fd580 100644
--- a/remoting/protocol/v2_authenticator.cc
+++ b/remoting/protocol/v2_authenticator.cc
@@ -16,8 +16,7 @@
using crypto::P224EncryptedKeyExchange;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -205,5 +204,4 @@
return local_key_pair_.get() != nullptr;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/v2_authenticator_unittest.cc b/remoting/protocol/v2_authenticator_unittest.cc
index df01e30..36a8d16 100644
--- a/remoting/protocol/v2_authenticator_unittest.cc
+++ b/remoting/protocol/v2_authenticator_unittest.cc
@@ -20,8 +20,7 @@
using testing::DeleteArg;
using testing::SaveArg;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -95,5 +94,4 @@
ASSERT_EQ(Authenticator::REJECTED, host_->state());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/validating_authenticator.cc b/remoting/protocol/validating_authenticator.cc
index 2b1a244..c9a6168 100644
--- a/remoting/protocol/validating_authenticator.cc
+++ b/remoting/protocol/validating_authenticator.cc
@@ -17,8 +17,7 @@
#include "remoting/protocol/channel_authenticator.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
ValidatingAuthenticator::ValidatingAuthenticator(
const std::string& remote_jid,
@@ -142,5 +141,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/validating_authenticator.h b/remoting/protocol/validating_authenticator.h
index e5a046f7..24f44a5 100644
--- a/remoting/protocol/validating_authenticator.h
+++ b/remoting/protocol/validating_authenticator.h
@@ -13,8 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "remoting/protocol/authenticator.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// This authenticator class provides a way to check the validity of a connection
// as it is being established through an asynchronous callback. The validation
@@ -85,7 +84,6 @@
base::WeakPtrFactory<ValidatingAuthenticator> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_
diff --git a/remoting/protocol/validating_authenticator_unittest.cc b/remoting/protocol/validating_authenticator_unittest.cc
index afc5879..f44ba22 100644
--- a/remoting/protocol/validating_authenticator_unittest.cc
+++ b/remoting/protocol/validating_authenticator_unittest.cc
@@ -20,8 +20,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -333,5 +332,4 @@
validating_authenticator_->rejection_reason());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/video_channel_state_observer.h b/remoting/protocol/video_channel_state_observer.h
index d0714b2..0f5809d 100644
--- a/remoting/protocol/video_channel_state_observer.h
+++ b/remoting/protocol/video_channel_state_observer.h
@@ -8,8 +8,7 @@
#include "remoting/codec/webrtc_video_encoder.h"
#include "third_party/webrtc/api/video_codecs/video_encoder.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class VideoChannelStateObserver {
public:
@@ -35,7 +34,6 @@
virtual ~VideoChannelStateObserver() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_VIDEO_CHANNEL_STATE_OBSERVER_H_
diff --git a/remoting/protocol/video_feedback_stub.h b/remoting/protocol/video_feedback_stub.h
index 417e5341..2f0ca41 100644
--- a/remoting/protocol/video_feedback_stub.h
+++ b/remoting/protocol/video_feedback_stub.h
@@ -21,8 +21,8 @@
virtual void ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) = 0;
protected:
- VideoFeedbackStub() {}
- virtual ~VideoFeedbackStub() {}
+ VideoFeedbackStub() = default;
+ virtual ~VideoFeedbackStub() = default;
};
} // namespace protocol
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index ea1544b..5162b24 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -20,8 +20,7 @@
#include "remoting/protocol/video_stub.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Interval between empty keep-alive frames. These frames are sent only when the
// stream is paused or inactive for some other reason (e.g. when blocked on
@@ -63,25 +62,25 @@
}
VideoFramePump::~VideoFramePump() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release());
}
void VideoFramePump::SetEventTimestampsSource(
scoped_refptr<InputEventTimestampsSource> event_timestamps_source) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_timestamps_source_ = event_timestamps_source;
}
void VideoFramePump::Pause(bool pause) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
capture_scheduler_.Pause(pause);
}
void VideoFramePump::SetLosslessEncode(bool want_lossless) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
encode_task_runner_->PostTask(
FROM_HERE,
@@ -90,7 +89,7 @@
}
void VideoFramePump::SetLosslessColor(bool want_lossless) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
encode_task_runner_->PostTask(
FROM_HERE,
@@ -99,7 +98,7 @@
}
void VideoFramePump::SetObserver(Observer* observer) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
observer_ = observer;
}
@@ -108,7 +107,7 @@
void VideoFramePump::OnCaptureResult(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
capture_scheduler_.OnCaptureCompleted();
@@ -138,7 +137,7 @@
}
void VideoFramePump::CaptureNextFrame() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
captured_frame_timestamps_ = std::make_unique<FrameTimestamps>();
captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now();
@@ -182,7 +181,7 @@
void VideoFramePump::OnFrameEncoded(
std::unique_ptr<PacketWithTimestamps> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
capture_scheduler_.OnFrameEncoded(packet->packet.get());
@@ -194,7 +193,7 @@
}
void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!send_pending_);
packet->timestamps->can_send_time = base::TimeTicks::Now();
@@ -233,7 +232,7 @@
}
void VideoFramePump::OnVideoPacketSent() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
send_pending_ = false;
capture_scheduler_.OnFrameSent();
@@ -249,7 +248,7 @@
}
void VideoFramePump::SendKeepAlivePacket() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
video_stub_->ProcessVideoPacket(
std::make_unique<VideoPacket>(),
@@ -258,10 +257,9 @@
}
void VideoFramePump::OnKeepAlivePacketSent() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
keep_alive_timer_.Reset();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/video_frame_pump.h b/remoting/protocol/video_frame_pump.h
index 9c4dfe2..5837a6f6 100644
--- a/remoting/protocol/video_frame_pump.h
+++ b/remoting/protocol/video_frame_pump.h
@@ -25,8 +25,7 @@
class SingleThreadTaskRunner;
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class VideoFeedbackStub;
class VideoStub;
@@ -186,12 +185,11 @@
std::vector<std::unique_ptr<PacketWithTimestamps>> pending_packets_;
- base::ThreadChecker thread_checker_;
+ THREAD_CHECKER(thread_checker_);
base::WeakPtrFactory<VideoFramePump> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_
diff --git a/remoting/protocol/video_frame_pump_unittest.cc b/remoting/protocol/video_frame_pump_unittest.cc
index 7216605..60e2e04 100644
--- a/remoting/protocol/video_frame_pump_unittest.cc
+++ b/remoting/protocol/video_frame_pump_unittest.cc
@@ -32,8 +32,7 @@
using ::testing::InvokeWithoutArgs;
using ::testing::Return;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -261,5 +260,4 @@
run_loop.Run();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/video_renderer.h b/remoting/protocol/video_renderer.h
index c8bf148..0eec6ad 100644
--- a/remoting/protocol/video_renderer.h
+++ b/remoting/protocol/video_renderer.h
@@ -26,7 +26,7 @@
// TODO(sergeyu): Reconsider this design.
class VideoRenderer {
public:
- virtual ~VideoRenderer() {}
+ virtual ~VideoRenderer() = default;
// Initializes the video renderer. This allows the renderer to be initialized
// after it is constructed. Returns true if initialization succeeds and false
diff --git a/remoting/protocol/video_stats_stub.h b/remoting/protocol/video_stats_stub.h
index 3607820f..dbe9076 100644
--- a/remoting/protocol/video_stats_stub.h
+++ b/remoting/protocol/video_stats_stub.h
@@ -7,8 +7,7 @@
#include <cstdint>
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
struct HostFrameStats;
@@ -22,11 +21,10 @@
const HostFrameStats& frame_stats) = 0;
protected:
- VideoStatsStub() {}
- virtual ~VideoStatsStub() {}
+ VideoStatsStub() = default;
+ virtual ~VideoStatsStub() = default;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_VIDEO_STATS_STUB_H_
diff --git a/remoting/protocol/video_stream.h b/remoting/protocol/video_stream.h
index a524f5b..e60ede1 100644
--- a/remoting/protocol/video_stream.h
+++ b/remoting/protocol/video_stream.h
@@ -13,8 +13,7 @@
class DesktopVector;
} // namespace webrtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class VideoStream {
public:
@@ -27,8 +26,8 @@
const webrtc::DesktopVector& dpi) = 0;
};
- VideoStream() {}
- virtual ~VideoStream() {}
+ VideoStream() = default;
+ virtual ~VideoStream() = default;
// Sets event timestamps source to be used for the video stream.
virtual void SetEventTimestampsSource(
@@ -50,7 +49,6 @@
virtual void SelectSource(webrtc::ScreenId id) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_VIDEO_STREAM_H_
diff --git a/remoting/protocol/video_stub.h b/remoting/protocol/video_stub.h
index 4c1c1f7..ab2f96f 100644
--- a/remoting/protocol/video_stub.h
+++ b/remoting/protocol/video_stub.h
@@ -24,8 +24,8 @@
base::OnceClosure done) = 0;
protected:
- VideoStub() {}
- virtual ~VideoStub() {}
+ VideoStub() = default;
+ virtual ~VideoStub() = default;
};
} // namespace protocol
diff --git a/remoting/protocol/webrtc_audio_module.cc b/remoting/protocol/webrtc_audio_module.cc
index d4d0c17..85e044d 100644
--- a/remoting/protocol/webrtc_audio_module.cc
+++ b/remoting/protocol/webrtc_audio_module.cc
@@ -11,8 +11,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/timer.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -379,5 +378,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_module.h b/remoting/protocol/webrtc_audio_module.h
index bafb27bb..32d76b0 100644
--- a/remoting/protocol/webrtc_audio_module.h
+++ b/remoting/protocol/webrtc_audio_module.h
@@ -15,8 +15,7 @@
class SingleThreadTaskRunner;
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Audio module passed to WebRTC. It doesn't access actual audio devices, but it
// provides all functionality we need to ensure that audio streaming works
@@ -124,7 +123,6 @@
std::unique_ptr<base::RepeatingTimer> poll_timer_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_
diff --git a/remoting/protocol/webrtc_audio_sink_adapter.cc b/remoting/protocol/webrtc_audio_sink_adapter.cc
index 8de8b91..7a5363c 100644
--- a/remoting/protocol/webrtc_audio_sink_adapter.cc
+++ b/remoting/protocol/webrtc_audio_sink_adapter.cc
@@ -11,8 +11,7 @@
#include "remoting/proto/audio.pb.h"
#include "remoting/protocol/audio_stub.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcAudioSinkAdapter::WebrtcAudioSinkAdapter(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream,
@@ -76,5 +75,4 @@
std::move(audio_packet), base::OnceClosure()));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_sink_adapter.h b/remoting/protocol/webrtc_audio_sink_adapter.h
index 09d9f59..01ae666 100644
--- a/remoting/protocol/webrtc_audio_sink_adapter.h
+++ b/remoting/protocol/webrtc_audio_sink_adapter.h
@@ -14,8 +14,7 @@
class SingleThreadTaskRunner;
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioStub;
@@ -39,7 +38,6 @@
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_SINK_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_audio_source_adapter.cc b/remoting/protocol/webrtc_audio_source_adapter.cc
index 30344c8..692fe2e 100644
--- a/remoting/protocol/webrtc_audio_source_adapter.cc
+++ b/remoting/protocol/webrtc_audio_source_adapter.cc
@@ -15,8 +15,7 @@
#include "remoting/proto/audio.pb.h"
#include "remoting/protocol/audio_source.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
static const int kChannels = 2;
static const int kBytesPerSample = 2;
@@ -53,27 +52,27 @@
base::ObserverList<webrtc::AudioTrackSinkInterface>::Unchecked audio_sinks_;
base::Lock audio_sinks_lock_;
- base::ThreadChecker thread_checker_;
+ THREAD_CHECKER(thread_checker_);
};
WebrtcAudioSourceAdapter::Core::Core() {
- thread_checker_.DetachFromThread();
+ DETACH_FROM_THREAD(thread_checker_);
}
WebrtcAudioSourceAdapter::Core::~Core() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void WebrtcAudioSourceAdapter::Core::Start(
std::unique_ptr<AudioSource> audio_source) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
audio_source_ = std::move(audio_source);
audio_source_->Start(
base::BindRepeating(&Core::OnAudioPacket, base::Unretained(this)));
}
void WebrtcAudioSourceAdapter::Core::Pause(bool pause) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
paused_ = pause;
}
@@ -93,7 +92,7 @@
void WebrtcAudioSourceAdapter::Core::OnAudioPacket(
std::unique_ptr<AudioPacket> packet) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (paused_)
return;
@@ -193,5 +192,4 @@
void WebrtcAudioSourceAdapter::UnregisterObserver(
webrtc::ObserverInterface* observer) {}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_source_adapter.h b/remoting/protocol/webrtc_audio_source_adapter.h
index bc97119..2f68e677 100644
--- a/remoting/protocol/webrtc_audio_source_adapter.h
+++ b/remoting/protocol/webrtc_audio_source_adapter.h
@@ -15,9 +15,7 @@
class AudioTrackSinkInterface;
} // namespace webrtc
-namespace remoting {
-
-namespace protocol {
+namespace remoting::protocol {
class AudioSource;
@@ -55,7 +53,6 @@
std::unique_ptr<Core> core_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_SOURCE_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc
index 78b0c92..34b2242 100644
--- a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc
+++ b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc
@@ -19,8 +19,7 @@
#include "third_party/webrtc/rtc_base/ref_count.h"
#include "third_party/webrtc/rtc_base/ref_counted_object.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -116,6 +115,4 @@
}
}
-
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_stream.cc b/remoting/protocol/webrtc_audio_stream.cc
index b28fb22f..1946271 100644
--- a/remoting/protocol/webrtc_audio_stream.cc
+++ b/remoting/protocol/webrtc_audio_stream.cc
@@ -15,8 +15,7 @@
#include "third_party/webrtc/api/peer_connection_interface.h"
#include "third_party/webrtc/rtc_base/ref_count.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
const char kAudioStreamLabel[] = "audio_stream";
const char kAudioTrackLabel[] = "system_audio";
@@ -57,5 +56,4 @@
source_adapter_->Pause(pause);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_audio_stream.h b/remoting/protocol/webrtc_audio_stream.h
index 7a9357c2..2691429 100644
--- a/remoting/protocol/webrtc_audio_stream.h
+++ b/remoting/protocol/webrtc_audio_stream.h
@@ -19,8 +19,7 @@
class PeerConnectionInterface;
} // namespace webrtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class AudioSource;
class WebrtcAudioSourceAdapter;
@@ -48,7 +47,6 @@
scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_STREAM_H_
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc
index 7aed5dac..2bf10a2 100644
--- a/remoting/protocol/webrtc_connection_to_client.cc
+++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -30,8 +30,7 @@
#include "third_party/webrtc/api/peer_connection_interface.h"
#include "third_party/webrtc/api/sctp_transport_interface.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -39,10 +38,10 @@
} // namespace
-// Currently the network thread is also used as worker thread for webrtc.
+// Currently the network thread is also used as the worker thread for webrtc.
//
-// TODO(sergeyu): Figure out if we would benefit from using a separate
-// thread as a worker thread.
+// TODO(sergeyu): Figure out if we would benefit from using a separate thread as
+// a worker thread.
WebrtcConnectionToClient::WebrtcConnectionToClient(
std::unique_ptr<protocol::Session> session,
scoped_refptr<protocol::TransportContext> transport_context,
@@ -62,22 +61,22 @@
}
WebrtcConnectionToClient::~WebrtcConnectionToClient() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void WebrtcConnectionToClient::SetEventHandler(
ConnectionToClient::EventHandler* event_handler) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_handler_ = event_handler;
}
protocol::Session* WebrtcConnectionToClient::session() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return session_.get();
}
void WebrtcConnectionToClient::Disconnect(ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// This should trigger OnConnectionClosed() event and this object
// may be destroyed as the result.
@@ -87,7 +86,7 @@
std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
const std::string& stream_name,
std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(transport_);
auto stream =
@@ -102,7 +101,7 @@
std::unique_ptr<AudioStream> WebrtcConnectionToClient::StartAudioStream(
std::unique_ptr<AudioSource> audio_source) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(transport_);
std::unique_ptr<WebrtcAudioStream> stream(new WebrtcAudioStream());
@@ -112,23 +111,23 @@
// Return pointer to ClientStub.
ClientStub* WebrtcConnectionToClient::client_stub() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return control_dispatcher_.get();
}
void WebrtcConnectionToClient::set_clipboard_stub(
protocol::ClipboardStub* clipboard_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
control_dispatcher_->set_clipboard_stub(clipboard_stub);
}
void WebrtcConnectionToClient::set_host_stub(protocol::HostStub* host_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
control_dispatcher_->set_host_stub(host_stub);
}
void WebrtcConnectionToClient::set_input_stub(protocol::InputStub* input_stub) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_dispatcher_->set_input_stub(input_stub);
}
@@ -149,7 +148,7 @@
}
void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(event_handler_);
switch (state) {
@@ -188,7 +187,7 @@
}
void WebrtcConnectionToClient::OnWebrtcTransportConnecting() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Create outgoing control channel. |event_dispatcher_| is initialized later
// because event channel is expected to be created by the client.
control_dispatcher_->Init(
@@ -203,7 +202,7 @@
}
void WebrtcConnectionToClient::OnWebrtcTransportConnected() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
auto sctp_transport = transport_->peer_connection()->GetSctpTransport();
if (sctp_transport) {
absl::optional<double> max_message_size =
@@ -215,12 +214,12 @@
}
void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Disconnect(error);
}
void WebrtcConnectionToClient::OnWebrtcTransportProtocolChanged() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// If not all channels are connected, this call will be deferred to
// OnChannelInitialized() when all channels are connected.
if (allChannelsConnected()) {
@@ -231,7 +230,7 @@
void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel(
const std::string& name,
std::unique_ptr<MessagePipe> pipe) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(event_handler_);
if (name == event_dispatcher_->channel_name() &&
@@ -245,18 +244,18 @@
void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
LOG(WARNING) << "The client created an unexpected media stream.";
}
void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamRemoved(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void WebrtcConnectionToClient::OnWebrtcTransportRouteChanged(
const TransportRoute& route) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(event_handler_);
// WebRTC route-change events are triggered at the transport level, so the
@@ -267,7 +266,7 @@
void WebrtcConnectionToClient::OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (allChannelsConnected()) {
event_handler_->OnConnectionChannelsConnected();
@@ -280,7 +279,7 @@
void WebrtcConnectionToClient::OnChannelClosed(
ChannelDispatcherBase* channel_dispatcher) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (channel_dispatcher == &video_stats_dispatcher_) {
LOG(WARNING) << "video_stats channel was closed.";
@@ -297,5 +296,4 @@
event_dispatcher_ && event_dispatcher_->is_connected();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h
index 3caabd9..fe65cfb 100644
--- a/remoting/protocol/webrtc_connection_to_client.h
+++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -20,8 +20,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/webrtc_transport.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class WebrtcVideoEncoderFactory;
class HostControlDispatcher;
@@ -84,8 +83,6 @@
private:
bool allChannelsConnected();
- base::ThreadChecker thread_checker_;
-
// Event handler for handling events sent from this object.
raw_ptr<ConnectionToClient::EventHandler> event_handler_ = nullptr;
@@ -103,10 +100,12 @@
std::unique_ptr<HostControlDispatcher> control_dispatcher_;
std::unique_ptr<HostEventDispatcher> event_dispatcher_;
+
+ THREAD_CHECKER(thread_checker_);
+
base::WeakPtrFactory<WebrtcConnectionToClient> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc
index 82cbd85..50d57ce 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -23,8 +23,7 @@
#include "remoting/protocol/webrtc_transport.h"
#include "remoting/protocol/webrtc_video_renderer_adapter.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcConnectionToHost::WebrtcConnectionToHost() = default;
WebrtcConnectionToHost::~WebrtcConnectionToHost() = default;
@@ -236,5 +235,4 @@
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_connection_to_host.h b/remoting/protocol/webrtc_connection_to_host.h
index 77102e7..c556e11 100644
--- a/remoting/protocol/webrtc_connection_to_host.h
+++ b/remoting/protocol/webrtc_connection_to_host.h
@@ -18,8 +18,7 @@
#include "remoting/protocol/session.h"
#include "remoting/protocol/webrtc_transport.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ClientControlDispatcher;
class ClientEventDispatcher;
@@ -116,7 +115,6 @@
ErrorCode error_ = OK;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_
diff --git a/remoting/protocol/webrtc_data_stream_adapter.cc b/remoting/protocol/webrtc_data_stream_adapter.cc
index b810e14..8351de7 100644
--- a/remoting/protocol/webrtc_data_stream_adapter.cc
+++ b/remoting/protocol/webrtc_data_stream_adapter.cc
@@ -17,8 +17,7 @@
#include "remoting/base/compound_buffer.h"
#include "remoting/protocol/message_serialization.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcDataStreamAdapter::WebrtcDataStreamAdapter(
rtc::scoped_refptr<webrtc::DataChannelInterface> channel)
@@ -163,5 +162,4 @@
WebrtcDataStreamAdapter::PendingMessage::~PendingMessage() = default;
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_data_stream_adapter.h b/remoting/protocol/webrtc_data_stream_adapter.h
index a15e30b..9677273 100644
--- a/remoting/protocol/webrtc_data_stream_adapter.h
+++ b/remoting/protocol/webrtc_data_stream_adapter.h
@@ -16,8 +16,7 @@
#include "third_party/webrtc/api/peer_connection_interface.h"
#include "third_party/webrtc/rtc_base/ref_count.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// WebrtcDataStreamAdapter implements MessagePipe for WebRTC data channels.
class WebrtcDataStreamAdapter : public MessagePipe,
@@ -80,7 +79,6 @@
base::WeakPtrFactory<WebrtcDataStreamAdapter> weak_ptr_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_DATA_STREAM_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_event_log_data.cc b/remoting/protocol/webrtc_event_log_data.cc
index 3a4c409..23541b7 100644
--- a/remoting/protocol/webrtc_event_log_data.cc
+++ b/remoting/protocol/webrtc_event_log_data.cc
@@ -10,8 +10,7 @@
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_piece.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcEventLogData::WebrtcEventLogData() {
// See the caveat for base::circular_deque::reserve(). Calling reserve() is
@@ -79,5 +78,4 @@
sections_.back().reserve(max_section_size_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_event_log_data.h b/remoting/protocol/webrtc_event_log_data.h
index fd5436c..8e4f72b 100644
--- a/remoting/protocol/webrtc_event_log_data.h
+++ b/remoting/protocol/webrtc_event_log_data.h
@@ -11,8 +11,7 @@
#include "base/containers/circular_deque.h"
#include "base/strings/string_piece.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// A data store which records the most recent RTC event log data. This is
// written to by an RTCEventLogOutput instance, which is owned by the
@@ -71,7 +70,6 @@
int max_section_size_ = kMaxSectionSize;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_EVENT_LOG_DATA_H_
diff --git a/remoting/protocol/webrtc_event_log_data_unittest.cc b/remoting/protocol/webrtc_event_log_data_unittest.cc
index 456a072..6f35278a 100644
--- a/remoting/protocol/webrtc_event_log_data_unittest.cc
+++ b/remoting/protocol/webrtc_event_log_data_unittest.cc
@@ -6,8 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -68,5 +67,4 @@
EXPECT_TRUE(data.empty());
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_frame_scheduler.h b/remoting/protocol/webrtc_frame_scheduler.h
index 7f0e737..7d3a8f3 100644
--- a/remoting/protocol/webrtc_frame_scheduler.h
+++ b/remoting/protocol/webrtc_frame_scheduler.h
@@ -12,8 +12,7 @@
class DesktopFrame;
} // namespace webrtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// An abstract interface for frame schedulers, which are responsible for
// scheduling when video frames are captured and for defining encoding
@@ -30,16 +29,15 @@
// Pause and resumes the scheduler.
virtual void Pause(bool pause) = 0;
- // Called after |frame| has been captured. |frame| may be set to nullptr
- // if the capture request failed.
+ // Called after |frame| has been captured. |frame| may be set to nullptr if
+ // the capture request failed.
virtual void OnFrameCaptured(const webrtc::DesktopFrame* frame) = 0;
- // Called when WebRTC requests the VideoTrackSource to provide frames
- // at a maximum framerate.
+ // Called when WebRTC requests the VideoTrackSource to provide frames at a
+ // maximum framerate.
virtual void SetMaxFramerateFps(int max_framerate_fps) = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_
diff --git a/remoting/protocol/webrtc_frame_scheduler_unittest.cc b/remoting/protocol/webrtc_frame_scheduler_unittest.cc
index aaf1b29..2fc3666 100644
--- a/remoting/protocol/webrtc_frame_scheduler_unittest.cc
+++ b/remoting/protocol/webrtc_frame_scheduler_unittest.cc
@@ -18,8 +18,7 @@
using webrtc::DesktopRect;
using webrtc::DesktopSize;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class WebrtcFrameSchedulerTest : public ::testing::Test {
public:
@@ -106,5 +105,4 @@
EXPECT_LE(1, capture_callback_count_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc
index 9f332cb..705a627 100644
--- a/remoting/protocol/webrtc_transport.cc
+++ b/remoting/protocol/webrtc_transport.cc
@@ -51,8 +51,7 @@
using jingle_xmpp::QName;
using jingle_xmpp::XmlElement;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class ScopedAllowThreadJoinForWebRtcTransport
: public base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {};
@@ -426,7 +425,7 @@
}
WebrtcTransport::~WebrtcTransport() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Close(OK);
}
@@ -471,7 +470,7 @@
void WebrtcTransport::Start(
Authenticator* authenticator,
SendTransportInfoCallback send_transport_info_callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(send_transport_info_callback_.is_null());
webrtc::ThreadWrapper::EnsureForCurrentMessageLoop();
@@ -492,7 +491,7 @@
}
bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (transport_info->Name() != QName(kTransportNamespace, "transport"))
return false;
@@ -611,7 +610,7 @@
}
const SessionOptions& WebrtcTransport::session_options() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return session_options_;
}
@@ -724,7 +723,7 @@
}
void WebrtcTransport::Close(ErrorCode error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!peer_connection_wrapper_)
return;
@@ -743,7 +742,7 @@
}
void WebrtcTransport::ApplySessionOptions(const SessionOptions& options) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
session_options_ = options;
absl::optional<std::string> video_codec = options.Get("Video-Codec");
if (video_codec) {
@@ -773,7 +772,7 @@
void WebrtcTransport::OnLocalSessionDescriptionCreated(
std::unique_ptr<webrtc::SessionDescriptionInterface> description,
const std::string& error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!peer_connection())
return;
@@ -837,7 +836,7 @@
void WebrtcTransport::OnLocalDescriptionSet(bool success,
const std::string& error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!peer_connection())
return;
@@ -862,7 +861,7 @@
void WebrtcTransport::OnRemoteDescriptionSet(bool send_answer,
bool success,
const std::string& error) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!peer_connection())
return;
@@ -888,24 +887,24 @@
void WebrtcTransport::OnSignalingChange(
webrtc::PeerConnectionInterface::SignalingState new_state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void WebrtcTransport::OnAddStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_handler_->OnWebrtcTransportMediaStreamAdded(stream);
}
void WebrtcTransport::OnRemoveStream(
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
event_handler_->OnWebrtcTransportMediaStreamRemoved(stream);
}
void WebrtcTransport::OnDataChannel(
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::string data_channel_name = data_channel->label();
if (data_channel_name == kControlChannelName) {
DCHECK(!control_data_channel_);
@@ -920,7 +919,7 @@
}
void WebrtcTransport::OnRenegotiationNeeded() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (transport_context_->role() == TransportRole::SERVER) {
RequestNegotiation();
@@ -933,7 +932,7 @@
void WebrtcTransport::OnIceConnectionChange(
webrtc::PeerConnectionInterface::IceConnectionState new_state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!connected_ &&
new_state == webrtc::PeerConnectionInterface::kIceConnectionConnected) {
@@ -952,12 +951,12 @@
void WebrtcTransport::OnIceGatheringChange(
webrtc::PeerConnectionInterface::IceGatheringState new_state) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
void WebrtcTransport::OnIceCandidate(
const webrtc::IceCandidateInterface* candidate) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::unique_ptr<XmlElement> candidate_element(
new XmlElement(QName(kTransportNamespace, "candidate")));
@@ -979,7 +978,7 @@
void WebrtcTransport::OnIceSelectedCandidatePairChanged(
const cricket::CandidatePairChangeEvent& event) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::string transport_protocol =
GetTransportProtocol(event.selected_candidate_pair);
@@ -1167,7 +1166,7 @@
}
void WebrtcTransport::EnsurePendingTransportInfoMessage() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// |transport_info_timer_| must be running iff
// |pending_transport_info_message_| exists.
@@ -1187,14 +1186,14 @@
}
void WebrtcTransport::SendTransportInfo() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(pending_transport_info_message_);
send_transport_info_callback_.Run(std::move(pending_transport_info_message_));
}
void WebrtcTransport::AddPendingCandidatesIfPossible() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (peer_connection()->signaling_state() ==
webrtc::PeerConnectionInterface::kStable) {
@@ -1210,7 +1209,7 @@
}
void WebrtcTransport::StartRtcEventLogging() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!peer_connection())
return;
@@ -1222,12 +1221,11 @@
}
void WebrtcTransport::StopRtcEventLogging() {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (peer_connection()) {
ScopedAllowThreadJoinForWebRtcTransport allow_wait;
peer_connection()->StopRtcEventLog();
}
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h
index 5468dcc..03cfa80 100644
--- a/remoting/protocol/webrtc_transport.h
+++ b/remoting/protocol/webrtc_transport.h
@@ -30,13 +30,10 @@
#include "third_party/webrtc/api/video_codecs/video_encoder_factory.h"
namespace base {
-
class Watchdog;
-
} // namespace base
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class TransportContext;
class MessagePipe;
@@ -227,8 +224,6 @@
void StartRtcEventLogging();
void StopRtcEventLogging();
- base::ThreadChecker thread_checker_;
-
scoped_refptr<TransportContext> transport_context_;
raw_ptr<EventHandler> event_handler_ = nullptr;
SendTransportInfoCallback send_transport_info_callback_;
@@ -272,10 +267,11 @@
// Stores event log data generated by WebRTC for the PeerConnection.
WebrtcEventLogData rtc_event_log_;
+ THREAD_CHECKER(thread_checker_);
+
base::WeakPtrFactory<WebrtcTransport> weak_factory_{this};
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_
diff --git a/remoting/protocol/webrtc_transport_unittest.cc b/remoting/protocol/webrtc_transport_unittest.cc
index 1172863..37b0cb4a 100644
--- a/remoting/protocol/webrtc_transport_unittest.cc
+++ b/remoting/protocol/webrtc_transport_unittest.cc
@@ -33,8 +33,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -463,5 +462,4 @@
EXPECT_FALSE(host_message_pipe_);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_frame_adapter.cc b/remoting/protocol/webrtc_video_frame_adapter.cc
index 08d0a1c..10d2f3a 100644
--- a/remoting/protocol/webrtc_video_frame_adapter.cc
+++ b/remoting/protocol/webrtc_video_frame_adapter.cc
@@ -9,8 +9,7 @@
#include "base/notreached.h"
#include "third_party/webrtc/rtc_base/ref_counted_object.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcVideoFrameAdapter::WebrtcVideoFrameAdapter(
std::unique_ptr<webrtc::DesktopFrame> frame,
@@ -74,12 +73,10 @@
rtc::scoped_refptr<webrtc::I420BufferInterface>
WebrtcVideoFrameAdapter::ToI420() {
// Strictly speaking all adapters must implement ToI420(), so that if the
- // external encoder fails, an internal libvpx could be used. But the
- // remoting encoder already uses libvpx, so there's no reason for fallback to
- // happen.
+ // external encoder fails, an internal libvpx could be used. But the remoting
+ // encoder already uses libvpx, so there's no reason for fallback to happen.
NOTIMPLEMENTED();
return nullptr;
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_frame_adapter.h b/remoting/protocol/webrtc_video_frame_adapter.h
index 9c7a3d92..2d78a7b 100644
--- a/remoting/protocol/webrtc_video_frame_adapter.h
+++ b/remoting/protocol/webrtc_video_frame_adapter.h
@@ -12,8 +12,7 @@
#include "third_party/webrtc/api/video/video_frame_buffer.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
// Adapter class to wrap a DesktopFrame produced by the capturer, and provide
// it as a VideoFrame to the WebRTC video sink. The encoder will extract the
@@ -53,7 +52,6 @@
std::unique_ptr<WebrtcVideoEncoder::FrameStats> frame_stats_;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_FRAME_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_video_frame_adapter_unittest.cc b/remoting/protocol/webrtc_video_frame_adapter_unittest.cc
index b616060..0154dc96 100644
--- a/remoting/protocol/webrtc_video_frame_adapter_unittest.cc
+++ b/remoting/protocol/webrtc_video_frame_adapter_unittest.cc
@@ -24,8 +24,7 @@
} // namespace
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
TEST(WebrtcVideoFrameAdapter, CreateVideoFrameWrapsDesktopFrame) {
auto desktop_frame = MakeDesktopFrame(100, 200);
@@ -78,5 +77,4 @@
.offset_x = 10, .offset_y = 20, .width = 60, .height = 60}));
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.cc b/remoting/protocol/webrtc_video_renderer_adapter.cc
index e340345..e22ca46 100644
--- a/remoting/protocol/webrtc_video_renderer_adapter.cc
+++ b/remoting/protocol/webrtc_video_renderer_adapter.cc
@@ -25,8 +25,7 @@
#include "third_party/libyuv/include/libyuv/convert_from.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -67,9 +66,8 @@
WebrtcVideoRendererAdapter::~WebrtcVideoRendererAdapter() {
DCHECK(task_runner_->BelongsToCurrentThread());
- // Needed for ConnectionTest unittests which set up a
- // fake connection without starting any video. This
- // video adapter is instantiated when the incoming
+ // Needed for ConnectionTest unittests which set up a fake connection without
+ // starting any video. This video adapter is instantiated when the incoming
// video-stats data channel is created.
if (!media_stream_) {
return;
@@ -256,5 +254,4 @@
frame_stats_consumer->OnVideoFrameStats(frame_stats);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.h b/remoting/protocol/webrtc_video_renderer_adapter.h
index 6a62b6ab..265a831 100644
--- a/remoting/protocol/webrtc_video_renderer_adapter.h
+++ b/remoting/protocol/webrtc_video_renderer_adapter.h
@@ -27,8 +27,7 @@
class VideoFrameBuffer;
} // namespace webrtc
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class MessagePipe;
class VideoRenderer;
@@ -91,7 +90,6 @@
base::WeakPtrFactory<WebrtcVideoRendererAdapter> weak_factory_{this};
};
-} // namespace remoting
-} // namespace protocol
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_RENDERER_ADAPTER_H_
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index b2a73d8..d464ce8 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -80,8 +80,6 @@
// Called by the |scheduler_|.
void CaptureNextFrame();
- THREAD_CHECKER(thread_checker_);
-
// The current frame size.
webrtc::DesktopSize frame_size_;
@@ -108,6 +106,8 @@
// Allows Core to post messages to its owner in a thread-safe manner.
scoped_refptr<base::SingleThreadTaskRunner> video_stream_task_runner_;
+
+ THREAD_CHECKER(thread_checker_);
};
WebrtcVideoStream::Core::Core(std::unique_ptr<webrtc::DesktopCapturer> capturer,
diff --git a/remoting/protocol/webrtc_video_stream.h b/remoting/protocol/webrtc_video_stream.h
index ea3404d..5b68f5e 100644
--- a/remoting/protocol/webrtc_video_stream.h
+++ b/remoting/protocol/webrtc_video_stream.h
@@ -88,8 +88,6 @@
std::unique_ptr<webrtc::DesktopFrame> desktop_frame,
std::unique_ptr<WebrtcVideoEncoder::FrameStats> frame_stats);
- THREAD_CHECKER(thread_checker_);
-
// Label of the associated WebRTC video-stream.
std::string stream_name_;
@@ -110,6 +108,8 @@
std::unique_ptr<Core> core_;
scoped_refptr<base::SingleThreadTaskRunner> core_task_runner_;
+ THREAD_CHECKER(thread_checker_);
+
base::WeakPtrFactory<WebrtcVideoStream> weak_factory_{this};
};
diff --git a/remoting/protocol/webrtc_video_track_source.cc b/remoting/protocol/webrtc_video_track_source.cc
index 3598a662..4ff8684 100644
--- a/remoting/protocol/webrtc_video_track_source.cc
+++ b/remoting/protocol/webrtc_video_track_source.cc
@@ -11,8 +11,7 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "remoting/protocol/webrtc_video_frame_adapter.h"
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
WebrtcVideoTrackSource::WebrtcVideoTrackSource(
AddSinkCallback add_sink_callback)
@@ -98,5 +97,4 @@
sink_->OnFrame(video_frame);
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
diff --git a/remoting/protocol/webrtc_video_track_source.h b/remoting/protocol/webrtc_video_track_source.h
index b9ce53e3..ae629d87 100644
--- a/remoting/protocol/webrtc_video_track_source.h
+++ b/remoting/protocol/webrtc_video_track_source.h
@@ -15,8 +15,7 @@
#include <memory>
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
class WebrtcVideoTrackSource
: public webrtc::Notifier<webrtc::VideoTrackSourceInterface> {
@@ -27,8 +26,10 @@
// |add_sink_callback| is notified on the main thread whenever a sink is
// added or updated.
explicit WebrtcVideoTrackSource(AddSinkCallback add_sink_callback);
+
~WebrtcVideoTrackSource() override;
WebrtcVideoTrackSource(const WebrtcVideoTrackSource&) = delete;
+
WebrtcVideoTrackSource& operator=(const WebrtcVideoTrackSource&) = delete;
// VideoTrackSourceInterface implementation.
@@ -64,7 +65,6 @@
uint16_t frame_id_ = 0;
};
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_TRACK_SOURCE_H_
diff --git a/remoting/protocol/webrtc_video_track_source_unittest.cc b/remoting/protocol/webrtc_video_track_source_unittest.cc
index 5a6d6dae..9d61706 100644
--- a/remoting/protocol/webrtc_video_track_source_unittest.cc
+++ b/remoting/protocol/webrtc_video_track_source_unittest.cc
@@ -23,8 +23,7 @@
using webrtc::DesktopSize;
using webrtc::VideoFrame;
-namespace remoting {
-namespace protocol {
+namespace remoting::protocol {
namespace {
@@ -99,5 +98,4 @@
task_environment_.FastForwardUntilNoTasksRemain();
}
-} // namespace protocol
-} // namespace remoting
+} // namespace remoting::protocol