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

Unified Diff: net/http/http_stream_factory_impl.cc

Issue 2814473002: Move HttpStreamFactoryImpl::JobController UMA to a schedule upload (Closed)
Patch Set: add test Created 3 years, 8 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 | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl.cc
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index 13948e47fba48f91a2c6dada77722ef406a9ce9c..54645e6a25e48a652a26660fd7c321e26ece3a58 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -13,6 +13,7 @@
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/thread_checker.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "base/trace_event/process_memory_dump.h"
@@ -103,32 +104,13 @@ HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
bool for_websockets)
: session_(session),
job_factory_(new DefaultJobFactory()),
- for_websockets_(for_websockets) {}
+ for_websockets_(for_websockets) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ NetworkChangeNotifier::AddMetricsObserver(this);
+}
HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
DCHECK(spdy_session_request_map_.empty());
- int alt_job_count = 0;
- int main_job_count = 0;
- int preconnect_controller_count = 0;
- for (const auto& it : job_controller_set_) {
- DCHECK(it->HasPendingAltJob() || it->HasPendingMainJob());
- // For a preconnect controller, it should have exactly the main job.
- if (it->is_preconnect()) {
- preconnect_controller_count++;
- continue;
- }
- // For non-preconnects.
- if (it->HasPendingAltJob())
- alt_job_count++;
- if (it->HasPendingMainJob())
- main_job_count++;
- }
- UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPreconnect",
- preconnect_controller_count);
- UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectAltJob",
- alt_job_count);
- UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectMainJob",
- main_job_count);
}
HttpStreamRequest* HttpStreamFactoryImpl::RequestStream(
@@ -418,4 +400,30 @@ void HttpStreamFactoryImpl::DumpMemoryStats(
preconnect_controller_count);
}
+void HttpStreamFactoryImpl::OnMetricsFinalize() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ int alt_job_count = 0;
+ int main_job_count = 0;
+ int preconnect_controller_count = 0;
+ for (const auto& it : job_controller_set_) {
+ DCHECK(it->HasPendingAltJob() || it->HasPendingMainJob());
+ // For a preconnect controller, it should have exactly the main job.
+ if (it->is_preconnect()) {
+ preconnect_controller_count++;
+ continue;
+ }
+ // For non-preconnects.
+ if (it->HasPendingAltJob())
+ alt_job_count++;
+ if (it->HasPendingMainJob())
+ main_job_count++;
+ }
+ UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPreconnect",
+ preconnect_controller_count);
+ UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectAltJob",
+ alt_job_count);
+ UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectMainJob",
+ main_job_count);
+}
+
} // namespace net
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698