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

Unified Diff: chrome/browser/android/data_usage/data_use_matcher.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 nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/android/data_usage/data_use_matcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/data_usage/data_use_matcher.h
diff --git a/chrome/browser/android/data_usage/data_use_matcher.h b/chrome/browser/android/data_usage/data_use_matcher.h
index 9d1a12c9971404bc6ea5dd7924be12edd8a46303..f905ab09678f31ebe84ed314eeb653d994206eb3 100644
--- a/chrome/browser/android/data_usage/data_use_matcher.h
+++ b/chrome/browser/android/data_usage/data_use_matcher.h
@@ -18,7 +18,6 @@
#include "chrome/browser/android/data_usage/data_use_tab_model.h"
namespace base {
-class SingleThreadTaskRunner;
class TickClock;
}
@@ -32,7 +31,7 @@ namespace chrome {
namespace android {
-class ExternalDataUseObserver;
+class ExternalDataUseObserverBridge;
// DataUseMatcher stores the matching URL patterns and package names along with
// the labels. It also provides functionality to get the matching label for a
@@ -41,8 +40,7 @@ class DataUseMatcher {
public:
DataUseMatcher(
const base::WeakPtr<DataUseTabModel>& data_use_tab_model,
- const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
- const base::WeakPtr<ExternalDataUseObserver>& external_data_use_observer,
+ const ExternalDataUseObserverBridge* external_data_use_observer_bridge,
const base::TimeDelta& default_matching_rule_expiration_duration);
~DataUseMatcher();
@@ -67,7 +65,7 @@ class DataUseMatcher {
std::string* label) const WARN_UNUSED_RESULT;
// Fetches the matching rules asynchronously from
- // |external_data_use_observer_|.
+ // |external_data_use_observer_bridge_|.
void FetchMatchingRules();
// Returns true if there is any valid matching rule.
@@ -137,12 +135,13 @@ class DataUseMatcher {
// TickClock used for obtaining the current time.
scoped_ptr<base::TickClock> tick_clock_;
- // |io_task_runner_| is used to call ExternalDataUseObserver methods on
- // IO thread.
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
- // |external_data_use_observer_| is notified when matching rules are fetched.
- base::WeakPtr<ExternalDataUseObserver> external_data_use_observer_;
+ // Pointer to the ExternalDataUseObserverBridge owned by
+ // ExternalDataUseObserver. DataUseTabModel (owner of |this|) and
+ // ExternalDataUseObserverBridge are owned by ExternalDataUseObserver, and are
+ // destroyed in that order. So |external_data_use_observer_bridge_| is
+ // guaranteed to be non-null.
+ const ExternalDataUseObserverBridge* external_data_use_observer_bridge_;
DISALLOW_COPY_AND_ASSIGN(DataUseMatcher);
};
« no previous file with comments | « no previous file | chrome/browser/android/data_usage/data_use_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698