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

Unified Diff: cloud_print/service/win/chrome_launcher.cc

Issue 203043002: Fix "unreachable code" warnings (MSVC warning 4702), misc. edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cloud_print/service/win/chrome_launcher.cc
===================================================================
--- cloud_print/service/win/chrome_launcher.cc (revision 256983)
+++ cloud_print/service/win/chrome_launcher.cc (working copy)
@@ -271,19 +271,16 @@
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 @@
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 @@
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 @@
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();
}

Powered by Google App Engine
This is Rietveld 408576698