Stop file observer of NetLog to finish writing to disk
This commit is contained in:
parent
f3c32647af
commit
e0860ea7a0
2 changed files with 11 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
|
@ -37,6 +38,8 @@ NetLog::NetLog() {
|
|||
}
|
||||
|
||||
NetLog::~NetLog() {
|
||||
file_net_log_observer_->StopObserving(nullptr, base::Closure());
|
||||
file_net_log_observer_.reset();
|
||||
}
|
||||
|
||||
void NetLog::StartLogging() {
|
||||
|
@ -50,7 +53,7 @@ void NetLog::StartLogging() {
|
|||
net::NetLogCaptureMode capture_mode =
|
||||
net::NetLogCaptureMode::IncludeCookiesAndCredentials();
|
||||
|
||||
std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_ =
|
||||
file_net_log_observer_ =
|
||||
net::FileNetLogObserver::CreateUnbounded(log_path, std::move(constants));
|
||||
file_net_log_observer_->StartObserving(this, capture_mode);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
#include "net/log/net_log.h"
|
||||
|
||||
namespace net {
|
||||
class FileNetLogObserver;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
||||
class NetLog : public net::NetLog {
|
||||
|
@ -17,6 +21,9 @@ class NetLog : public net::NetLog {
|
|||
void StartLogging();
|
||||
|
||||
private:
|
||||
// This observer handles writing NetLogs.
|
||||
std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NetLog);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue