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

Unified Diff: chrome/browser/tracing/background_tracing_field_trial.cc

Issue 2085623005: Limit the background trials upload size to 100Kib when using mobile data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Configure size limit. Created 4 years, 6 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 | chrome/browser/tracing/crash_service_uploader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tracing/background_tracing_field_trial.cc
diff --git a/chrome/browser/tracing/background_tracing_field_trial.cc b/chrome/browser/tracing/background_tracing_field_trial.cc
index 970cfddb6ca30a7b870981b8d94eec39d2afa2b0..d4f9e96e6cb68e2fe71ef62dbb3d54254924ac1a 100644
--- a/chrome/browser/tracing/background_tracing_field_trial.cc
+++ b/chrome/browser/tracing/background_tracing_field_trial.cc
@@ -9,6 +9,7 @@
#include "base/json/json_reader.h"
#include "base/metrics/field_trial.h"
+#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/tracing/crash_service_uploader.h"
#include "chrome/common/variations/variations_util.h"
@@ -16,6 +17,7 @@
#include "content/public/browser/background_tracing_config.h"
#include "content/public/browser/background_tracing_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "net/base/network_change_notifier.h"
#include "url/gurl.h"
namespace tracing {
@@ -46,6 +48,16 @@ void UploadCallback(const std::string& upload_url,
if (GURL(upload_url).is_valid())
uploader->SetUploadURL(upload_url);
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ auto connection_type = net::NetworkChangeNotifier::GetConnectionType();
+ if (connection_type != net::NetworkChangeNotifier::CONNECTION_WIFI &&
+ connection_type != net::NetworkChangeNotifier::CONNECTION_ETHERNET &&
+ connection_type != net::NetworkChangeNotifier::CONNECTION_BLUETOOTH) {
+ // Allow only 100KiB for uploads over data.
+ uploader->SetMaxUploadBytes(100 * 1024);
+ }
+#endif // defined(OS_ANDROID) || defined(OS_IOS)
+
uploader->DoUpload(
file_contents->data(), content::TraceUploader::UNCOMPRESSED_UPLOAD,
std::move(metadata), content::TraceUploader::UploadProgressCallback(),
« no previous file with comments | « no previous file | chrome/browser/tracing/crash_service_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698