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

Unified Diff: chrome/browser/offline_pages/background_loader_offliner.cc

Issue 2903383003: Get network resource usage from ChromeResourceDispatcherHostDelegate (Closed)
Patch Set: CR feedback per FGorski Created 3 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
Index: chrome/browser/offline_pages/background_loader_offliner.cc
diff --git a/chrome/browser/offline_pages/background_loader_offliner.cc b/chrome/browser/offline_pages/background_loader_offliner.cc
index c5203bb8e51b9f68c575ce3c231f5a46b1163b30..a40ce2af49eb5d8f1fbe75d82f0093fba5655163 100644
--- a/chrome/browser/offline_pages/background_loader_offliner.cc
+++ b/chrome/browser/offline_pages/background_loader_offliner.cc
@@ -106,6 +106,8 @@ BackgroundLoaderOffliner::BackgroundLoaderOffliner(
network_bytes_(0LL),
is_low_bar_met_(false),
did_snapshot_on_last_retry_(false),
+ started_count_(0LL),
+ completed_count_(0LL),
weak_ptr_factory_(this) {
DCHECK(offline_page_model_);
DCHECK(browser_context_);
@@ -348,8 +350,18 @@ void BackgroundLoaderOffliner::SetSnapshotControllerForTest(
void BackgroundLoaderOffliner::ObserveResourceLoading(
ResourceLoadingObserver::ResourceDataType type,
bool started) {
- // TODO(petewil) Not implemented yet.
- return;
+ // TODO(petewil): Use actual signal type instead of hardcoding name to
+ // image.
+ // Add the signal to extra data, and use for tracking.
+ if (type == ResourceDataType::IMAGE) {
+ if (started) {
+ started_count_++;
+ signal_data_.SetDouble("StartedImages", started_count_);
+ } else {
+ completed_count_++;
+ signal_data_.SetDouble("CompletedImages", completed_count_);
+ }
+ }
}
void BackgroundLoaderOffliner::OnNetworkBytesChanged(int64_t bytes) {
« no previous file with comments | « chrome/browser/offline_pages/background_loader_offliner.h ('k') | chrome/browser/offline_pages/offliner_user_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698