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

Side by Side Diff: components/offline_pages/core/background/resource_tracker_observer_stub.cc

Issue 2857063002: Add a way to send the resource percentage signal to the RC. (Closed)
Patch Set: Turn off other metrics which might require tab helpers when background loading 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/offline_pages/core/background/resource_tracker_observer_stu b.h"
6
7 namespace offline_pages {
8
9 ResourceTrackerObserverStub::ResourceTrackerObserverStub()
10 : images_started_(0), images_completed_(0) {}
11
12 ResourceTrackerObserverStub::~ResourceTrackerObserverStub() {}
13
14 // When we are notified of a resource load starting or ending, pass the
15 // information along to the offliner.
16 // TODO(petewil): Today this just supports images, expand to support all types.
17 void ResourceTrackerObserverStub::ObserveResourceTracking(
18 const ResourceDataType type,
19 int64_t started_count,
20 int64_t completed_count) {
21 if (type == ResourceDataType::IMAGE) {
22 images_started_ = started_count;
23 images_completed_ = completed_count;
24 }
25 }
26
27 // Returns the most recently seen counts for a specific resource type.
28 // TODO(petewil): Today this just supports images, later support all types.
29 void ResourceTrackerObserverStub::GetResourcePercentageCounts(
30 const ResourceDataType type,
31 int64_t* started,
32 int64_t* completed) {
33 if (type == ResourceDataType::IMAGE) {
34 if (started)
35 *started = images_started_;
36 if (completed)
37 *completed = images_completed_;
38 }
39 }
40
41 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698