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

Unified Diff: components/cronet/ios/cronet_environment.mm

Issue 2836063005: [cronet] Add mechanism for restarting CronetEnvironment (Closed)
Patch Set: per #21 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/ios/cronet_environment.mm
diff --git a/components/cronet/ios/cronet_environment.mm b/components/cronet/ios/cronet_environment.mm
index 651af1dc9cb8800b204b276596333a674c432260..17e72612ba145b5fb7954c4ef8bc2104e3d7dea7 100644
--- a/components/cronet/ios/cronet_environment.mm
+++ b/components/cronet/ios/cronet_environment.mm
@@ -251,12 +251,17 @@ void CronetEnvironment::Start() {
CronetEnvironment::~CronetEnvironment() {
// net::HTTPProtocolHandlerDelegate::SetInstance(nullptr);
- // TODO(lilyhoughton) right now this is relying on there being
- // only one CronetEnvironment (per process). if (when?) that
- // changes, so will this have to.
- base::TaskScheduler* ts = base::TaskScheduler::GetInstance();
- if (ts)
- ts->Shutdown();
+ // TODO(lilyhoughton) this can only be run once, so right now leaking it.
+ // Should be be called when the _last_ CronetEnvironment is destroyed.
+ // base::TaskScheduler* ts = base::TaskScheduler::GetInstance();
+ // if (ts)
+ // ts->Shutdown();
+
+ // TODO(lilyhoughton) this should be smarter about making sure there are no
+ // pending requests, etc.
+
+ network_io_thread_->task_runner().get()->DeleteSoon(FROM_HERE,
+ main_context_.release());
}
void CronetEnvironment::InitializeOnNetworkThread() {

Powered by Google App Engine
This is Rietveld 408576698