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

Side by Side Diff: chrome/browser/feedback/feedback_profile_observer.cc

Issue 1097083004: [chrome/browser/e*-i*] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/feedback/feedback_profile_observer.h" 5 #include "chrome/browser/feedback/feedback_profile_observer.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "components/feedback/feedback_report.h" 10 #include "components/feedback/feedback_report.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 FeedbackProfileObserver::~FeedbackProfileObserver() { 34 FeedbackProfileObserver::~FeedbackProfileObserver() {
35 prefs_registrar_.RemoveAll(); 35 prefs_registrar_.RemoveAll();
36 } 36 }
37 37
38 void FeedbackProfileObserver::Observe( 38 void FeedbackProfileObserver::Observe(
39 int type, 39 int type,
40 const content::NotificationSource& source, 40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) { 41 const content::NotificationDetails& details) {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK_CURRENTLY_ON(BrowserThread::UI);
43 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); 43 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type);
44 44
45 Profile* profile = content::Source<Profile>(source).ptr(); 45 Profile* profile = content::Source<Profile>(source).ptr();
46 if (profile && !profile->IsOffTheRecord()) 46 if (profile && !profile->IsOffTheRecord())
47 QueueUnsentReports(profile); 47 QueueUnsentReports(profile);
48 } 48 }
49 49
50 void FeedbackProfileObserver::QueueSingleReport( 50 void FeedbackProfileObserver::QueueSingleReport(
51 feedback::FeedbackUploader* uploader, 51 feedback::FeedbackUploader* uploader,
52 const std::string& data) { 52 const std::string& data) {
53 BrowserThread::PostTask( 53 BrowserThread::PostTask(
54 BrowserThread::UI, FROM_HERE, base::Bind(&FeedbackUploader::QueueReport, 54 BrowserThread::UI, FROM_HERE, base::Bind(&FeedbackUploader::QueueReport,
55 uploader->AsWeakPtr(), data)); 55 uploader->AsWeakPtr(), data));
56 } 56 }
57 57
58 void FeedbackProfileObserver::QueueUnsentReports( 58 void FeedbackProfileObserver::QueueUnsentReports(
59 content::BrowserContext* context) { 59 content::BrowserContext* context) {
60 feedback::FeedbackUploader* uploader = 60 feedback::FeedbackUploader* uploader =
61 feedback::FeedbackUploaderFactory::GetForBrowserContext(context); 61 feedback::FeedbackUploaderFactory::GetForBrowserContext(context);
62 BrowserThread::PostBlockingPoolTask(FROM_HERE, 62 BrowserThread::PostBlockingPoolTask(FROM_HERE,
63 base::Bind( 63 base::Bind(
64 &FeedbackReport::LoadReportsAndQueue, 64 &FeedbackReport::LoadReportsAndQueue,
65 uploader->GetFeedbackReportsPath(), 65 uploader->GetFeedbackReportsPath(),
66 base::Bind(&FeedbackProfileObserver::QueueSingleReport, uploader))); 66 base::Bind(&FeedbackProfileObserver::QueueSingleReport, uploader)));
67 } 67 }
68 68
69 } // namespace feedback 69 } // namespace feedback
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698