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

Unified Diff: net/log/file_net_log_observer.cc

Issue 2658753002: Add FileNetLogObserver::FileWriter::FlushThenStop(), update FileNetLogObserver::StopObserving() to … (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « no previous file | no next file » | 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 8f1970164f3c79a692132bd7fab5ba69c69b4656..ef2c6164889a8febb5c2af4152ba9a6b988d8e64 100644
--- a/net/log/file_net_log_observer.cc
+++ b/net/log/file_net_log_observer.cc
@@ -129,6 +129,9 @@ class FileNetLogObserver::FileWriter {
// Deletes all netlog files. It is not valid to call any method of
// FileNetLogObserver after DeleteAllFiles().
virtual void DeleteAllFiles() = 0;
+
+ void FlushThenStop(scoped_refptr<WriteQueue> write_queue,
+ std::unique_ptr<base::Value> polled_data);
};
// This implementation of FileWriter is used when the observer is in bounded
@@ -299,14 +302,10 @@ void FileNetLogObserver::StartObservingHelper(
void FileNetLogObserver::StopObserving(std::unique_ptr<base::Value> polled_data,
const base::Closure& callback) {
- file_task_runner_->PostTask(
- FROM_HERE, base::Bind(&FileNetLogObserver::FileWriter::Flush,
- base::Unretained(file_writer_), write_queue_));
-
file_task_runner_->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&FileNetLogObserver::FileWriter::Stop,
- base::Unretained(file_writer_), base::Passed(&polled_data)),
+ FROM_HERE, base::Bind(&FileNetLogObserver::FileWriter::FlushThenStop,
+ base::Unretained(file_writer_), write_queue_,
+ base::Passed(&polled_data)),
callback);
net_log()->DeprecatedRemoveObserver(this);
@@ -363,6 +362,13 @@ FileNetLogObserver::WriteQueue::~WriteQueue() {}
FileNetLogObserver::FileWriter::~FileWriter() {}
+void FileNetLogObserver::FileWriter::FlushThenStop(
+ scoped_refptr<FileNetLogObserver::WriteQueue> write_queue,
+ std::unique_ptr<base::Value> polled_data) {
+ Flush(write_queue);
+ Stop(std::move(polled_data));
+}
+
FileNetLogObserver::BoundedFileWriter::BoundedFileWriter(
const base::FilePath& directory,
size_t max_file_size,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698