Index: chrome/browser/profiles/profile_impl_io_data.cc |
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc |
index 6f1c2a1dda2e2d9737260e8573e110986240c3c2..d530d9622af2320905641cd37d39999964fd981a 100644 |
--- a/chrome/browser/profiles/profile_impl_io_data.cc |
+++ b/chrome/browser/profiles/profile_impl_io_data.cc |
@@ -65,6 +65,13 @@ |
#include "net/url_request/url_request_job_factory_impl.h" |
#include "storage/browser/quota/special_storage_policy.h" |
+#if defined(OS_ANDROID) |
+#include "chrome/browser/android/data_usage/data_use_tab_model.h" |
+#include "chrome/browser/android/data_usage/data_use_ui_tab_model.h" |
+#include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h" |
+#include "chrome/browser/android/data_usage/external_data_use_observer.h" |
+#endif // defined(OS_ANDROID) |
+ |
namespace { |
net::BackendType ChooseCacheBackendType() { |
@@ -226,6 +233,15 @@ ProfileImplIOData::Handle::CreateMainRequestContextGetter( |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
LazyInitialize(); |
DCHECK(!main_request_context_getter_.get()); |
+ |
+#if defined(OS_ANDROID) |
+ // Pass the DataUseTabModel weak pointer to DataUseUITabModel. |
sclittle
2015/11/24 04:11:51
CreateMainRequestContextGetter seems like the wron
tbansal1
2015/11/24 20:01:12
Good point. Moved to Init(). Also, added checks in
|
+ chrome::android::DataUseUITabModel* data_use_ui_tab_model = |
+ chrome::android::DataUseUITabModelFactory::GetForBrowserContext(profile_); |
+ if (data_use_ui_tab_model && !io_data_->IsOffTheRecord()) |
+ data_use_ui_tab_model->SetIOThread(io_thread); |
sclittle
2015/11/24 04:11:51
Could you move the anonymous function to get the W
tbansal1
2015/11/24 20:01:12
Now, storing the weak ptr in IO thread to reduce t
|
+#endif // defined(OS_ANDROID) |
+ |
main_request_context_getter_ = ChromeURLRequestContextGetter::Create( |
profile_, io_data_, protocol_handlers, request_interceptors.Pass()); |