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

Side by Side Diff: components/previews/previews_data_savings.cc

Issue 2257533003: Adding a previews object, PreviewsDataSavings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and design change. Created 4 years, 3 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 2016 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/previews/previews_data_savings.h"
6
7 #include "base/logging.h"
8 #include "base/metrics/histogram_macros.h"
9 #include "components/data_reduction_proxy/core/common/data_savings_recorder.h"
10
11 namespace previews {
12
13 PreviewsDataSavings::PreviewsDataSavings(
14 data_reduction_proxy::DataSavingsRecorder* data_savings_recorder)
15 : data_savings_recorder_(data_savings_recorder) {
16 DCHECK(data_savings_recorder);
17 }
18
19 PreviewsDataSavings::~PreviewsDataSavings() {
20 DCHECK(thread_checker_.CalledOnValidThread());
21 }
22
23 void PreviewsDataSavings::RecordDataSavings(
24 const std::string& fully_qualified_domain_name,
25 int64_t data_used,
26 int64_t original_size) {
27 DCHECK(thread_checker_.CalledOnValidThread());
28
29 // Only record savings when data saver is enabled.
30 if (!data_savings_recorder_->ShouldRecordDataSavings()) {
bengr 2016/08/31 22:02:26 Can this be an implementation detail of UpdateData
RyanSturm 2016/09/02 01:17:51 Done.
31 return;
32 }
33 data_savings_recorder_->UpdateDataSavings(fully_qualified_domain_name,
34 data_used, original_size);
35 }
36
37 } // namespace previews
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698