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

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

Issue 2834463005: Fix race with google variation ID registration (Closed)
Patch Set: rebased Created 3 years, 8 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_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // installed or uninstalled. |is_control_app_installed| is true if app is 91 // installed or uninstalled. |is_control_app_installed| is true if app is
92 // installed. 92 // installed.
93 void OnControlAppInstallStateChange(JNIEnv* env, 93 void OnControlAppInstallStateChange(JNIEnv* env,
94 jobject obj, 94 jobject obj,
95 bool is_control_app_installed) const; 95 bool is_control_app_installed) const;
96 96
97 // Called by DataUseMatcher to notify |external_data_use_observer_| if it 97 // Called by DataUseMatcher to notify |external_data_use_observer_| if it
98 // should register as a data use observer. 98 // should register as a data use observer.
99 virtual void ShouldRegisterAsDataUseObserver(bool should_register) const; 99 virtual void ShouldRegisterAsDataUseObserver(bool should_register) const;
100 100
101 void SetRegisterGoogleVariationID(bool register_google_variation_id); 101 void RegisterGoogleVariationID(bool should_register);
102 102
103 private: 103 private:
104 // Java listener that provides regular expressions to |this|. Data use 104 // Java listener that provides regular expressions to |this|. Data use
105 // reports are submitted to |j_external_data_use_observer_|. 105 // reports are submitted to |j_external_data_use_observer_|.
106 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_; 106 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_;
107 107
108 // |external_data_use_observer_| owns |this|. |external_data_use_observer_| is 108 // |external_data_use_observer_| owns |this|. |external_data_use_observer_| is
109 // notified of results from Java code by |this|. 109 // notified of results from Java code by |this|.
110 base::WeakPtr<ExternalDataUseObserver> external_data_use_observer_; 110 base::WeakPtr<ExternalDataUseObserver> external_data_use_observer_;
111 111
112 // |data_use_tab_model_| is notified of the matching rules on UI thread. 112 // |data_use_tab_model_| is notified of the matching rules on UI thread.
113 // |data_use_tab_model_| may be null. 113 // |data_use_tab_model_| may be null.
114 base::WeakPtr<DataUseTabModel> data_use_tab_model_; 114 base::WeakPtr<DataUseTabModel> data_use_tab_model_;
115 115
116 // The construction time of |this|. 116 // The construction time of |this|.
117 const base::TimeTicks construct_time_; 117 const base::TimeTicks construct_time_;
118 118
119 // True if matching rules are fetched for the first time. 119 // True if matching rules are fetched for the first time.
120 bool is_first_matching_rule_fetch_; 120 bool is_first_matching_rule_fetch_;
121 121
122 // True if Google variation ID should be registered.
123 bool register_google_variation_id_;
124
125 // |io_task_runner_| accesses ExternalDataUseObserver members on IO thread. 122 // |io_task_runner_| accesses ExternalDataUseObserver members on IO thread.
126 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 123 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
127 124
128 base::ThreadChecker thread_checker_; 125 base::ThreadChecker thread_checker_;
129 126
130 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserverBridge); 127 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserverBridge);
131 }; 128 };
132 129
133 bool RegisterExternalDataUseObserver(JNIEnv* env); 130 bool RegisterExternalDataUseObserver(JNIEnv* env);
134 131
135 } // namespace android 132 } // namespace android
136 133
137 } // namespace chrome 134 } // namespace chrome
138 135
139 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H _ 136 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698