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

Unified Diff: content/browser/loader/loader_globals.cc

Issue 2785523002: Reduce/remove usage of BrowserThread in content/browser/loader. (Closed)
Patch Set: Fix unittests redness Created 3 years, 9 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: content/browser/loader/loader_globals.cc
diff --git a/content/browser/loader/loader_globals.cc b/content/browser/loader/loader_globals.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5cb949de9173fa6404a809633ed1782cc55960d3
--- /dev/null
+++ b/content/browser/loader/loader_globals.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/loader/loader_globals.h"
+#include "base/logging.h"
+
+namespace content {
+
+namespace {
+
+static LoaderGlobals* g_loader_globals;
+
+} // namespace
+
+// static
+LoaderGlobals* LoaderGlobals::Get() {
+ return g_loader_globals;
+}
+
+LoaderGlobals::LoaderGlobals(
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_runner,
+ const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner)
+ : main_thread_task_runner_(main_thread_runner),
+ io_thread_task_runner_(io_thread_runner) {
+ DCHECK(!g_loader_globals);
+ g_loader_globals = this;
+}
+
+LoaderGlobals::~LoaderGlobals() {
+ g_loader_globals = NULL;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698