| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef CHROME_BROWSER_IO_THREAD_H_ | 5 #ifndef CHROME_BROWSER_IO_THREAD_H_ | 
| 6 #define CHROME_BROWSER_IO_THREAD_H_ | 6 #define CHROME_BROWSER_IO_THREAD_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <set> | 9 #include <set> | 
| 10 | 10 | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32 class ProxyScriptFetcher; | 32 class ProxyScriptFetcher; | 
| 33 class URLSecurityManager; | 33 class URLSecurityManager; | 
| 34 }  // namespace net | 34 }  // namespace net | 
| 35 | 35 | 
| 36 class IOThread : public BrowserProcessSubThread { | 36 class IOThread : public BrowserProcessSubThread { | 
| 37  public: | 37  public: | 
| 38   struct Globals { | 38   struct Globals { | 
| 39     Globals(); | 39     Globals(); | 
| 40     ~Globals(); | 40     ~Globals(); | 
| 41 | 41 | 
| 42     scoped_ptr<ChromeNetLog> net_log; |  | 
| 43     scoped_ptr<net::HostResolver> host_resolver; | 42     scoped_ptr<net::HostResolver> host_resolver; | 
| 44     scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 43     scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 
| 45     scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 44     scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 
| 46     scoped_ptr<net::URLSecurityManager> url_security_manager; | 45     scoped_ptr<net::URLSecurityManager> url_security_manager; | 
| 47     ChromeNetworkDelegate network_delegate; | 46     ChromeNetworkDelegate network_delegate; | 
| 48   }; | 47   }; | 
| 49 | 48 | 
| 50   IOThread(); | 49   // |net_log| must either outlive the IOThread or be NULL. | 
|  | 50   explicit IOThread(ChromeNetLog* net_log); | 
| 51 | 51 | 
| 52   virtual ~IOThread(); | 52   virtual ~IOThread(); | 
| 53 | 53 | 
| 54   // Can only be called on the IO thread. | 54   // Can only be called on the IO thread. | 
| 55   Globals* globals(); | 55   Globals* globals(); | 
| 56 | 56 | 
|  | 57   ChromeNetLog* net_log(); | 
|  | 58 | 
| 57   // Initializes the network predictor, which induces DNS pre-resolution and/or | 59   // Initializes the network predictor, which induces DNS pre-resolution and/or | 
| 58   // TCP/IP preconnections.  |prefetching_enabled| indicates whether or not DNS | 60   // TCP/IP preconnections.  |prefetching_enabled| indicates whether or not DNS | 
| 59   // prefetching should be enabled, and |preconnect_enabled| controls whether | 61   // prefetching should be enabled, and |preconnect_enabled| controls whether | 
| 60   // TCP/IP preconnection is enabled.  This should be called by the UI thread. | 62   // TCP/IP preconnection is enabled.  This should be called by the UI thread. | 
| 61   // It will post a task to the IO thread to perform the actual initialization. | 63   // It will post a task to the IO thread to perform the actual initialization. | 
| 62   void InitNetworkPredictor(bool prefetching_enabled, | 64   void InitNetworkPredictor(bool prefetching_enabled, | 
| 63                             base::TimeDelta max_dns_queue_delay, | 65                             base::TimeDelta max_dns_queue_delay, | 
| 64                             size_t max_speculative_parallel_resolves, | 66                             size_t max_speculative_parallel_resolves, | 
| 65                             const chrome_common_net::UrlList& startup_urls, | 67                             const chrome_common_net::UrlList& startup_urls, | 
| 66                             ListValue* referral_list, | 68                             ListValue* referral_list, | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 95       size_t max_speculative_parallel_resolves, | 97       size_t max_speculative_parallel_resolves, | 
| 96       const chrome_common_net::UrlList& startup_urls, | 98       const chrome_common_net::UrlList& startup_urls, | 
| 97       ListValue* referral_list, | 99       ListValue* referral_list, | 
| 98       bool preconnect_enabled); | 100       bool preconnect_enabled); | 
| 99 | 101 | 
| 100   void ChangedToOnTheRecordOnIOThread(); | 102   void ChangedToOnTheRecordOnIOThread(); | 
| 101 | 103 | 
| 102   // These member variables are basically global, but their lifetimes are tied | 104   // These member variables are basically global, but their lifetimes are tied | 
| 103   // to the IOThread.  IOThread owns them all, despite not using scoped_ptr. | 105   // to the IOThread.  IOThread owns them all, despite not using scoped_ptr. | 
| 104   // This is because the destructor of IOThread runs on the wrong thread.  All | 106   // This is because the destructor of IOThread runs on the wrong thread.  All | 
| 105   // member variables should be deleted in CleanUp(), except ChromeNetLog | 107   // member variables should be deleted in CleanUp(). | 
| 106   // which is deleted later in CleanUpAfterMessageLoopDestruction(). |  | 
| 107 | 108 | 
| 108   // These member variables are initialized in Init() and do not change for the | 109   // These member variables are initialized in Init() and do not change for the | 
| 109   // lifetime of the IO thread. | 110   // lifetime of the IO thread. | 
| 110 | 111 | 
| 111   Globals* globals_; | 112   Globals* globals_; | 
| 112 | 113 | 
| 113   // This variable is only meaningful during shutdown. It is used to defer |  | 
| 114   // deletion of the NetLog to CleanUpAfterMessageLoopDestruction() even |  | 
| 115   // though |globals_| is reset by CleanUp(). |  | 
| 116   scoped_ptr<ChromeNetLog> deferred_net_log_to_delete_; |  | 
| 117 |  | 
| 118   // Observer that logs network changes to the ChromeNetLog. | 114   // Observer that logs network changes to the ChromeNetLog. | 
| 119   scoped_ptr<net::NetworkChangeNotifier::Observer> network_change_observer_; | 115   scoped_ptr<net::NetworkChangeNotifier::Observer> network_change_observer_; | 
| 120 | 116 | 
| 121   // These member variables are initialized by a task posted to the IO thread, | 117   // These member variables are initialized by a task posted to the IO thread, | 
| 122   // which gets posted by calling certain member functions of IOThread. | 118   // which gets posted by calling certain member functions of IOThread. | 
| 123 | 119 | 
| 124   // Note: we user explicit pointers rather than smart pointers to be more | 120   // Note: we user explicit pointers rather than smart pointers to be more | 
| 125   // explicit about destruction order, and ensure that there is no chance that | 121   // explicit about destruction order, and ensure that there is no chance that | 
| 126   // these observers would be used accidentally after we have begun to tear | 122   // these observers would be used accidentally after we have begun to tear | 
| 127   // down. | 123   // down. | 
| 128   chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | 124   chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | 
| 129   chrome_browser_net::Predictor* predictor_; | 125   chrome_browser_net::Predictor* predictor_; | 
| 130 | 126 | 
| 131   // List of live ProxyScriptFetchers. | 127   // List of live ProxyScriptFetchers. | 
| 132   ProxyScriptFetchers fetchers_; | 128   ProxyScriptFetchers fetchers_; | 
| 133 | 129 | 
|  | 130   // The NetLog is owned by the browser process, to allow logging from other | 
|  | 131   // threads during shutdown, but is used most frequently on the IOThread. | 
|  | 132   ChromeNetLog* net_log_; | 
|  | 133 | 
| 134   DISALLOW_COPY_AND_ASSIGN(IOThread); | 134   DISALLOW_COPY_AND_ASSIGN(IOThread); | 
| 135 }; | 135 }; | 
| 136 | 136 | 
| 137 #endif  // CHROME_BROWSER_IO_THREAD_H_ | 137 #endif  // CHROME_BROWSER_IO_THREAD_H_ | 
| OLD | NEW | 
|---|