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

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: 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') | no next file with comments »
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..76405869b08231a50f243c55df9d8a1100efa9b8 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"
@@ -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)) {
+ send_buffer_size = KDefaultOpenSSLBufferSize;
davidben 2016/06/27 18:31:48 (Haha. While you're here, do you mind fixing KDefa
mmenke 2016/06/27 20:01:06 I completely missed that! Done.
+ }
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698