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

Side by Side Diff: chrome/browser/android/data_usage/external_data_use_reporter.h

Issue 2169773002: Batch data use objects in ExternalDataUseObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque>
11 #include <memory> 12 #include <memory>
12 #include <string> 13 #include <string>
13 14
14 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
15 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
20 21
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // |this|. |field_trial| is the field trial name to get the various 61 // |this|. |field_trial| is the field trial name to get the various
61 // paramenters from. 62 // paramenters from.
62 ExternalDataUseReporter( 63 ExternalDataUseReporter(
63 const char* field_trial, 64 const char* field_trial,
64 DataUseTabModel* data_use_tab_model, 65 DataUseTabModel* data_use_tab_model,
65 ExternalDataUseObserverBridge* external_data_use_observer_bridge); 66 ExternalDataUseObserverBridge* external_data_use_observer_bridge);
66 virtual ~ExternalDataUseReporter(); 67 virtual ~ExternalDataUseReporter();
67 68
68 void InitOnUIThread(); 69 void InitOnUIThread();
69 70
70 // Notifies the ExternalDataUseReporter of data usage. The data use is 71 // Notifies the ExternalDataUseReporter of data usage. The data use is labeled
71 // labeled using |data_use_tab_model_|, buffered and then reported to 72 // using |data_use_tab_model_|, buffered and then reported to
72 // |external_data_use_observer_bridge_| later. 73 // |external_data_use_observer_bridge_| later.
73 void OnDataUse(const data_usage::DataUse& data_use); 74 void OnDataUse(std::unique_ptr<const std::deque<const data_usage::DataUse>>
75 data_use_list);
74 76
75 void OnReportDataUseDone(bool success); 77 void OnReportDataUseDone(bool success);
76 78
77 private: 79 private:
78 friend class ExternalDataUseReporterTest; 80 friend class ExternalDataUseReporterTest;
79 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, BufferDataUseReports); 81 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, BufferDataUseReports);
80 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, BufferSize); 82 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, BufferSize);
81 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, DataUseReportTimedOut); 83 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, DataUseReportTimedOut);
82 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
83 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest, 85 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseReporterTest,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 base::ThreadChecker thread_checker_; 235 base::ThreadChecker thread_checker_;
234 236
235 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseReporter); 237 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseReporter);
236 }; 238 };
237 239
238 } // namespace android 240 } // namespace android
239 241
240 } // namespace chrome 242 } // namespace chrome
241 243
242 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_ 244 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_REPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698