Commit 7cfb36ea authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Fix else-if after returns/breaks in components/.

In various components/[a-c]* directories.

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ic42b2176db06d2adbf35d815932c54aed6d3c255
Reviewed-on: https://chromium-review.googlesource.com/776020Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519515}
parent 7da9492c
...@@ -118,7 +118,8 @@ base::string16 JavaScriptAppModalDialogViews::GetDialogButtonLabel( ...@@ -118,7 +118,8 @@ base::string16 JavaScriptAppModalDialogViews::GetDialogButtonLabel(
parent_->is_reload() ? parent_->is_reload() ?
IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL : IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL :
IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
} else if (button == ui::DIALOG_BUTTON_CANCEL) { }
if (button == ui::DIALOG_BUTTON_CANCEL) {
return l10n_util::GetStringUTF16( return l10n_util::GetStringUTF16(
parent_->is_reload() ? parent_->is_reload() ?
IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL : IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL :
......
...@@ -1287,18 +1287,18 @@ void ProfileSyncService::OnConfigureStart() { ...@@ -1287,18 +1287,18 @@ void ProfileSyncService::OnConfigureStart() {
ProfileSyncService::SyncStatusSummary ProfileSyncService::SyncStatusSummary
ProfileSyncService::QuerySyncStatusSummary() { ProfileSyncService::QuerySyncStatusSummary() {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
if (HasUnrecoverableError()) { if (HasUnrecoverableError())
return UNRECOVERABLE_ERROR; return UNRECOVERABLE_ERROR;
} else if (!engine_) { if (!engine_)
return NOT_ENABLED; return NOT_ENABLED;
} else if (engine_ && !IsFirstSetupComplete()) { if (engine_ && !IsFirstSetupComplete())
return SETUP_INCOMPLETE; return SETUP_INCOMPLETE;
} else if (engine_ && IsFirstSetupComplete() && data_type_manager_ && if (engine_ && IsFirstSetupComplete() && data_type_manager_ &&
data_type_manager_->state() == DataTypeManager::STOPPED) { data_type_manager_->state() == DataTypeManager::STOPPED) {
return DATATYPES_NOT_INITIALIZED; return DATATYPES_NOT_INITIALIZED;
} else if (IsSyncActive()) {
return INITIALIZED;
} }
if (IsSyncActive())
return INITIALIZED;
return UNKNOWN_ERROR; return UNKNOWN_ERROR;
} }
...@@ -1342,12 +1342,11 @@ bool ProfileSyncService::QueryDetailedSyncStatus(SyncEngine::Status* result) { ...@@ -1342,12 +1342,11 @@ bool ProfileSyncService::QueryDetailedSyncStatus(SyncEngine::Status* result) {
if (engine_ && engine_initialized_) { if (engine_ && engine_initialized_) {
*result = engine_->GetDetailedStatus(); *result = engine_->GetDetailedStatus();
return true; return true;
} else {
SyncEngine::Status status;
status.sync_protocol_error = last_actionable_error_;
*result = status;
return false;
} }
SyncEngine::Status status;
status.sync_protocol_error = last_actionable_error_;
*result = status;
return false;
} }
const AuthError& ProfileSyncService::GetAuthError() const { const AuthError& ProfileSyncService::GetAuthError() const {
...@@ -1835,11 +1834,10 @@ bool ProfileSyncService::SetDecryptionPassphrase( ...@@ -1835,11 +1834,10 @@ bool ProfileSyncService::SetDecryptionPassphrase(
bool result = crypto_->SetDecryptionPassphrase(passphrase); bool result = crypto_->SetDecryptionPassphrase(passphrase);
UMA_HISTOGRAM_BOOLEAN("Sync.PassphraseDecryptionSucceeded", result); UMA_HISTOGRAM_BOOLEAN("Sync.PassphraseDecryptionSucceeded", result);
return result; return result;
} else {
NOTREACHED() << "SetDecryptionPassphrase must not be called when "
"IsPassphraseRequired() is false.";
return false;
} }
NOTREACHED() << "SetDecryptionPassphrase must not be called when "
"IsPassphraseRequired() is false.";
return false;
} }
bool ProfileSyncService::IsEncryptEverythingAllowed() const { bool ProfileSyncService::IsEncryptEverythingAllowed() const {
...@@ -2271,11 +2269,7 @@ base::FilePath ProfileSyncService::GetDirectoryPathForTest() const { ...@@ -2271,11 +2269,7 @@ base::FilePath ProfileSyncService::GetDirectoryPathForTest() const {
base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
if (sync_thread_) { return sync_thread_ ? sync_thread_->message_loop() : nullptr;
return sync_thread_->message_loop();
} else {
return nullptr;
}
} }
syncer::SyncEncryptionHandler::Observer* syncer::SyncEncryptionHandler::Observer*
......
...@@ -142,8 +142,7 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse( ...@@ -142,8 +142,7 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
base::Time CaptivePortalDetector::GetCurrentTime() const { base::Time CaptivePortalDetector::GetCurrentTime() const {
if (time_for_testing_.is_null()) if (time_for_testing_.is_null())
return base::Time::Now(); return base::Time::Now();
else return time_for_testing_;
return time_for_testing_;
} }
bool CaptivePortalDetector::FetchingURL() const { bool CaptivePortalDetector::FetchingURL() const {
......
...@@ -103,11 +103,7 @@ void Logger::LogSocketChallengeReplyEvent(int channel_id, ...@@ -103,11 +103,7 @@ void Logger::LogSocketChallengeReplyEvent(int channel_id,
LastError Logger::GetLastError(int channel_id) const { LastError Logger::GetLastError(int channel_id) const {
const auto it = last_errors_.find(channel_id); const auto it = last_errors_.find(channel_id);
if (it != last_errors_.end()) { return it != last_errors_.end() ? it->second : LastError();
return it->second;
} else {
return LastError();
}
} }
void Logger::ClearLastError(int channel_id) { void Logger::ClearLastError(int channel_id) {
......
...@@ -75,9 +75,8 @@ bool ContextualSearchWrapper::EnsureServiceConnected() { ...@@ -75,9 +75,8 @@ bool ContextualSearchWrapper::EnsureServiceConnected() {
render_frame()->GetRemoteInterfaces()->GetInterface( render_frame()->GetRemoteInterfaces()->GetInterface(
&contextual_search_js_api_service_); &contextual_search_js_api_service_);
return true; return true;
} else {
return false;
} }
return false;
} }
void ContextualSearchWrapper::OnDestruct() {} void ContextualSearchWrapper::OnDestruct() {}
......
...@@ -1390,7 +1390,8 @@ size_t WaitForCrashReportUploadProcess(int fd, size_t bytes_to_read, ...@@ -1390,7 +1390,8 @@ size_t WaitForCrashReportUploadProcess(int fd, size_t bytes_to_read,
if (ret < 0) { if (ret < 0) {
// Error // Error
break; break;
} else if (ret > 0) { }
if (ret > 0) {
// There is data to read. // There is data to read.
ssize_t len = HANDLE_EINTR( ssize_t len = HANDLE_EINTR(
sys_read(fd, buf + bytes_read, bytes_to_read - bytes_read)); sys_read(fd, buf + bytes_read, bytes_to_read - bytes_read));
......
...@@ -100,10 +100,12 @@ bool HardErrorHandler(EXCEPTION_POINTERS* ex_info) { ...@@ -100,10 +100,12 @@ bool HardErrorHandler(EXCEPTION_POINTERS* ex_info) {
if (exception == kExceptionModuleNotFound) { if (exception == kExceptionModuleNotFound) {
ModuleNotFoundHardError(ex_info->ExceptionRecord); ModuleNotFoundHardError(ex_info->ExceptionRecord);
return true; return true;
} else if (exception == kExceptionEntryPtNotFound) { }
if (exception == kExceptionEntryPtNotFound) {
EntryPointNotFoundHardError(ex_info->ExceptionRecord); EntryPointNotFoundHardError(ex_info->ExceptionRecord);
return true; return true;
} else if (FacilityFromException(exception) == FACILITY_GRAPHICS_KERNEL) { }
if (FacilityFromException(exception) == FACILITY_GRAPHICS_KERNEL) {
RaiseHardErrorMsg(exception, std::string(), std::string()); RaiseHardErrorMsg(exception, std::string(), std::string());
return true; return true;
} }
......
...@@ -116,9 +116,8 @@ ...@@ -116,9 +116,8 @@
_semaphore, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC)); _semaphore, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC));
} }
return request_completed; return request_completed;
} else {
return dispatch_semaphore_wait(_semaphore, DISPATCH_TIME_FOREVER) == 0;
} }
return dispatch_semaphore_wait(_semaphore, DISPATCH_TIME_FOREVER) == 0;
} }
- (void)URLSession:(NSURLSession*)session - (void)URLSession:(NSURLSession*)session
...@@ -207,22 +206,21 @@ bool CronetTestBase::StartDataTaskAndWaitForCompletion( ...@@ -207,22 +206,21 @@ bool CronetTestBase::StartDataTaskAndWaitForCompletion(
} }
::testing::AssertionResult CronetTestBase::IsResponseSuccessful() { ::testing::AssertionResult CronetTestBase::IsResponseSuccessful() {
if ([delegate_ error]) if ([delegate_ error]) {
return ::testing::AssertionFailure() << "error in response: " << return ::testing::AssertionFailure() << "error in response: " <<
[[[delegate_ error] description] [[[delegate_ error] description]
cStringUsingEncoding:NSUTF8StringEncoding]; cStringUsingEncoding:NSUTF8StringEncoding];
else }
return ::testing::AssertionSuccess() << "no errors in response"; return ::testing::AssertionSuccess() << "no errors in response";
} }
::testing::AssertionResult CronetTestBase::IsResponseCanceled() { ::testing::AssertionResult CronetTestBase::IsResponseCanceled() {
if ([delegate_ error] && [[delegate_ error] code] == NSURLErrorCancelled) if ([delegate_ error] && [[delegate_ error] code] == NSURLErrorCancelled)
return ::testing::AssertionSuccess() << "the response is canceled"; return ::testing::AssertionSuccess() << "the response is canceled";
else return ::testing::AssertionFailure() << "the response is not canceled."
return ::testing::AssertionFailure() << "the response is not canceled." << " The response error is " <<
<< " The response error is " << [[[delegate_ error] description]
[[[delegate_ error] description] cStringUsingEncoding:NSUTF8StringEncoding];
cStringUsingEncoding:NSUTF8StringEncoding];
} }
std::unique_ptr<net::MockCertVerifier> CronetTestBase::CreateMockCertVerifier( std::unique_ptr<net::MockCertVerifier> CronetTestBase::CreateMockCertVerifier(
......
...@@ -177,9 +177,9 @@ base::TimeDelta SyncSchedulerImpl::GetJitteredPeriod() { ...@@ -177,9 +177,9 @@ base::TimeDelta SyncSchedulerImpl::GetJitteredPeriod() {
} }
base::TimeDelta SyncSchedulerImpl::GetPeriod() { base::TimeDelta SyncSchedulerImpl::GetPeriod() {
if (strategy_ == Strategy::PERIODIC_REFRESH) { if (strategy_ == Strategy::PERIODIC_REFRESH)
return refresh_period_; return refresh_period_;
} else if (strategy_ == Strategy::AGGRESSIVE_RECOVERY && failure_count_ > 0) { if (strategy_ == Strategy::AGGRESSIVE_RECOVERY && failure_count_ > 0) {
// The backoff for each consecutive failure is exponentially doubled until // The backoff for each consecutive failure is exponentially doubled until
// it is equal to the normal refresh period. // it is equal to the normal refresh period.
// Note: |backoff_factor| may evaulate to INF if |failure_count_| is large, // Note: |backoff_factor| may evaulate to INF if |failure_count_| is large,
...@@ -187,11 +187,10 @@ base::TimeDelta SyncSchedulerImpl::GetPeriod() { ...@@ -187,11 +187,10 @@ base::TimeDelta SyncSchedulerImpl::GetPeriod() {
double backoff_factor = pow(2, failure_count_ - 1); double backoff_factor = pow(2, failure_count_ - 1);
base::TimeDelta backoff_period = base_recovery_period_ * backoff_factor; base::TimeDelta backoff_period = base_recovery_period_ * backoff_factor;
return backoff_period < refresh_period_ ? backoff_period : refresh_period_; return backoff_period < refresh_period_ ? backoff_period : refresh_period_;
} else {
PA_LOG(ERROR) << "Error getting period for strategy: "
<< static_cast<int>(strategy_);
return base::TimeDelta();
} }
PA_LOG(ERROR) << "Error getting period for strategy: "
<< static_cast<int>(strategy_);
return base::TimeDelta();
} }
} // namespace cryptauth } // namespace cryptauth
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