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

Unified Diff: net/tools/quic/test_tools/packet_dropping_test_writer.h

Issue 2561913003: Create a QUIC wrapper around a mutex and a mutex lock. (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/tools/quic/test_tools/packet_dropping_test_writer.h
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.h b/net/tools/quic/test_tools/packet_dropping_test_writer.h
index a8a4ed2cca482fbd5166e441083a97c5a34ffab0..c4c28b6f1bac82ea51ef44a783d8953da5bd7d00 100644
--- a/net/tools/quic/test_tools/packet_dropping_test_writer.h
+++ b/net/tools/quic/test_tools/packet_dropping_test_writer.h
@@ -71,14 +71,14 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
// The percent of time a packet is simulated as being lost.
void set_fake_packet_loss_percentage(int32_t fake_packet_loss_percentage) {
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
fake_packet_loss_percentage_ = fake_packet_loss_percentage;
}
// Simulate dropping the first n packets unconditionally.
// Subsequent packets will be lost at fake_packet_loss_percentage_ if set.
void set_fake_drop_first_n_packets(int32_t fake_drop_first_n_packets) {
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
fake_drop_first_n_packets_ = fake_drop_first_n_packets;
}
@@ -87,14 +87,14 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
void set_fake_blocked_socket_percentage(
int32_t fake_blocked_socket_percentage) {
DCHECK(clock_);
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
fake_blocked_socket_percentage_ = fake_blocked_socket_percentage;
}
// The percent of time a packet is simulated as being reordered.
void set_fake_reorder_percentage(int32_t fake_packet_reorder_percentage) {
DCHECK(clock_);
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
DCHECK(!fake_packet_delay_.IsZero());
fake_packet_reorder_percentage_ = fake_packet_reorder_percentage;
}
@@ -102,7 +102,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
// The delay before writing this packet.
void set_fake_packet_delay(QuicTime::Delta fake_packet_delay) {
DCHECK(clock_);
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
fake_packet_delay_ = fake_packet_delay;
}
@@ -113,7 +113,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
void set_max_bandwidth_and_buffer_size(QuicBandwidth fake_bandwidth,
QuicByteCount buffer_size) {
DCHECK(clock_);
- base::AutoLock locked(config_mutex_);
+ QuicWriterMutexLock lock(&config_mutex_);
fake_bandwidth_ = fake_bandwidth;
buffer_size_ = buffer_size;
}
@@ -163,14 +163,14 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
QuicByteCount cur_buffer_size_;
uint64_t num_calls_to_write_;
- base::Lock config_mutex_;
- int32_t fake_packet_loss_percentage_;
- int32_t fake_drop_first_n_packets_;
- int32_t fake_blocked_socket_percentage_;
- int32_t fake_packet_reorder_percentage_;
- QuicTime::Delta fake_packet_delay_;
- QuicBandwidth fake_bandwidth_;
- QuicByteCount buffer_size_;
+ QuicMutex config_mutex_;
+ int32_t fake_packet_loss_percentage_ GUARDED_BY(config_mutex_);
+ int32_t fake_drop_first_n_packets_ GUARDED_BY(config_mutex_);
+ int32_t fake_blocked_socket_percentage_ GUARDED_BY(config_mutex_);
+ int32_t fake_packet_reorder_percentage_ GUARDED_BY(config_mutex_);
+ QuicTime::Delta fake_packet_delay_ GUARDED_BY(config_mutex_);
+ QuicBandwidth fake_bandwidth_ GUARDED_BY(config_mutex_);
+ QuicByteCount buffer_size_ GUARDED_BY(config_mutex_);
DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter);
};
« no previous file with comments | « net/tools/quic/quic_http_response_cache.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698