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

Unified Diff: chrome/renderer/page_load_histograms.cc

Issue 2231843002: Don't push histograms to browser after every page load when persistence is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/page_load_histograms.cc
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
index 843176f94a83afb4fd5a24809c1647212f9de357..fc3d04e2ccfda8bf5c14ef9289e0365b75ca2eaf 100644
--- a/chrome/renderer/page_load_histograms.cc
+++ b/chrome/renderer/page_load_histograms.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/persistent_histogram_allocator.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -876,16 +877,14 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
// Log the PLT to the info log.
LogPageLoadTime(document_state, frame->dataSource());
- // Since there are currently no guarantees that renderer histograms will be
- // sent to the browser, we initiate a PostTask here to be sure that we send
- // the histograms we generated. Without this call, pages that don't have an
- // on-close-handler might generate data that is lost when the renderer is
- // shutdown abruptly (perchance because the user closed the tab).
- // TODO(jar) BUG=33233: This needs to be moved to a PostDelayedTask, and it
- // should post when the onload is complete, so that it doesn't interfere with
- // the next load.
- content::RenderThread::Get()->UpdateHistograms(
- content::kHistogramSynchronizerReservedSequenceNumber);
+ // If persistent histograms are not enabled, initiate a PostTask here to be
+ // sure that we send the histograms generated. Without this call, pages
+ // that don't have an on-close-handler might generate data that is lost if
+ // the renderer is shutdown abruptly (e.g. the user closed the tab).
Alexei Svitkine (slow) 2016/08/10 15:44:28 Maybe add a TODO to clean this up when persistent
bcwhite 2016/08/10 16:30:55 Done.
+ if (!base::GlobalHistogramAllocator::Get()) {
+ content::RenderThread::Get()->UpdateHistograms(
+ content::kHistogramSynchronizerReservedSequenceNumber);
+ }
}
void PageLoadHistograms::FrameWillClose(WebFrame* frame) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698