Index: net/log/bounded_file_net_log_observer.cc |
diff --git a/net/log/bounded_file_net_log_observer.cc b/net/log/bounded_file_net_log_observer.cc |
index 833e84753d522884027fe21643059bcaba6723d6..d7b78f31a05478a4c3c97170ea0621601f111817 100644 |
--- a/net/log/bounded_file_net_log_observer.cc |
+++ b/net/log/bounded_file_net_log_observer.cc |
@@ -259,8 +259,10 @@ void BoundedFileNetLogObserver::OnAddEntry(const NetLogEntry& entry) { |
size_t queue_size = write_queue_->AddEntryToQueue(std::move(json)); |
// If events build up in |write_queue_|, trigger the file thread to drain |
- // the queue. |
- if (queue_size >= kNumWriteQueueEvents) { |
+ // the queue. Because only 1 item is added to the queue at a time, if |
+ // queue_size > kNumWriteQueueEvents a task has already been posted, or will |
+ // be posted. |
+ if (queue_size == kNumWriteQueueEvents) { |
task_runner_->PostTask( |
FROM_HERE, base::Bind(&BoundedFileNetLogObserver::FileWriter::Flush, |
base::Unretained(file_writer_), write_queue_)); |