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

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

Issue 1772273002: Remove one thread hop while fetching matching rules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Returns the pointer to the DataUseTabModel object owned by |this|. The 76 // Returns the pointer to the DataUseTabModel object owned by |this|. The
77 // caller does not owns the returned pointer. 77 // caller does not owns the returned pointer.
78 DataUseTabModel* GetDataUseTabModel() const; 78 DataUseTabModel* GetDataUseTabModel() const;
79 79
80 // Called by ExternalDataUseObserverBridge::OnReportDataUseDone when a data 80 // Called by ExternalDataUseObserverBridge::OnReportDataUseDone when a data
81 // use report has been submitted. |success| is true if the request was 81 // use report has been submitted. |success| is true if the request was
82 // successfully submitted to the external data use observer by Java. 82 // successfully submitted to the external data use observer by Java.
83 void OnReportDataUseDone(bool success); 83 void OnReportDataUseDone(bool success);
84 84
85 // Called by DataUseMatcher. |should_register| is true if |this| should 85 // Called by ExternalDataUseObserverBridge. |should_register| is true if
86 // register as a data use observer. 86 // |this| should register as a data use observer.
87 void ShouldRegisterAsDataUseObserver(bool should_register); 87 void ShouldRegisterAsDataUseObserver(bool should_register);
88 88
89 // Fetches the matching rules asynchronously. 89 // Fetches the matching rules asynchronously.
90 void FetchMatchingRules(); 90 void FetchMatchingRules();
91 91
92 // Notifies ExternalDataUseObserver that matching rules have been fetched.
93 void OnFetchMatchingRulesDone();
94
92 base::WeakPtr<ExternalDataUseObserver> GetWeakPtr(); 95 base::WeakPtr<ExternalDataUseObserver> GetWeakPtr();
93 96
94 private: 97 private:
95 friend class DataUseTabModelTest; 98 friend class DataUseTabModelTest;
99 friend class DataUseUITabModelTest;
96 friend class ExternalDataUseObserverTest; 100 friend class ExternalDataUseObserverTest;
97 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports);
98 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize);
99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, DataUseReportTimedOut); 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, DataUseReportTimedOut);
100 #if defined(OS_ANDROID) 104 #if defined(OS_ANDROID)
101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
102 DataUseReportingOnApplicationStatusChange); 106 DataUseReportingOnApplicationStatusChange);
103 #endif 107 #endif
104 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction);
105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 base::WeakPtrFactory<ExternalDataUseObserver> weak_factory_; 282 base::WeakPtrFactory<ExternalDataUseObserver> weak_factory_;
279 283
280 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); 284 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver);
281 }; 285 };
282 286
283 } // namespace android 287 } // namespace android
284 288
285 } // namespace chrome 289 } // namespace chrome
286 290
287 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 291 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698