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

Unified Diff: components/offline_pages/core/background/offliner_stub.cc

Issue 2857063002: Add a way to send the resource percentage signal to the RC. (Closed)
Patch Set: CR Feedback per Dimich, BMcQuade, and CSHarrison 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: components/offline_pages/core/background/offliner_stub.cc
diff --git a/components/offline_pages/core/background/offliner_stub.cc b/components/offline_pages/core/background/offliner_stub.cc
index 58b80a159286601b889932e8cecc78754d00f547..5e1cac4adfd82ff6e118b9fd3a60ee12fc3e0432 100644
--- a/components/offline_pages/core/background/offliner_stub.cc
+++ b/components/offline_pages/core/background/offliner_stub.cc
@@ -14,7 +14,9 @@ OfflinerStub::OfflinerStub()
: disable_loading_(false),
enable_callback_(false),
cancel_called_(false),
- snapshot_on_last_retry_(false) {}
+ snapshot_on_last_retry_(false),
+ started_count_(0LL),
+ completed_count_(0LL) {}
OfflinerStub::~OfflinerStub() {}
@@ -60,4 +62,24 @@ bool OfflinerStub::HandleTimeout(int64_t request_id) {
return false;
}
+void OfflinerStub::ObserveResourceTracking(ResourceDataType type,
+ int64_t started_count,
+ int64_t completed_count) {
+ started_count_ = started_count;
+ completed_count_ = completed_count;
+}
+
+// Returns the most recently seen counts for a specific resource type.
+// TODO(petewil): Today this just supports images, later support all types.
+void OfflinerStub::GetResourcePercentageCounts(const ResourceDataType type,
+ int64_t* started,
+ int64_t* completed) {
+ if (type == ResourceDataType::IMAGE) {
+ if (started)
+ *started = started_count_;
+ if (completed)
+ *completed = completed_count_;
+ }
+}
+
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698