| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is created at ChromeFrame startup in | 10 // A MetricsService instance is created at ChromeFrame startup in |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // appropriate location. | 126 // appropriate location. |
| 127 base::LazyInstance<base::Thread, UploadThreadInstanceTraits> | 127 base::LazyInstance<base::Thread, UploadThreadInstanceTraits> |
| 128 g_metrics_upload_thread_(base::LINKER_INITIALIZED); | 128 g_metrics_upload_thread_(base::LINKER_INITIALIZED); |
| 129 | 129 |
| 130 Lock g_metrics_service_lock; | 130 Lock g_metrics_service_lock; |
| 131 | 131 |
| 132 extern base::LazyInstance<base::StatisticsRecorder> g_statistics_recorder_; | 132 extern base::LazyInstance<base::StatisticsRecorder> g_statistics_recorder_; |
| 133 | 133 |
| 134 // This class provides HTTP request context information for metrics upload | 134 // This class provides HTTP request context information for metrics upload |
| 135 // requests initiated by ChromeFrame. | 135 // requests initiated by ChromeFrame. |
| 136 class ChromeFrameUploadRequestContext : public URLRequestContext { | 136 class ChromeFrameUploadRequestContext : public net::URLRequestContext { |
| 137 public: | 137 public: |
| 138 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) | 138 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) |
| 139 : io_loop_(io_loop) { | 139 : io_loop_(io_loop) { |
| 140 Initialize(); | 140 Initialize(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 ~ChromeFrameUploadRequestContext() { | 143 ~ChromeFrameUploadRequestContext() { |
| 144 DVLOG(1) << __FUNCTION__; | 144 DVLOG(1) << __FUNCTION__; |
| 145 delete http_transaction_factory_; | 145 delete http_transaction_factory_; |
| 146 delete http_auth_handler_factory_; | 146 delete http_auth_handler_factory_; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 scoped_ptr<net::URLSecurityManager> url_security_manager_; | 203 scoped_ptr<net::URLSecurityManager> url_security_manager_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 // This class provides an interface to retrieve the URL request context for | 206 // This class provides an interface to retrieve the URL request context for |
| 207 // metrics HTTP upload requests initiated by ChromeFrame. | 207 // metrics HTTP upload requests initiated by ChromeFrame. |
| 208 class ChromeFrameUploadRequestContextGetter : public URLRequestContextGetter { | 208 class ChromeFrameUploadRequestContextGetter : public URLRequestContextGetter { |
| 209 public: | 209 public: |
| 210 explicit ChromeFrameUploadRequestContextGetter(MessageLoop* io_loop) | 210 explicit ChromeFrameUploadRequestContextGetter(MessageLoop* io_loop) |
| 211 : io_loop_(io_loop) {} | 211 : io_loop_(io_loop) {} |
| 212 | 212 |
| 213 virtual URLRequestContext* GetURLRequestContext() { | 213 virtual net::URLRequestContext* GetURLRequestContext() { |
| 214 if (!context_) | 214 if (!context_) |
| 215 context_ = new ChromeFrameUploadRequestContext(io_loop_); | 215 context_ = new ChromeFrameUploadRequestContext(io_loop_); |
| 216 return context_; | 216 return context_; |
| 217 } | 217 } |
| 218 | 218 |
| 219 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { | 219 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { |
| 220 if (!io_message_loop_proxy_.get()) { | 220 if (!io_message_loop_proxy_.get()) { |
| 221 io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); | 221 io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); |
| 222 } | 222 } |
| 223 return io_message_loop_proxy_; | 223 return io_message_loop_proxy_; |
| 224 } | 224 } |
| 225 | 225 |
| 226 private: | 226 private: |
| 227 ~ChromeFrameUploadRequestContextGetter() { | 227 ~ChromeFrameUploadRequestContextGetter() { |
| 228 DVLOG(1) << __FUNCTION__; | 228 DVLOG(1) << __FUNCTION__; |
| 229 } | 229 } |
| 230 | 230 |
| 231 scoped_refptr<URLRequestContext> context_; | 231 scoped_refptr<net::URLRequestContext> context_; |
| 232 mutable scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 232 mutable scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 233 MessageLoop* io_loop_; | 233 MessageLoop* io_loop_; |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 // This class provides functionality to upload the ChromeFrame UMA data to the | 236 // This class provides functionality to upload the ChromeFrame UMA data to the |
| 237 // server. An instance of this class is created whenever we have data to be | 237 // server. An instance of this class is created whenever we have data to be |
| 238 // uploaded to the server. | 238 // uploaded to the server. |
| 239 class ChromeFrameMetricsDataUploader | 239 class ChromeFrameMetricsDataUploader |
| 240 : public URLFetcher::Delegate, | 240 : public URLFetcher::Delegate, |
| 241 public base::RefCountedThreadSafe<ChromeFrameMetricsDataUploader>, | 241 public base::RefCountedThreadSafe<ChromeFrameMetricsDataUploader>, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 version += "-F"; | 615 version += "-F"; |
| 616 if (!version_info.IsOfficialBuild()) | 616 if (!version_info.IsOfficialBuild()) |
| 617 version.append("-devel"); | 617 version.append("-devel"); |
| 618 return version; | 618 return version; |
| 619 } else { | 619 } else { |
| 620 NOTREACHED() << "Unable to retrieve version string."; | 620 NOTREACHED() << "Unable to retrieve version string."; |
| 621 } | 621 } |
| 622 | 622 |
| 623 return std::string(); | 623 return std::string(); |
| 624 } | 624 } |
| OLD | NEW |