Commit 5893b13b authored by anujk.sharma's avatar anujk.sharma Committed by Commit bot

favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/profile_resetter

BUG=466848

Review URL: https://codereview.chromium.org/1107863002

Cr-Commit-Position: refs/heads/master@{#327250}
parent fb3e2efd
......@@ -218,7 +218,7 @@ class AutomaticProfileResetter::InputBuilder
// Called back by |memento_in_file_| once the |memento_value| has been read.
void IncludeFileBasedMementoCallback(const std::string& memento_value) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
data_->SetString(kMementoValueInFileKey, memento_value);
// As an asynchronous task, we need to take care of posting the next task.
PostNextTask();
......@@ -382,7 +382,7 @@ AutomaticProfileResetter::AutomaticProfileResetter(Profile* profile)
AutomaticProfileResetter::~AutomaticProfileResetter() {}
void AutomaticProfileResetter::Initialize() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_UNINITIALIZED);
if (!ShouldPerformDryRun() && !ShouldPerformLiveRun()) {
......@@ -415,7 +415,7 @@ void AutomaticProfileResetter::Initialize() {
}
void AutomaticProfileResetter::Activate() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(state_ == STATE_INITIALIZED || state_ == STATE_DISABLED);
if (state_ == STATE_INITIALIZED) {
......@@ -435,7 +435,7 @@ void AutomaticProfileResetter::Activate() {
}
void AutomaticProfileResetter::TriggerProfileReset(bool send_feedback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_HAS_SHOWN_BUBBLE);
state_ = STATE_PERFORMING_RESET;
......@@ -449,7 +449,7 @@ void AutomaticProfileResetter::TriggerProfileReset(bool send_feedback) {
}
void AutomaticProfileResetter::SkipProfileReset() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_HAS_SHOWN_BUBBLE);
should_show_reset_banner_ = false;
......@@ -465,12 +465,12 @@ bool AutomaticProfileResetter::IsResetPromptFlowActive() const {
}
bool AutomaticProfileResetter::ShouldShowResetBanner() const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return should_show_reset_banner_ && ShouldPerformLiveRun();
}
void AutomaticProfileResetter::NotifyDidShowResetBubble() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_HAS_TRIGGERED_PROMPT);
state_ = STATE_HAS_SHOWN_BUBBLE;
......@@ -480,7 +480,7 @@ void AutomaticProfileResetter::NotifyDidShowResetBubble() {
}
void AutomaticProfileResetter::NotifyDidOpenWebUIResetDialog() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// This notification is invoked unconditionally by the WebUI, only care about
// it when the prompt flow is currently active (and not yet resetting).
......@@ -493,7 +493,7 @@ void AutomaticProfileResetter::NotifyDidOpenWebUIResetDialog() {
void AutomaticProfileResetter::NotifyDidCloseWebUIResetDialog(
bool performed_reset) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// This notification is invoked unconditionally by the WebUI, only care about
// it when the prompt flow is currently active (and not yet resetting).
......@@ -516,7 +516,7 @@ void AutomaticProfileResetter::NotifyDidCloseWebUIResetDialog(
}
void AutomaticProfileResetter::NotifyDidCloseWebUIResetBanner() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
should_show_reset_banner_ = false;
}
......@@ -541,7 +541,7 @@ void AutomaticProfileResetter::SetTaskRunnerForWaitingForTesting(
}
void AutomaticProfileResetter::Shutdown() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// We better not do anything substantial at this point. The metrics service
// has already been shut down; and local state has already been commited to
......@@ -554,7 +554,7 @@ void AutomaticProfileResetter::Shutdown() {
}
void AutomaticProfileResetter::PrepareEvaluationFlow() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_INITIALIZED);
state_ = STATE_WAITING_ON_DEPENDENCIES;
......@@ -580,7 +580,7 @@ void AutomaticProfileResetter::OnLoadedModulesAreEnumerated() {
}
void AutomaticProfileResetter::OnDependencyIsReady() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_WAITING_ON_DEPENDENCIES);
if (template_url_service_ready_ && enumeration_of_loaded_modules_ready_) {
......@@ -594,7 +594,7 @@ void AutomaticProfileResetter::OnDependencyIsReady() {
}
void AutomaticProfileResetter::BeginEvaluationFlow() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_READY);
DCHECK(!program_.empty());
DCHECK(!input_builder_);
......@@ -609,7 +609,7 @@ void AutomaticProfileResetter::BeginEvaluationFlow() {
void AutomaticProfileResetter::ContinueWithEvaluationFlow(
scoped_ptr<base::DictionaryValue> program_input) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS);
input_builder_.reset();
......@@ -686,7 +686,7 @@ void AutomaticProfileResetter::ReportStatistics(uint32 satisfied_criteria_mask,
void AutomaticProfileResetter::FinishEvaluationFlow(
scoped_ptr<EvaluationResults> results) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS);
ReportStatistics(results->satisfied_criteria_mask,
......@@ -704,7 +704,7 @@ void AutomaticProfileResetter::FinishEvaluationFlow(
}
void AutomaticProfileResetter::BeginResetPromptFlow() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_EVALUATING_CONDITIONS);
state_ = STATE_HAS_TRIGGERED_PROMPT;
......@@ -722,7 +722,7 @@ void AutomaticProfileResetter::BeginResetPromptFlow() {
}
void AutomaticProfileResetter::OnProfileSettingsResetCompleted() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, STATE_PERFORMING_RESET);
delegate_->DismissPrompt();
......@@ -735,7 +735,7 @@ void AutomaticProfileResetter::ReportPromptResult(PromptResult result) {
}
void AutomaticProfileResetter::PersistMementos() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(state_ == STATE_HAS_TRIGGERED_PROMPT ||
state_ == STATE_HAS_SHOWN_BUBBLE);
DCHECK(evaluation_results_);
......@@ -753,7 +753,7 @@ void AutomaticProfileResetter::PersistMementos() {
}
void AutomaticProfileResetter::FinishResetPromptFlow() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(state_ == STATE_HAS_TRIGGERED_PROMPT ||
state_ == STATE_HAS_SHOWN_BUBBLE ||
state_ == STATE_PERFORMING_RESET);
......
......@@ -305,7 +305,7 @@ void AutomaticProfileResetterDelegateImpl::TriggerProfileSettingsReset(
}
void AutomaticProfileResetterDelegateImpl::OnTemplateURLServiceChanged() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(template_url_service_);
if (template_url_service_->loaded() &&
!template_url_service_ready_event_.is_signaled())
......@@ -328,7 +328,7 @@ void AutomaticProfileResetterDelegateImpl::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (type == chrome::NOTIFICATION_MODULE_LIST_ENUMERATED &&
!modules_have_been_enumerated_event_.is_signaled()) {
#if defined(OS_WIN)
......@@ -364,7 +364,7 @@ void AutomaticProfileResetterDelegateImpl::RunProfileSettingsReset(
void AutomaticProfileResetterDelegateImpl::
OnBrandcodedDefaultsFetched() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(brandcoded_config_fetcher_);
DCHECK(!brandcoded_config_fetcher_->IsActive());
brandcoded_defaults_ = brandcoded_config_fetcher_->GetSettings();
......@@ -376,7 +376,7 @@ void AutomaticProfileResetterDelegateImpl::
void AutomaticProfileResetterDelegateImpl::OnProfileSettingsResetCompleted(
const base::Closure& user_callback,
scoped_ptr<ResettableSettingsSnapshot> old_settings_snapshot) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (old_settings_snapshot) {
ResettableSettingsSnapshot new_settings_snapshot(profile_);
int difference =
......
......@@ -37,7 +37,7 @@
namespace {
void ResetShortcutsOnFileThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
// Get full path of chrome.
base::FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe))
......@@ -127,7 +127,7 @@ void ProfileResetter::Reset(
}
bool ProfileResetter::IsActive() const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return pending_reset_flags_ != 0;
}
......@@ -326,7 +326,7 @@ void ProfileResetter::OnBrowsingDataRemoverDone() {
std::vector<ShortcutCommand> GetChromeLaunchShortcuts(
const scoped_refptr<SharedCancellationFlag>& cancel) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
#if defined(OS_WIN)
// Get full path of chrome.
base::FilePath chrome_exe;
......
......@@ -90,7 +90,7 @@ void RemoveCookieTester::AddCookie(const std::string& host,
void RemoveCookieTester::GetCookieOnIOThread(
net::URLRequestContextGetter* context_getter,
const std::string& host) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
net::CookieStore* cookie_store = context_getter->
GetURLRequestContext()->cookie_store();
cookie_store->GetCookiesWithOptionsAsync(
......@@ -103,7 +103,7 @@ void RemoveCookieTester::SetCookieOnIOThread(
net::URLRequestContextGetter* context_getter,
const std::string& host,
const std::string& definition) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
net::CookieStore* cookie_store = context_getter->
GetURLRequestContext()->cookie_store();
cookie_store->SetCookieWithOptionsAsync(
......
......@@ -60,7 +60,7 @@ ResettableSettingsSnapshot::ResettableSettingsSnapshot(
: startup_(SessionStartupPref::GetStartupPref(profile)),
shortcuts_determined_(false),
weak_ptr_factory_(this) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// URLs are always stored sorted.
std::sort(startup_.urls.begin(), startup_.urls.end());
......@@ -90,14 +90,14 @@ ResettableSettingsSnapshot::ResettableSettingsSnapshot(
}
ResettableSettingsSnapshot::~ResettableSettingsSnapshot() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (cancellation_flag_.get())
cancellation_flag_->data.Set();
}
void ResettableSettingsSnapshot::Subtract(
const ResettableSettingsSnapshot& snapshot) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
ExtensionList extensions = base::STLSetDifference<ExtensionList>(
enabled_extensions_, snapshot.enabled_extensions_);
enabled_extensions_.swap(extensions);
......@@ -105,7 +105,7 @@ void ResettableSettingsSnapshot::Subtract(
int ResettableSettingsSnapshot::FindDifferentFields(
const ResettableSettingsSnapshot& snapshot) const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
int bit_mask = 0;
if (startup_.type != snapshot.startup_.type ||
......@@ -134,7 +134,7 @@ int ResettableSettingsSnapshot::FindDifferentFields(
void ResettableSettingsSnapshot::RequestShortcuts(
const base::Closure& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!cancellation_flag_.get() && !shortcuts_determined());
cancellation_flag_ = new SharedCancellationFlag;
......@@ -150,7 +150,7 @@ void ResettableSettingsSnapshot::RequestShortcuts(
void ResettableSettingsSnapshot::SetShortcutsAndReport(
const base::Closure& callback,
const std::vector<ShortcutCommand>& shortcuts) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
shortcuts_ = shortcuts;
shortcuts_determined_ = true;
cancellation_flag_ = NULL;
......@@ -161,7 +161,7 @@ void ResettableSettingsSnapshot::SetShortcutsAndReport(
std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
int field_mask) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::DictionaryValue dict;
if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) {
......@@ -248,7 +248,7 @@ scoped_ptr<base::ListValue> GetReadableFeedbackForSnapshot(
Profile* profile,
const ResettableSettingsSnapshot& snapshot) {
DCHECK(profile);
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
scoped_ptr<base::ListValue> list(new base::ListValue);
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_LOCALE),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment