diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-18 19:04:21 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-18 19:04:21 +0000 |
commit | 03cf96e71f1855f80a4b9214aab7c7fae60ec87c (patch) | |
tree | af118309b7e143c83f20456858c68b3ac62e0da1 | |
parent | 89d1a8b163dc905efeea6d391f4d02deafccf59c (diff) | |
download | chromium_src-03cf96e71f1855f80a4b9214aab7c7fae60ec87c.zip chromium_src-03cf96e71f1855f80a4b9214aab7c7fae60ec87c.tar.gz chromium_src-03cf96e71f1855f80a4b9214aab7c7fae60ec87c.tar.bz2 |
Fix "unreachable code" warnings (MSVC warning 4702), misc. edition.
This CL covers top-level directories that only had one or two modified files.
BUG=346399
TEST=none
R=darin@chromium.org
Review URL: https://codereview.chromium.org/203043002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257705 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/output/output_surface.cc | 5 | ||||
-rw-r--r-- | cloud_print/service/win/chrome_launcher.cc | 29 | ||||
-rw-r--r-- | components/translate/language_detection/language_detection_util.cc | 27 | ||||
-rw-r--r-- | courgette/disassembler_elf_32_arm.cc | 2 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_factory.cc | 7 | ||||
-rw-r--r-- | extensions/common/extension_paths.cc | 32 | ||||
-rw-r--r-- | gpu/config/gpu_info_collector_win.cc | 4 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer.cc | 6 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer_unittest.cc | 15 | ||||
-rw-r--r-- | sync/syncable/model_type.cc | 29 | ||||
-rw-r--r-- | tools/gn/gn_main.cc | 1 | ||||
-rw-r--r-- | webkit/browser/fileapi/isolated_context.cc | 19 |
12 files changed, 64 insertions, 112 deletions
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 87d6e84..9c52bcb 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -411,8 +411,8 @@ base::TimeDelta OutputSurface::GpuLatencyEstimate() { } void OutputSurface::UpdateAndMeasureGpuLatency() { - return; // http://crbug.com/306690 tracks re-enabling latency queries. - + // http://crbug.com/306690 tracks re-enabling latency queries. +#if 0 // We only care about GPU latency for surfaces that do not have a parent // compositor, since surfaces that do have a parent compositor can use // mailboxes or delegated rendering to send frames to their parent without @@ -473,6 +473,7 @@ void OutputSurface::UpdateAndMeasureGpuLatency() { gpu_latency_query_id); context_provider_->ContextGL()->EndQueryEXT(GL_LATENCY_QUERY_CHROMIUM); pending_gpu_latency_query_ids_.push_back(gpu_latency_query_id); +#endif } void OutputSurface::PostSwapBuffersComplete() { diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc index f0cac5e..231ae84 100644 --- a/cloud_print/service/win/chrome_launcher.cc +++ b/cloud_print/service/win/chrome_launcher.cc @@ -271,19 +271,16 @@ void ChromeLauncher::Run() { std::string ChromeLauncher::CreateServiceStateFile( const std::string& proxy_id, const std::vector<std::string>& printers) { - std::string result; - base::ScopedTempDir temp_user_data; if (!temp_user_data.CreateUniqueTempDir()) { LOG(ERROR) << "Can't create temp dir."; - return result; + return std::string(); } base::FilePath chrome_path = chrome_launcher_support::GetAnyChromePath(); - if (chrome_path.empty()) { LOG(ERROR) << "Can't find Chrome."; - return result; + return std::string(); } base::FilePath printers_file = temp_user_data.path().Append(L"printers.json"); @@ -297,7 +294,7 @@ std::string ChromeLauncher::CreateServiceStateFile( printers_json.size()); if (written != printers_json.size()) { LOG(ERROR) << "Can't write file."; - return result; + return std::string(); } CommandLine cmd(chrome_path); @@ -320,7 +317,7 @@ std::string ChromeLauncher::CreateServiceStateFile( DWORD thread_id = 0; if (!LaunchProcess(cmd, &chrome_handle, &thread_id)) { LOG(ERROR) << "Unable to launch Chrome."; - return result; + return std::string(); } for (;;) { @@ -330,18 +327,16 @@ std::string ChromeLauncher::CreateServiceStateFile( if (wait_result == WAIT_OBJECT_0) { // Return what we have because browser is closed. return json; - } else if (wait_result == WAIT_TIMEOUT) { - if (!json.empty()) { - // Close chrome because Service State is ready. - CloseChrome(chrome_handle, thread_id); - return json; - } - } else { + } + if (wait_result != WAIT_TIMEOUT) { LOG(ERROR) << "Chrome launch failed."; - return result; + return std::string(); + } + if (!json.empty()) { + // Close chrome because Service State is ready. + CloseChrome(chrome_handle, thread_id); + return json; } } - NOTREACHED(); - return std::string(); } diff --git a/components/translate/language_detection/language_detection_util.cc b/components/translate/language_detection/language_detection_util.cc index b452549..5532112 100644 --- a/components/translate/language_detection/language_detection_util.cc +++ b/components/translate/language_detection/language_detection_util.cc @@ -245,29 +245,32 @@ std::string DeterminePageLanguage(const std::string& code, translate::ReportLanguageVerification( translate::LANGUAGE_VERIFICATION_UNKNOWN); return language; - } else if (CanCLDComplementSubCode(language, cld_language)) { + } + + if (CanCLDComplementSubCode(language, cld_language)) { translate::ReportLanguageVerification( translate::LANGUAGE_VERIFICATION_CLD_COMPLEMENT_SUB_CODE); return cld_language; - } else if (IsSameOrSimilarLanguages(language, cld_language)) { + } + + if (IsSameOrSimilarLanguages(language, cld_language)) { translate::ReportLanguageVerification( translate::LANGUAGE_VERIFICATION_CLD_AGREE); return language; - } else if (MaybeServerWrongConfiguration(language, cld_language)) { + } + + if (MaybeServerWrongConfiguration(language, cld_language)) { translate::ReportLanguageVerification( translate::LANGUAGE_VERIFICATION_TRUST_CLD); return cld_language; - } else { - translate::ReportLanguageVerification( - translate::LANGUAGE_VERIFICATION_CLD_DISAGREE); - // Content-Language value might be wrong because CLD says that this page - // is written in another language with confidence. - // In this case, Chrome doesn't rely on any of the language codes, and - // gives up suggesting a translation. - return std::string(kUnknownLanguageCode); } - return language; + // Content-Language value might be wrong because CLD says that this page is + // written in another language with confidence. In this case, Chrome doesn't + // rely on any of the language codes, and gives up suggesting a translation. + translate::ReportLanguageVerification( + translate::LANGUAGE_VERIFICATION_CLD_DISAGREE); + return kUnknownLanguageCode; } void CorrectLanguageCodeTypo(std::string* code) { diff --git a/courgette/disassembler_elf_32_arm.cc b/courgette/disassembler_elf_32_arm.cc index 3633061..593ce0a 100644 --- a/courgette/disassembler_elf_32_arm.cc +++ b/courgette/disassembler_elf_32_arm.cc @@ -291,8 +291,6 @@ CheckBool DisassemblerElf32ARM::RelToRVA(Elf32_Rel rel, RVA* result) const { default: return false; } - - return false; } CheckBool DisassemblerElf32ARM::ParseRelocationSection( diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc index c15d26a..b48d4f9 100644 --- a/device/bluetooth/bluetooth_adapter_factory.cc +++ b/device/bluetooth/bluetooth_adapter_factory.cc @@ -62,14 +62,13 @@ namespace device { // static bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { -#if defined(OS_CHROMEOS) - return true; -#elif defined(OS_WIN) +#if defined(OS_CHROMEOS) || defined(OS_WIN) return true; #elif defined(OS_MACOSX) return base::mac::IsOSLionOrLater(); -#endif +#else return false; +#endif } // static diff --git a/extensions/common/extension_paths.cc b/extensions/common/extension_paths.cc index 1e0c461..2103100 100644 --- a/extensions/common/extension_paths.cc +++ b/extensions/common/extension_paths.cc @@ -10,26 +10,18 @@ namespace extensions { bool PathProvider(int key, base::FilePath* result) { - switch (key) { - case DIR_TEST_DATA: { - base::FilePath cur; - if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) - return false; - cur = cur.Append(FILE_PATH_LITERAL("extensions")); - cur = cur.Append(FILE_PATH_LITERAL("test")); - cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!base::PathExists(cur)) // we don't want to create this - return false; - - *result = cur; - return true; - break; - } - default: - return false; - } - - return false; + if (key != DIR_TEST_DATA) + return false; + base::FilePath cur; + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) + return false; + cur = cur.Append(FILE_PATH_LITERAL("extensions")); + cur = cur.Append(FILE_PATH_LITERAL("test")); + cur = cur.Append(FILE_PATH_LITERAL("data")); + if (!base::PathExists(cur)) // we don't want to create this + return false; + *result = cur; + return true; } // This cannot be done as a static initializer sadly since Visual Studio will diff --git a/gpu/config/gpu_info_collector_win.cc b/gpu/config/gpu_info_collector_win.cc index f7b1f9e..ca737b9 100644 --- a/gpu/config/gpu_info_collector_win.cc +++ b/gpu/config/gpu_info_collector_win.cc @@ -211,8 +211,9 @@ bool IsLenovoDCuteInstalled() { bool D3D11ShouldWork(const GPUInfo& gpu_info) { // TODO(apatrick): This is a temporary change to see what impact disabling // D3D11 stats collection has on Canary. +#if 1 return false; - +#else // Windows XP never supports D3D11. It seems to be less stable that D3D9 on // Vista. if (base::win::GetVersion() <= base::win::VERSION_VISTA) @@ -223,6 +224,7 @@ bool D3D11ShouldWork(const GPUInfo& gpu_info) { return false; return true; +#endif } // Collects information about the level of D3D11 support and records it in diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 34bc0d3..c38d57c 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -313,14 +313,16 @@ void FFmpegDemuxerStream::SatisfyPendingRead() { } bool FFmpegDemuxerStream::HasAvailableCapacity() { - // TODO(scherkus): Remove early return and reenable time-based capacity + // TODO(scherkus): Remove this return and reenable time-based capacity // after our data sources support canceling/concurrent reads, see // http://crbug.com/165762 for details. +#if 1 return !read_cb_.is_null(); - +#else // Try to have one second's worth of encoded data per stream. const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(1); return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity; +#endif } size_t FFmpegDemuxerStream::MemoryUsage() const { diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index 9916f6f..c168f92 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -673,24 +673,21 @@ TEST_F(FFmpegDemuxerTest, SeekWithCuesBeforeFirstCluster) { message_loop_.Run(); } +#if defined(USE_PROPRIETARY_CODECS) // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the // field "title" set to "sample for id3 test". TEST_F(FFmpegDemuxerTest, NoID3TagData) { -#if !defined(USE_PROPRIETARY_CODECS) - return; -#endif CreateDemuxer("id3_test.mp3"); InitializeDemuxer(); EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); } +#endif +#if defined(USE_PROPRIETARY_CODECS) // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg // will hand us a video stream to the data which will likely be in a format we // don't accept as video; e.g. PNG. TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { -#if !defined(USE_PROPRIETARY_CODECS) - return; -#endif CreateDemuxer("id3_png_test.mp3"); InitializeDemuxer(); @@ -698,6 +695,7 @@ TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); } +#endif // Ensure a video with an unsupported audio track still results in the video // stream being demuxed. @@ -721,15 +719,14 @@ TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); } +#if defined(USE_PROPRIETARY_CODECS) // FFmpeg returns null data pointers when samples have zero size, leading to // mistakenly creating end of stream buffers http://crbug.com/169133 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { -#if !defined(USE_PROPRIETARY_CODECS) - return; -#endif CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); InitializeDemuxer(); ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); } +#endif } // namespace media diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc index 5c626e4..006b493 100644 --- a/sync/syncable/model_type.cc +++ b/sync/syncable/model_type.cc @@ -135,59 +135,41 @@ ModelType GetModelTypeFromSpecificsFieldNumber(int field_number) { } int GetSpecificsFieldNumberFromModelType(ModelType model_type) { - if (!ProtocolTypes().Has(model_type)) { - NOTREACHED() << "Only protocol types have field values."; - return 0; - } + DCHECK(ProtocolTypes().Has(model_type)) + << "Only protocol types have field values."; switch (model_type) { case BOOKMARKS: return sync_pb::EntitySpecifics::kBookmarkFieldNumber; - break; case PASSWORDS: return sync_pb::EntitySpecifics::kPasswordFieldNumber; - break; case PREFERENCES: return sync_pb::EntitySpecifics::kPreferenceFieldNumber; - break; case AUTOFILL: return sync_pb::EntitySpecifics::kAutofillFieldNumber; - break; case AUTOFILL_PROFILE: return sync_pb::EntitySpecifics::kAutofillProfileFieldNumber; - break; case THEMES: return sync_pb::EntitySpecifics::kThemeFieldNumber; - break; case TYPED_URLS: return sync_pb::EntitySpecifics::kTypedUrlFieldNumber; - break; case EXTENSIONS: return sync_pb::EntitySpecifics::kExtensionFieldNumber; - break; case NIGORI: return sync_pb::EntitySpecifics::kNigoriFieldNumber; - break; case SEARCH_ENGINES: return sync_pb::EntitySpecifics::kSearchEngineFieldNumber; - break; case SESSIONS: return sync_pb::EntitySpecifics::kSessionFieldNumber; - break; case APPS: return sync_pb::EntitySpecifics::kAppFieldNumber; - break; case APP_LIST: return sync_pb::EntitySpecifics::kAppListFieldNumber; - break; case APP_SETTINGS: return sync_pb::EntitySpecifics::kAppSettingFieldNumber; - break; case EXTENSION_SETTINGS: return sync_pb::EntitySpecifics::kExtensionSettingFieldNumber; - break; case APP_NOTIFICATIONS: return sync_pb::EntitySpecifics::kAppNotificationFieldNumber; - break; case HISTORY_DELETE_DIRECTIVES: return sync_pb::EntitySpecifics::kHistoryDeleteDirectiveFieldNumber; case SYNCED_NOTIFICATIONS: @@ -196,16 +178,12 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) { return sync_pb::EntitySpecifics::kSyncedNotificationAppInfoFieldNumber; case DEVICE_INFO: return sync_pb::EntitySpecifics::kDeviceInfoFieldNumber; - break; case EXPERIMENTS: return sync_pb::EntitySpecifics::kExperimentsFieldNumber; - break; case PRIORITY_PREFERENCES: return sync_pb::EntitySpecifics::kPriorityPreferenceFieldNumber; - break; case DICTIONARY: return sync_pb::EntitySpecifics::kDictionaryFieldNumber; - break; case FAVICON_IMAGES: return sync_pb::EntitySpecifics::kFaviconImageFieldNumber; case FAVICON_TRACKING: @@ -222,9 +200,6 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) { NOTREACHED() << "No known extension for model type."; return 0; } - NOTREACHED() << "Needed for linux_keep_shadow_stacks because of " - << "http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681"; - return 0; } FullModelTypeSet ToFullModelTypeSet(ModelTypeSet in) { diff --git a/tools/gn/gn_main.cc b/tools/gn/gn_main.cc index a4158d4..25130a0 100644 --- a/tools/gn/gn_main.cc +++ b/tools/gn/gn_main.cc @@ -78,5 +78,4 @@ int main(int argc, char** argv) { } exit(retval); // Don't free memory, it can be really slow! - return retval; } diff --git a/webkit/browser/fileapi/isolated_context.cc b/webkit/browser/fileapi/isolated_context.cc index 7471610..f126330 100644 --- a/webkit/browser/fileapi/isolated_context.cc +++ b/webkit/browser/fileapi/isolated_context.cc @@ -41,21 +41,10 @@ base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) { } bool IsSinglePathIsolatedFileSystem(FileSystemType type) { - switch (type) { - // As of writing dragged file system is the only filesystem - // which could have multiple top-level paths. - case kFileSystemTypeDragged: - return false; - - case kFileSystemTypeUnknown: - NOTREACHED(); - return true; - - default: - return true; - } - NOTREACHED(); - return true; + DCHECK_NE(kFileSystemTypeUnknown, type); + // As of writing dragged file system is the only filesystem which could have + // multiple top-level paths. + return type != kFileSystemTypeDragged; } static base::LazyInstance<IsolatedContext>::Leaky g_isolated_context = |