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

Unified Diff: net/socket/ssl_client_socket_impl.cc

Issue 2092563002: Set up field trials for SSL read/write buffer sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo 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 | net/url_request/url_request_http_job.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_impl.cc
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc
index 80ff994982f2d3e804266d8623bae1dd2e90b0d4..c775c3edd5568258e30e61b04eb84a7e9521a1fa 100644
--- a/net/socket/ssl_client_socket_impl.cc
+++ b/net/socket/ssl_client_socket_impl.cc
@@ -20,6 +20,7 @@
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/profiler/scoped_tracker.h"
@@ -85,7 +86,7 @@ const int kNoPendingResult = 1;
const char kDefaultSupportedNPNProtocol[] = "http/1.1";
// Default size of the internal BoringSSL buffers.
-const int KDefaultOpenSSLBufferSize = 17 * 1024;
+const int kDefaultOpenSSLBufferSize = 17 * 1024;
// TLS extension number use for Token Binding.
const unsigned int kTbExtNum = 24;
@@ -929,10 +930,29 @@ int SSLClientSocketImpl::Init() {
if (session)
SSL_set_session(ssl_, session.get());
+ // Get read and write buffer sizes from field trials, if possible. If values
+ // not present, use default. Also make sure values are in reasonable range.
+ int send_buffer_size;
+ if (!base::StringToInt(
+ base::FieldTrialList::FindFullName("SSLBufferSizeSend"),
+ &send_buffer_size)) {
jwd 2016/06/28 15:35:12 I'd prefer you use variation params instead of the
mmenke 2016/06/28 18:47:21 Unfortunately, net/ can depend on components/.
mmenke 2016/06/28 18:47:59 can't, rather
jwd 2016/06/28 19:05:16 Ah, ok, so in that case, I'm fine how it is. Strin
mmenke 2016/06/28 19:18:23 Unfortunately, this deep in the network stack, we
jwd 2016/06/28 19:23:22 Ah, none of my suggestions work! Oh well...
+ send_buffer_size = kDefaultOpenSSLBufferSize;
+ }
+ send_buffer_size = std::max(send_buffer_size, 1000);
+ send_buffer_size = std::min(send_buffer_size, 2 * kDefaultOpenSSLBufferSize);
send_buffer_ = new GrowableIOBuffer();
- send_buffer_->SetCapacity(KDefaultOpenSSLBufferSize);
+ send_buffer_->SetCapacity(send_buffer_size);
+
+ int recv_buffer_size;
+ if (!base::StringToInt(
+ base::FieldTrialList::FindFullName("SSLBufferSizeRecv"),
+ &recv_buffer_size)) {
+ recv_buffer_size = kDefaultOpenSSLBufferSize;
+ }
+ recv_buffer_size = std::max(recv_buffer_size, 1000);
+ recv_buffer_size = std::min(recv_buffer_size, 2 * kDefaultOpenSSLBufferSize);
recv_buffer_ = new GrowableIOBuffer();
- recv_buffer_->SetCapacity(KDefaultOpenSSLBufferSize);
+ recv_buffer_->SetCapacity(recv_buffer_size);
BIO* ssl_bio = NULL;
« no previous file with comments | « no previous file | net/url_request/url_request_http_job.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698