Chromium Code Reviews| Index: ios/components/io_thread/ios_io_thread.h |
| diff --git a/ios/chrome/browser/ios_chrome_io_thread.h b/ios/components/io_thread/ios_io_thread.h |
| similarity index 85% |
| copy from ios/chrome/browser/ios_chrome_io_thread.h |
| copy to ios/components/io_thread/ios_io_thread.h |
| index bd1207f23153f6e42e64abce79190ef7fcd637ed..edb81bbe809011f46589e6ac35c3127a08c8abf8 100644 |
| --- a/ios/chrome/browser/ios_chrome_io_thread.h |
| +++ b/ios/components/io_thread/ios_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_IOS_IO_THREAD_H_ |
| +#define IOS_COMPONENTS_IO_THREAD_IOS_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 IOSIOThread : public web::WebThreadDelegate { |
| 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 IOSIOThread or be NULL. |
| + IOSIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log); |
| + ~IOSIOThread() 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 IOSIOThread::Init() and |
| + // IOSIOThread::CleanUp() are not called. This allows for injecting mocks |
| + // into IOSIOThread 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: |
| + virtual std::string GetChannelString() const = 0; |
|
Eugene But (OOO till 7-30)
2017/05/26 14:18:09
Sorry for missing earlier. Please add comments des
michaeldo
2017/05/26 17:19:06
No problem, thanks for catching it now! Done.
|
| + |
| + virtual std::unique_ptr<net::NetworkDelegate> GetSystemNetworkDelegate() = 0; |
| + |
| private: |
| // Provide SystemURLRequestContextGetter with access to |
| // InitSystemRequestContext(). |
| @@ -176,14 +181,14 @@ class IOSChromeIOThread : public web::WebThreadDelegate { |
| // SystemURLRequestContextGetter. To be called on IO thread only |
| // after global state has been initialized on the IO thread, and |
| // SystemRequestContext state has been initialized on the UI thread. |
| - void InitSystemRequestContextOnIOThread(); |
| + void InitSystemRequestContextOnIOSIOThread(); |
| void CreateDefaultAuthHandlerFactory(); |
| // Returns an SSLConfigService instance. |
| net::SSLConfigService* GetSSLConfigService(); |
| - void ChangedToOnTheRecordOnIOThread(); |
| + void ChangedToOnTheRecordOnIOSIOThread(); |
|
Eugene But (OOO till 7-30)
2017/05/26 14:18:09
Comments?
michaeldo
2017/05/26 17:19:06
Done.
|
| static net::URLRequestContext* ConstructSystemRequestContext( |
| Globals* globals, |
| @@ -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 IOSIOThread. IOSIOThread owns them all, despite not using |
| + // scoped_ptr. This is because the destructor of IOSIOThread 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 IOSIOThread. |
| 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<IOSIOThread> weak_factory_; |
| - DISALLOW_COPY_AND_ASSIGN(IOSChromeIOThread); |
| + DISALLOW_COPY_AND_ASSIGN(IOSIOThread); |
| }; |
| -#endif // IOS_CHROME_BROWSER_IOS_CHROME_IO_THREAD_H_ |
| +} // namespace io_thread |
| + |
| +#endif // IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_ |