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

Side by Side Diff: chrome/browser/ui/sync/profile_signin_confirmation_helper.cc

Issue 1101593003: [chrome/browser/ui] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build break 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/session_crashed_bubble_view.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/sync/profile_signin_confirmation_helper.h" 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 ProfileSigninConfirmationHelper::ProfileSigninConfirmationHelper( 107 ProfileSigninConfirmationHelper::ProfileSigninConfirmationHelper(
108 Profile* profile, 108 Profile* profile,
109 const base::Callback<void(bool)>& return_result) 109 const base::Callback<void(bool)>& return_result)
110 : profile_(profile), 110 : profile_(profile),
111 pending_requests_(0), 111 pending_requests_(0),
112 return_result_(return_result) { 112 return_result_(return_result) {
113 } 113 }
114 114
115 ProfileSigninConfirmationHelper::~ProfileSigninConfirmationHelper() { 115 ProfileSigninConfirmationHelper::~ProfileSigninConfirmationHelper() {
116 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 116 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
117 } 117 }
118 118
119 void ProfileSigninConfirmationHelper::OnHistoryQueryResults( 119 void ProfileSigninConfirmationHelper::OnHistoryQueryResults(
120 size_t max_entries, 120 size_t max_entries,
121 history::QueryResults* results) { 121 history::QueryResults* results) {
122 history::QueryResults owned_results; 122 history::QueryResults owned_results;
123 results->Swap(&owned_results); 123 results->Swap(&owned_results);
124 bool too_much_history = owned_results.size() >= max_entries; 124 bool too_much_history = owned_results.size() >= max_entries;
125 if (too_much_history) { 125 if (too_much_history) {
126 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains " 126 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains "
(...skipping 30 matching lines...) Expand all
157 return; 157 return;
158 } 158 }
159 service->ScheduleDBTask( 159 service->ScheduleDBTask(
160 scoped_ptr<history::HistoryDBTask>(new HasTypedURLsTask( 160 scoped_ptr<history::HistoryDBTask>(new HasTypedURLsTask(
161 base::Bind(&ProfileSigninConfirmationHelper::ReturnResult, 161 base::Bind(&ProfileSigninConfirmationHelper::ReturnResult,
162 base::Unretained(this)))), 162 base::Unretained(this)))),
163 &task_tracker_); 163 &task_tracker_);
164 } 164 }
165 165
166 void ProfileSigninConfirmationHelper::ReturnResult(bool result) { 166 void ProfileSigninConfirmationHelper::ReturnResult(bool result) {
167 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 167 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
168 // Pass |true| into the callback as soon as one of the tasks passes a 168 // Pass |true| into the callback as soon as one of the tasks passes a
169 // result of |true|, otherwise pass the last returned result. 169 // result of |true|, otherwise pass the last returned result.
170 if (--pending_requests_ == 0 || result) { 170 if (--pending_requests_ == 0 || result) {
171 return_result_.Run(result); 171 return_result_.Run(result);
172 172
173 // This leaks at shutdown if the HistoryService is destroyed, but 173 // This leaks at shutdown if the HistoryService is destroyed, but
174 // the process is going to die anyway. 174 // the process is going to die anyway.
175 delete this; 175 delete this;
176 } 176 }
177 } 177 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 } 223 }
224 } 224 }
225 #endif 225 #endif
226 return false; 226 return false;
227 } 227 }
228 228
229 void CheckShouldPromptForNewProfile( 229 void CheckShouldPromptForNewProfile(
230 Profile* profile, 230 Profile* profile,
231 const base::Callback<void(bool)>& return_result) { 231 const base::Callback<void(bool)>& return_result) {
232 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 232 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
233 233
234 if (HasBeenShutdown(profile) || 234 if (HasBeenShutdown(profile) ||
235 HasBookmarks(profile) || 235 HasBookmarks(profile) ||
236 HasSyncedExtensions(profile)) { 236 HasSyncedExtensions(profile)) {
237 return_result.Run(true); 237 return_result.Run(true);
238 return; 238 return;
239 } 239 }
240 // Fire asynchronous queries for profile data. 240 // Fire asynchronous queries for profile data.
241 ProfileSigninConfirmationHelper* helper = 241 ProfileSigninConfirmationHelper* helper =
242 new ProfileSigninConfirmationHelper(profile, return_result); 242 new ProfileSigninConfirmationHelper(profile, return_result);
243 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); 243 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt);
244 helper->CheckHasTypedURLs(); 244 helper->CheckHasTypedURLs();
245 } 245 }
246 246
247 } // namespace ui 247 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/session_crashed_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698