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

Unified Diff: net/log/file_net_log_observer.cc

Issue 2973673003: Use FileNetLogObserver for implementing --log-net-log. (Closed)
Patch Set: address comments Created 3 years, 5 months 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
« no previous file with comments | « net/log/file_net_log_observer.h ('k') | net/log/file_net_log_observer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/file_net_log_observer.cc
diff --git a/net/log/file_net_log_observer.cc b/net/log/file_net_log_observer.cc
index f00785d0bdde07557f611b9f5fd0a106f46c730b..4c74ccf5466183a025d2564352925cf1530b9270 100644
--- a/net/log/file_net_log_observer.cc
+++ b/net/log/file_net_log_observer.cc
@@ -297,15 +297,22 @@ void FileNetLogObserver::StartObserving(NetLog* net_log,
}
void FileNetLogObserver::StopObserving(std::unique_ptr<base::Value> polled_data,
- const base::Closure& callback) {
+ base::OnceClosure optional_callback) {
net_log()->DeprecatedRemoveObserver(this);
- file_task_runner_->PostTaskAndReply(
- FROM_HERE,
+ base::OnceClosure bound_flush_then_stop =
base::Bind(&FileNetLogObserver::FileWriter::FlushThenStop,
base::Unretained(file_writer_.get()), write_queue_,
- base::Passed(&polled_data)),
- callback);
+ base::Passed(&polled_data));
+
+ // Note that PostTaskAndReply() requires a non-null closure.
+ if (!optional_callback.is_null()) {
+ file_task_runner_->PostTaskAndReply(FROM_HERE,
+ std::move(bound_flush_then_stop),
+ std::move(optional_callback));
+ } else {
+ file_task_runner_->PostTask(FROM_HERE, std::move(bound_flush_then_stop));
+ }
}
void FileNetLogObserver::OnAddEntry(const NetLogEntry& entry) {
« no previous file with comments | « net/log/file_net_log_observer.h ('k') | net/log/file_net_log_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698