| Index: chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.cc b/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| index b2fc873f41f19a28d41c4e6e0346492aa7528c5c..6c51aa3c18e67398a2048db7b56c9411e8ae0e9d 100644
|
| --- a/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| +++ b/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| @@ -238,6 +238,15 @@ bool BackgroundLoaderOffliner::HandleTimeout(int64_t request_id) {
|
| return false;
|
| }
|
|
|
| +void BackgroundLoaderOffliner::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 BackgroundLoaderOffliner::MarkLoadStartTime() {
|
| load_start_time_ = base::TimeTicks::Now();
|
| }
|
| @@ -493,6 +502,17 @@ void BackgroundLoaderOffliner::AddLoadingSignal(const char* signal_name) {
|
| signal_data_.SetDouble(signal_name, delay);
|
| }
|
|
|
| +void BackgroundLoaderOffliner::AddResourceSignal(const ResourceDataType type,
|
| + int64_t started_count,
|
| + int64_t completed_count) {
|
| + double percentage = 100.0 * 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);
|
| +}
|
| +
|
| } // namespace offline_pages
|
|
|
| DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData);
|
|
|