Commit 23e5728e authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove WebRtcTextLogHandler::LogInitialInfoOnFileThread().

Replace it with GetNetworkInterfaceList() which more accurately describe
what it does. Use base::PostTaskWithTraitsAndReplyWithResult() so it
does not need to know how to reply.

Change-Id: Ibc9f9cdec03cbc602903fc2342c9629ba79aa42d
Reviewed-on: https://chromium-review.googlesource.com/740945Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513227}
parent 8907d1f6
...@@ -46,6 +46,7 @@ using base::IntToString; ...@@ -46,6 +46,7 @@ using base::IntToString;
using content::BrowserThread; using content::BrowserThread;
namespace { namespace {
std::string FormatMetaDataAsLogMessage(const MetaDataMap& meta_data) { std::string FormatMetaDataAsLogMessage(const MetaDataMap& meta_data) {
std::string message; std::string message;
for (auto& kv : meta_data) { for (auto& kv : meta_data) {
...@@ -90,6 +91,14 @@ std::string IPAddressToSensitiveString(const net::IPAddress& address) { ...@@ -90,6 +91,14 @@ std::string IPAddressToSensitiveString(const net::IPAddress& address) {
return address.ToString(); return address.ToString();
#endif #endif
} }
net::NetworkInterfaceList GetNetworkInterfaceList() {
net::NetworkInterfaceList network_list;
net::GetNetworkList(&network_list,
net::EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES);
return network_list;
}
} // namespace } // namespace
WebRtcLogBuffer::WebRtcLogBuffer() WebRtcLogBuffer::WebRtcLogBuffer()
...@@ -197,9 +206,10 @@ bool WebRtcTextLogHandler::StartLogging(WebRtcLogUploader* log_uploader, ...@@ -197,9 +206,10 @@ bool WebRtcTextLogHandler::StartLogging(WebRtcLogUploader* log_uploader,
if (!meta_data_) if (!meta_data_)
meta_data_.reset(new MetaDataMap()); meta_data_.reset(new MetaDataMap());
base::PostTaskWithTraits( base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::BindOnce(&WebRtcTextLogHandler::LogInitialInfoOnFileThread, this, base::BindOnce(&GetNetworkInterfaceList),
base::BindOnce(&WebRtcTextLogHandler::LogInitialInfoOnIOThread, this,
callback)); callback));
return true; return true;
} }
...@@ -377,21 +387,9 @@ void WebRtcTextLogHandler::FireGenericDoneCallback( ...@@ -377,21 +387,9 @@ void WebRtcTextLogHandler::FireGenericDoneCallback(
base::BindOnce(callback, success, error_message_with_state)); base::BindOnce(callback, success, error_message_with_state));
} }
void WebRtcTextLogHandler::LogInitialInfoOnFileThread(
const GenericDoneCallback& callback) {
net::NetworkInterfaceList network_list;
net::GetNetworkList(&network_list,
net::EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(&WebRtcTextLogHandler::LogInitialInfoOnIOThread, this,
network_list, callback));
}
void WebRtcTextLogHandler::LogInitialInfoOnIOThread( void WebRtcTextLogHandler::LogInitialInfoOnIOThread(
const net::NetworkInterfaceList& network_list, const GenericDoneCallback& callback,
const GenericDoneCallback& callback) { const net::NetworkInterfaceList& network_list) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (logging_state_ != STARTING) { if (logging_state_ != STARTING) {
FireGenericDoneCallback(callback, false, "Logging cancelled."); FireGenericDoneCallback(callback, false, "Logging cancelled.");
......
...@@ -138,9 +138,8 @@ class WebRtcTextLogHandler ...@@ -138,9 +138,8 @@ class WebRtcTextLogHandler
void LogToCircularBuffer(const std::string& message); void LogToCircularBuffer(const std::string& message);
void LogInitialInfoOnFileThread(const GenericDoneCallback& callback); void LogInitialInfoOnIOThread(const GenericDoneCallback& callback,
void LogInitialInfoOnIOThread(const net::NetworkInterfaceList& network_list, const net::NetworkInterfaceList& network_list);
const GenericDoneCallback& callback);
void EnableBrowserProcessLoggingOnUIThread(); void EnableBrowserProcessLoggingOnUIThread();
void DisableBrowserProcessLoggingOnUIThread(); void DisableBrowserProcessLoggingOnUIThread();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment