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

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

Issue 2639673002: Fix null TaskScheduler dereference introduced by codereview.chromium.org/2608093002 (Closed)
Patch Set: add call to `TaskScheduler::Shutdown()` Created 3 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/ios/cronet_environment.mm
diff --git a/components/cronet/ios/cronet_environment.mm b/components/cronet/ios/cronet_environment.mm
index 03f36dd71d260cf001a662f8a05a5d4d00765468..eb4137869c697ba73962e931db899bdeaeb898da 100644
--- a/components/cronet/ios/cronet_environment.mm
+++ b/components/cronet/ios/cronet_environment.mm
@@ -22,6 +22,8 @@
#include "base/path_service.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
+#include "base/sys_info.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/worker_pool.h"
#include "components/cronet/histogram_manager.h"
#include "components/cronet/ios/version.h"
@@ -117,6 +119,9 @@ void CronetEnvironment::Initialize() {
if (!g_at_exit_)
g_at_exit_ = new base::AtExitManager;
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(
+ base::SysInfo::NumberOfProcessors());
+
url::Initialize();
base::CommandLine::Init(0, nullptr);
@@ -246,6 +251,13 @@ 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();
}
void CronetEnvironment::InitializeOnNetworkThread() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698