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

Unified Diff: ios/chrome/browser/ios_chrome_io_thread.mm

Issue 2170103002: Notify SystemURLRequestContextGetter before shutdown on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Few more 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ios_chrome_io_thread.h ('k') | ios/chrome/browser/ios_chrome_io_thread_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ios_chrome_io_thread.mm
diff --git a/ios/chrome/browser/ios_chrome_io_thread.mm b/ios/chrome/browser/ios_chrome_io_thread.mm
index 22fc9c5d63ea76b7f38680d87d3bf72ead16e01d..3668e0aeb0a616b28e42d6067c22f382ed0cce40 100644
--- a/ios/chrome/browser/ios_chrome_io_thread.mm
+++ b/ios/chrome/browser/ios_chrome_io_thread.mm
@@ -205,12 +205,14 @@ class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
const override;
+ // Tells the getter that the URLRequestContext is about to be shut down.
+ void Shutdown();
+
protected:
~SystemURLRequestContextGetter() override;
private:
- IOSChromeIOThread* const
- io_thread_; // Weak pointer, owned by ApplicationContext.
+ IOSChromeIOThread* io_thread_; // Weak pointer, owned by ApplicationContext.
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_;
@@ -226,6 +228,8 @@ SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {}
net::URLRequestContext* SystemURLRequestContextGetter::GetURLRequestContext() {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
+ if (!io_thread_)
+ return nullptr;
DCHECK(io_thread_->globals()->system_request_context.get());
return io_thread_->globals()->system_request_context.get();
@@ -236,6 +240,12 @@ SystemURLRequestContextGetter::GetNetworkTaskRunner() const {
return network_task_runner_;
}
+void SystemURLRequestContextGetter::Shutdown() {
+ DCHECK_CURRENTLY_ON(web::WebThread::IO);
+ io_thread_ = nullptr;
+ NotifyContextShuttingDown();
+}
+
IOSChromeIOThread::Globals::SystemRequestContextLeakChecker::
SystemRequestContextLeakChecker(Globals* globals)
: globals_(globals) {
@@ -423,6 +433,7 @@ void IOSChromeIOThread::Init() {
}
void IOSChromeIOThread::CleanUp() {
+ system_url_request_context_getter_->Shutdown();
system_url_request_context_getter_ = nullptr;
// Release objects that the net::URLRequestContext could have been pointing
« no previous file with comments | « ios/chrome/browser/ios_chrome_io_thread.h ('k') | ios/chrome/browser/ios_chrome_io_thread_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698