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

Side by Side Diff: chrome_frame/metrics_service.cc

Issue 3850002: Convert LOG(INFO) to VLOG(1) - chrome_frame/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/http_negotiate.cc ('k') | chrome_frame/np_event_listener.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 //------------------------------------------------------------------------------ 6 //------------------------------------------------------------------------------
7 // Description of the life cycle of a instance of MetricsService. 7 // Description of the life cycle of a instance of MetricsService.
8 // 8 //
9 // OVERVIEW 9 // OVERVIEW
10 // 10 //
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // This class provides HTTP request context information for metrics upload 130 // This class provides HTTP request context information for metrics upload
131 // requests initiated by ChromeFrame. 131 // requests initiated by ChromeFrame.
132 class ChromeFrameUploadRequestContext : public URLRequestContext { 132 class ChromeFrameUploadRequestContext : public URLRequestContext {
133 public: 133 public:
134 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) 134 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop)
135 : io_loop_(io_loop) { 135 : io_loop_(io_loop) {
136 Initialize(); 136 Initialize();
137 } 137 }
138 138
139 ~ChromeFrameUploadRequestContext() { 139 ~ChromeFrameUploadRequestContext() {
140 DLOG(INFO) << __FUNCTION__; 140 DVLOG(1) << __FUNCTION__;
141 delete http_transaction_factory_; 141 delete http_transaction_factory_;
142 delete http_auth_handler_factory_; 142 delete http_auth_handler_factory_;
143 } 143 }
144 144
145 void Initialize() { 145 void Initialize() {
146 user_agent_ = http_utils::GetDefaultUserAgent(); 146 user_agent_ = http_utils::GetDefaultUserAgent();
147 user_agent_ = http_utils::AddChromeFrameToUserAgentValue( 147 user_agent_ = http_utils::AddChromeFrameToUserAgentValue(
148 user_agent_); 148 user_agent_);
149 149
150 host_resolver_ = 150 host_resolver_ =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { 212 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
213 if (!io_message_loop_proxy_.get()) { 213 if (!io_message_loop_proxy_.get()) {
214 io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); 214 io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread();
215 } 215 }
216 return io_message_loop_proxy_; 216 return io_message_loop_proxy_;
217 } 217 }
218 218
219 private: 219 private:
220 ~ChromeFrameUploadRequestContextGetter() { 220 ~ChromeFrameUploadRequestContextGetter() {
221 DLOG(INFO) << __FUNCTION__; 221 DVLOG(1) << __FUNCTION__;
222 } 222 }
223 223
224 scoped_refptr<URLRequestContext> context_; 224 scoped_refptr<URLRequestContext> context_;
225 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 225 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
226 MessageLoop* io_loop_; 226 MessageLoop* io_loop_;
227 }; 227 };
228 228
229 // This class provides functionality to upload the ChromeFrame UMA data to the 229 // This class provides functionality to upload the ChromeFrame UMA data to the
230 // server. An instance of this class is created whenever we have data to be 230 // server. An instance of this class is created whenever we have data to be
231 // uploaded to the server. 231 // uploaded to the server.
232 class ChromeFrameMetricsDataUploader 232 class ChromeFrameMetricsDataUploader
233 : public URLFetcher::Delegate, 233 : public URLFetcher::Delegate,
234 public base::RefCountedThreadSafe<ChromeFrameMetricsDataUploader>, 234 public base::RefCountedThreadSafe<ChromeFrameMetricsDataUploader>,
235 public CWindowImpl<ChromeFrameMetricsDataUploader>, 235 public CWindowImpl<ChromeFrameMetricsDataUploader>,
236 public TaskMarshallerThroughWindowsMessages< 236 public TaskMarshallerThroughWindowsMessages<
237 ChromeFrameMetricsDataUploader> { 237 ChromeFrameMetricsDataUploader> {
238 public: 238 public:
239 BEGIN_MSG_MAP(ChromeFrameMetricsDataUploader) 239 BEGIN_MSG_MAP(ChromeFrameMetricsDataUploader)
240 CHAIN_MSG_MAP( 240 CHAIN_MSG_MAP(
241 TaskMarshallerThroughWindowsMessages<ChromeFrameMetricsDataUploader>) 241 TaskMarshallerThroughWindowsMessages<ChromeFrameMetricsDataUploader>)
242 END_MSG_MAP() 242 END_MSG_MAP()
243 243
244 ChromeFrameMetricsDataUploader() 244 ChromeFrameMetricsDataUploader()
245 : fetcher_(NULL) { 245 : fetcher_(NULL) {
246 DLOG(INFO) << __FUNCTION__; 246 DVLOG(1) << __FUNCTION__;
247 creator_thread_id_ = PlatformThread::CurrentId(); 247 creator_thread_id_ = PlatformThread::CurrentId();
248 } 248 }
249 249
250 ~ChromeFrameMetricsDataUploader() { 250 ~ChromeFrameMetricsDataUploader() {
251 DLOG(INFO) << __FUNCTION__; 251 DVLOG(1) << __FUNCTION__;
252 DCHECK(creator_thread_id_ == PlatformThread::CurrentId()); 252 DCHECK(creator_thread_id_ == PlatformThread::CurrentId());
253 } 253 }
254 254
255 virtual void OnFinalMessage(HWND wnd) { 255 virtual void OnFinalMessage(HWND wnd) {
256 Release(); 256 Release();
257 } 257 }
258 258
259 bool Initialize() { 259 bool Initialize() {
260 bool ret = false; 260 bool ret = false;
261 261
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 fetcher_->Start(); 323 fetcher_->Start();
324 } 324 }
325 325
326 // URLFetcher::Delegate 326 // URLFetcher::Delegate
327 virtual void OnURLFetchComplete(const URLFetcher* source, 327 virtual void OnURLFetchComplete(const URLFetcher* source,
328 const GURL& url, 328 const GURL& url,
329 const URLRequestStatus& status, 329 const URLRequestStatus& status,
330 int response_code, 330 int response_code,
331 const ResponseCookies& cookies, 331 const ResponseCookies& cookies,
332 const std::string& data) { 332 const std::string& data) {
333 DLOG(INFO) << __FUNCTION__ 333 DVLOG(1) << __FUNCTION__ << base::StringPrintf(
334 << base::StringPrintf( 334 ": url : %hs, status:%d, response code: %d\n", url.spec().c_str(),
335 ": url : %hs, status:%d, response code: %d\n", 335 status.status(), response_code);
336 url.spec().c_str(), status.status(),
337 response_code);
338 delete fetcher_; 336 delete fetcher_;
339 fetcher_ = NULL; 337 fetcher_ = NULL;
340 338
341 PostTask(FROM_HERE, 339 PostTask(FROM_HERE,
342 NewRunnableMethod(this, 340 NewRunnableMethod(this,
343 &ChromeFrameMetricsDataUploader::Uninitialize)); 341 &ChromeFrameMetricsDataUploader::Uninitialize));
344 } 342 }
345 343
346 private: 344 private:
347 URLFetcher* fetcher_; 345 URLFetcher* fetcher_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 WriteInto(&guid_string, kGUIDSize), kGUIDSize); 440 WriteInto(&guid_string, kGUIDSize), kGUIDSize);
443 DCHECK(result == kGUIDSize); 441 DCHECK(result == kGUIDSize);
444 return WideToUTF8(guid_string.substr(1, guid_string.length() - 2)); 442 return WideToUTF8(guid_string.substr(1, guid_string.length() - 2));
445 } 443 }
446 444
447 // static 445 // static
448 void CALLBACK MetricsService::TransmissionTimerProc(HWND window, 446 void CALLBACK MetricsService::TransmissionTimerProc(HWND window,
449 unsigned int message, 447 unsigned int message,
450 unsigned int event_id, 448 unsigned int event_id,
451 unsigned int time) { 449 unsigned int time) {
452 DLOG(INFO) << "Transmission timer notified"; 450 DVLOG(1) << "Transmission timer notified";
453 DCHECK(GetInstance() != NULL); 451 DCHECK(GetInstance() != NULL);
454 GetInstance()->UploadData(); 452 GetInstance()->UploadData();
455 if (GetInstance()->initial_uma_upload_) { 453 if (GetInstance()->initial_uma_upload_) {
456 // If this is the first uma upload by this process then subsequent uma 454 // If this is the first uma upload by this process then subsequent uma
457 // uploads should occur once every 10 minutes(default). 455 // uploads should occur once every 10 minutes(default).
458 GetInstance()->initial_uma_upload_ = false; 456 GetInstance()->initial_uma_upload_ = false;
459 DCHECK(GetInstance()->transmission_timer_id_ != 0); 457 DCHECK(GetInstance()->transmission_timer_id_ != 0);
460 SetTimer(NULL, GetInstance()->transmission_timer_id_, 458 SetTimer(NULL, GetInstance()->transmission_timer_id_,
461 kMinMilliSecondsPerUMAUpload, 459 kMinMilliSecondsPerUMAUpload,
462 reinterpret_cast<TIMERPROC>(TransmissionTimerProc)); 460 reinterpret_cast<TIMERPROC>(TransmissionTimerProc));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 554 }
557 555
558 bool MetricsService::UploadData() { 556 bool MetricsService::UploadData() {
559 DCHECK_EQ(thread_, PlatformThread::CurrentId()); 557 DCHECK_EQ(thread_, PlatformThread::CurrentId());
560 558
561 if (!GetInstance()->TransmissionPermitted()) 559 if (!GetInstance()->TransmissionPermitted())
562 return false; 560 return false;
563 561
564 static long currently_uploading = 0; 562 static long currently_uploading = 0;
565 if (InterlockedCompareExchange(&currently_uploading, 1, 0)) { 563 if (InterlockedCompareExchange(&currently_uploading, 1, 0)) {
566 DLOG(INFO) << "Contention for uploading metrics data. Backing off"; 564 DVLOG(1) << "Contention for uploading metrics data. Backing off";
567 return false; 565 return false;
568 } 566 }
569 567
570 std::string pending_log_text = PrepareLogSubmissionString(); 568 std::string pending_log_text = PrepareLogSubmissionString();
571 DCHECK(!pending_log_text.empty()); 569 DCHECK(!pending_log_text.empty());
572 570
573 // Allow security conscious users to see all metrics logs that we send. 571 // Allow security conscious users to see all metrics logs that we send.
574 LOG(INFO) << "METRICS LOG: " << pending_log_text; 572 VLOG(1) << "METRICS LOG: " << pending_log_text;
575 573
576 bool ret = true; 574 bool ret = true;
577 575
578 if (!Bzip2Compress(pending_log_text, &compressed_log_)) { 576 if (!Bzip2Compress(pending_log_text, &compressed_log_)) {
579 NOTREACHED() << "Failed to compress log for transmission."; 577 NOTREACHED() << "Failed to compress log for transmission.";
580 ret = false; 578 ret = false;
581 } else { 579 } else {
582 HRESULT hr = ChromeFrameMetricsDataUploader::UploadDataHelper( 580 HRESULT hr = ChromeFrameMetricsDataUploader::UploadDataHelper(
583 compressed_log_); 581 compressed_log_);
584 DCHECK(SUCCEEDED(hr)); 582 DCHECK(SUCCEEDED(hr));
(...skipping 14 matching lines...) Expand all
599 version += "-F"; 597 version += "-F";
600 if (!version_info.IsOfficialBuild()) 598 if (!version_info.IsOfficialBuild())
601 version.append("-devel"); 599 version.append("-devel");
602 return version; 600 return version;
603 } else { 601 } else {
604 NOTREACHED() << "Unable to retrieve version string."; 602 NOTREACHED() << "Unable to retrieve version string.";
605 } 603 }
606 604
607 return std::string(); 605 return std::string();
608 } 606 }
OLDNEW
« no previous file with comments | « chrome_frame/http_negotiate.cc ('k') | chrome_frame/np_event_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698