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

Unified Diff: chrome/browser/android/offline_pages/prerendering_loader.cc

Issue 2857063002: Add a way to send the resource percentage signal to the RC. (Closed)
Patch Set: Make sure we don't send notifications unless we are offlining Created 3 years, 7 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
Index: chrome/browser/android/offline_pages/prerendering_loader.cc
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.cc b/chrome/browser/android/offline_pages/prerendering_loader.cc
index 5eccbf9f696600b8045c7cfbf5e1cf3c315d6fe7..fd31ed8a0f7d13cf69cda47b6b7cb570fcc4ea50 100644
--- a/chrome/browser/android/offline_pages/prerendering_loader.cc
+++ b/chrome/browser/android/offline_pages/prerendering_loader.cc
@@ -88,6 +88,17 @@ void PrerenderingLoader::AddLoadingSignal(const char* signal_name) {
signal_data_.SetDouble(signal_name, delay);
}
+void PrerenderingLoader::AddResourceSignal(const ResourceDataType type,
+ int64_t started_count,
+ int64_t completed_count) {
+ double percentage = 100 * static_cast<double>(completed_count) /
+ static_cast<double>(started_count);
+ // TODO(petewil): Use actual signal type instead of hardcoding name to image.
+ signal_data_.SetDouble("ImagePercentage", percentage);
+ signal_data_.SetDouble("StartedImages", started_count);
+ signal_data_.SetDouble("CompletedImages", completed_count);
+}
+
bool PrerenderingLoader::LoadPage(const GURL& url,
const LoadPageCallback& load_done_callback,
const ProgressCallback& progress_callback) {
@@ -199,6 +210,14 @@ bool PrerenderingLoader::IsLowbarMet() {
return is_lowbar_met_;
}
+void PrerenderingLoader::ObserveResourceTracking(const ResourceDataType type,
+ int64_t started_count,
+ int64_t completed_count) {
+ // Add the signal to extra data, and use for tracking.
+ if (type == ResourceDataType::IMAGE)
+ AddResourceSignal(type, started_count, completed_count);
+}
+
void PrerenderingLoader::HandleLoadEvent() {
// If still loading, check if the load succeeded or not, then update
// the internal state (LOADED for success or IDLE for failure) and post

Powered by Google App Engine
This is Rietveld 408576698