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

Unified Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2368663002: change return type of StartNetLogToFile (Closed)
Patch Set: add documentation comment and improve test for startNetLogToFile Created 4 years, 3 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
Index: components/cronet/android/cronet_url_request_context_adapter.cc
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index 7ced1be6e540608d1fdc51f72fb7a897961fb7bb..ffe6089a2ec9ba859339a059dc1872bd46ca25d7 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -775,7 +775,7 @@ CronetURLRequestContextAdapter::GetNetworkTaskRunner() const {
return network_thread_->task_runner();
}
-void CronetURLRequestContextAdapter::StartNetLogToFile(
+bool CronetURLRequestContextAdapter::StartNetLogToFile(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller,
const JavaParamRef<jstring>& jfile_name,
@@ -783,14 +783,14 @@ void CronetURLRequestContextAdapter::StartNetLogToFile(
base::AutoLock lock(write_to_file_observer_lock_);
// Do nothing if already logging to a file.
if (write_to_file_observer_)
- return;
+ return true;
std::string file_name =
base::android::ConvertJavaStringToUTF8(env, jfile_name);
base::FilePath file_path(file_name);
base::ScopedFILE file(base::OpenFile(file_path, "w"));
if (!file) {
LOG(ERROR) << "Failed to open NetLog file for writing.";
- return;
+ return false;
}
write_to_file_observer_.reset(new net::WriteToFileNetLogObserver());
@@ -801,6 +801,8 @@ void CronetURLRequestContextAdapter::StartNetLogToFile(
write_to_file_observer_->StartObserving(
g_net_log.Get().net_log(), std::move(file),
/*constants=*/nullptr, /*url_request_context=*/nullptr);
+
+ return true;
}
void CronetURLRequestContextAdapter::StartNetLogToDisk(

Powered by Google App Engine
This is Rietveld 408576698