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

Unified Diff: ios/components/io_thread/io_thread.h

Issue 2908613002: Move common functionality of IOSChromeIOThread to ios/components. (Closed)
Patch Set: Remove bug todo. Created 3 years, 7 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: ios/components/io_thread/io_thread.h
diff --git a/ios/chrome/browser/ios_chrome_io_thread.h b/ios/components/io_thread/io_thread.h
similarity index 86%
copy from ios/chrome/browser/ios_chrome_io_thread.h
copy to ios/components/io_thread/io_thread.h
index bd1207f23153f6e42e64abce79190ef7fcd637ed..37e2776c4b2ed44e6bc430891f3ed6167c4bc848 100644
--- a/ios/chrome/browser/ios_chrome_io_thread.h
+++ b/ios/components/io_thread/io_thread.h
@@ -1,9 +1,9 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 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.
-#ifndef IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
-#define IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
+#ifndef IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_
+#define IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_
#include <stddef.h>
#include <stdint.h>
@@ -27,7 +27,6 @@
class PrefProxyConfigTracker;
class PrefService;
-class SystemURLRequestContextGetter;
namespace net {
class CTPolicyEnforcer;
@@ -56,6 +55,8 @@ namespace net_log {
class ChromeNetLog;
} // namespace net_log
+namespace io_thread {
+
class SystemURLRequestContextGetter;
// Contains state associated with, initialized and cleaned up on, and
@@ -63,7 +64,7 @@ class SystemURLRequestContextGetter;
//
// If you are looking to interact with the IO thread (e.g. post tasks
// to it or check if it is the current thread), see web::WebThread.
-class IOSChromeIOThread : public web::WebThreadDelegate {
+class IOThread : public web::WebThreadDelegate {
Eugene But (OOO till 7-30) 2017/05/25 22:05:22 Should this be IOSIOThread?
michaeldo 2017/05/26 07:24:43 I think IOSIOThread makes sense. Updated.
public:
struct Globals {
template <typename T>
@@ -127,17 +128,16 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer;
};
- // |net_log| must either outlive the IOSChromeIOThread or be NULL.
- IOSChromeIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log);
-
- ~IOSChromeIOThread() override;
+ // |net_log| must either outlive the IOThread or be NULL.
+ IOThread(PrefService* local_state, net_log::ChromeNetLog* net_log);
+ ~IOThread() override;
// Can only be called on the IO thread.
Globals* globals();
- // Allows overriding Globals in tests where IOSChromeIOThread::Init() and
- // IOSChromeIOThread::CleanUp() are not called. This allows for injecting
- // mocks into IOSChromeIOThread global objects.
+ // Allows overriding Globals in tests where IOThread::Init() and
+ // IOThread::CleanUp() are not called. This allows for injecting mocks into
+ // IOThread global objects.
void SetGlobalsForTesting(Globals* globals);
net_log::ChromeNetLog* net_log();
@@ -157,6 +157,11 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
base::TimeTicks creation_time() const;
+ protected:
+ std::string GetChannelString();
Eugene But (OOO till 7-30) 2017/05/25 22:05:21 Should this be virtual and const? Otherwise subcla
michaeldo 2017/05/26 07:24:43 Done.
+
+ virtual std::unique_ptr<net::NetworkDelegate> GetSystemNetworkDelegate() = 0;
+
private:
// Provide SystemURLRequestContextGetter with access to
// InitSystemRequestContext().
@@ -195,9 +200,9 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
net_log::ChromeNetLog* net_log_;
// These member variables are basically global, but their lifetimes are tied
- // to the IOSChromeIOThread. IOSChromeIOThread owns them all, despite not
- // using scoped_ptr. This is because the destructor of IOSChromeIOThread runs
- // on the wrong thread. All member variables should be deleted in CleanUp().
+ // to the IOThread. IOThread owns them all, despite not using
+ // scoped_ptr. This is because the destructor of IOThread runs on the
+ // wrong thread. All member variables should be deleted in CleanUp().
// These member variables are initialized in Init() and do not change for the
// lifetime of the IO thread.
@@ -216,7 +221,7 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
ssl_config_service_manager_;
// These member variables are initialized by a task posted to the IO thread,
- // which gets posted by calling certain member functions of IOSChromeIOThread.
+ // which gets posted by calling certain member functions of IOThread.
std::unique_ptr<net::ProxyConfigService> system_proxy_config_service_;
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
@@ -226,9 +231,11 @@ class IOSChromeIOThread : public web::WebThreadDelegate {
const base::TimeTicks creation_time_;
- base::WeakPtrFactory<IOSChromeIOThread> weak_factory_;
+ base::WeakPtrFactory<IOThread> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(IOSChromeIOThread);
+ DISALLOW_COPY_AND_ASSIGN(IOThread);
};
-#endif // IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_
+} // namespace io_thread
+
+#endif // IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_

Powered by Google App Engine
This is Rietveld 408576698