Chromium Code Reviews| Index: cloud_print/service/win/chrome_launcher.cc |
| diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc |
| index 831af6f25d9c087a2cfa1e12fb0d7ca2006020f1..bca09550f84558db7180de371f541ae962f32dc9 100644 |
| --- a/cloud_print/service/win/chrome_launcher.cc |
| +++ b/cloud_print/service/win/chrome_launcher.cc |
| @@ -20,6 +20,8 @@ |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| +#include "cloud_print/common/win/cloud_print_utils.h" |
| +#include "cloud_print/service/service_constants.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| #include "googleurl/src/gurl.h" |
| #include "net/base/url_util.h" |
| @@ -27,6 +29,7 @@ |
| namespace { |
| const int kShutdownTimeoutMs = 30 * 1000; |
| +const int kUsageUpdateTimeoutMs = 6 * 3600 * 1000; |
|
gene
2013/04/23 01:13:59
add comment here: // 6 hours
Vitaly Buka (NO REVIEWS)
2013/04/23 04:58:51
Done.
|
| static const char16 kAutoRunKeyPath[] = |
| L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |
| @@ -202,10 +205,14 @@ void ChromeLauncher::Run() { |
| base::Time started = base::Time::Now(); |
| DWORD thread_id = 0; |
| LaunchProcess(cmd, chrome_handle.Receive(), &thread_id); |
| - int exit_code = 0; |
| + |
| HANDLE handles[] = {stop_event_.handle(), chrome_handle}; |
| - DWORD wait_result = ::WaitForMultipleObjects(arraysize(handles), handles, |
| - FALSE, INFINITE); |
| + DWORD wait_result = WAIT_TIMEOUT; |
| + while (wait_result == WAIT_TIMEOUT) { |
| + cloud_print::SetGoogleUpdateUsage(kGoogleUpdateId); |
| + wait_result = ::WaitForMultipleObjects(arraysize(handles), handles, |
| + FALSE, kUsageUpdateTimeoutMs); |
| + } |
| if (wait_result == WAIT_OBJECT_0) { |
| ShutdownChrome(chrome_handle, thread_id); |
| break; |
| @@ -289,7 +296,6 @@ std::string ChromeLauncher::CreateServiceStateFile( |
| return result; |
| } |
| - int exit_code = 0; |
| DWORD wait_result = ::WaitForSingleObject(chrome_handle, INFINITE); |
| if (wait_result != WAIT_OBJECT_0) { |
| LOG(ERROR) << "Chrome launch failed."; |