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

Side by Side Diff: chrome/browser/component_updater/recovery_component_installer.cc

Issue 2591903004: Update TaskTraits in recovery_component_installer.cc. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/component_updater/recovery_component_installer.h" 5 #include "chrome/browser/component_updater/recovery_component_installer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // The child process must print its PID in the first line of its STDOUT. See 217 // The child process must print its PID in the first line of its STDOUT. See
218 // https://cs.chromium.org/chromium/src/base/mac/authorization_util.h?l=8 218 // https://cs.chromium.org/chromium/src/base/mac/authorization_util.h?l=8
219 // for more details. When |pid| cannot be determined, we are not able to 219 // for more details. When |pid| cannot be determined, we are not able to
220 // get process exit code, thus bail out early. 220 // get process exit code, thus bail out early.
221 if (pid < 0) { 221 if (pid < 0) {
222 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_UNKNOWN_RESULT); 222 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_UNKNOWN_RESULT);
223 return; 223 return;
224 } 224 }
225 base::Process process = base::Process::Open(pid); 225 base::Process process = base::Process::Open(pid);
226 #endif 226 #endif
227 // This task joins a process, hence .WithSyncPrimitives().
227 base::PostTaskWithTraits( 228 base::PostTaskWithTraits(
228 FROM_HERE, base::TaskTraits() 229 FROM_HERE, base::TaskTraits()
229 .WithShutdownBehavior( 230 .WithShutdownBehavior(
230 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 231 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
231 .WithPriority(base::TaskPriority::BACKGROUND) 232 .WithPriority(base::TaskPriority::BACKGROUND)
232 .WithWait(), 233 .WithSyncPrimitives(),
233 base::Bind(&WaitForElevatedInstallToComplete, base::Passed(&process))); 234 base::Bind(&WaitForElevatedInstallToComplete, base::Passed(&process)));
234 } 235 }
235 236
236 void ElevatedInstallRecoveryComponent(const base::FilePath& installer_path) { 237 void ElevatedInstallRecoveryComponent(const base::FilePath& installer_path) {
237 base::PostTaskWithTraits( 238 base::PostTaskWithTraits(
238 FROM_HERE, base::TaskTraits() 239 FROM_HERE, base::TaskTraits()
239 .WithShutdownBehavior( 240 .WithShutdownBehavior(
240 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 241 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
241 .WithPriority(base::TaskPriority::BACKGROUND) 242 .WithPriority(base::TaskPriority::BACKGROUND)
242 .WithFileIO(), 243 .MayBlock(),
243 base::Bind(&DoElevatedInstallRecoveryComponent, installer_path)); 244 base::Bind(&DoElevatedInstallRecoveryComponent, installer_path));
244 } 245 }
245 #endif // defined(OS_WIN) 246 #endif // defined(OS_WIN)
246 247
247 } // namespace 248 } // namespace
248 249
249 // Component installer that is responsible to repair the chrome installation 250 // Component installer that is responsible to repair the chrome installation
250 // or repair the Google update installation. This is a last resort safety 251 // or repair the Google update installation. This is a last resort safety
251 // mechanism. 252 // mechanism.
252 // For user Chrome, recovery component just installs silently. For machine 253 // For user Chrome, recovery component just installs silently. For machine
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 365
365 base::LaunchOptions options; 366 base::LaunchOptions options;
366 #if defined(OS_WIN) 367 #if defined(OS_WIN)
367 options.start_hidden = true; 368 options.start_hidden = true;
368 #endif 369 #endif
369 base::Process process = base::LaunchProcess(cmdline, options); 370 base::Process process = base::LaunchProcess(cmdline, options);
370 if (!process.IsValid()) 371 if (!process.IsValid())
371 return false; 372 return false;
372 373
373 // Let worker pool thread wait for us so we don't block Chrome shutdown. 374 // Let worker pool thread wait for us so we don't block Chrome shutdown.
375 // This task joins a process, hence .WithSyncPrimitives().
374 base::PostTaskWithTraits( 376 base::PostTaskWithTraits(
375 FROM_HERE, base::TaskTraits() 377 FROM_HERE, base::TaskTraits()
376 .WithShutdownBehavior( 378 .WithShutdownBehavior(
377 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 379 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
378 .WithPriority(base::TaskPriority::BACKGROUND) 380 .WithPriority(base::TaskPriority::BACKGROUND)
379 .WithWait(), 381 .WithSyncPrimitives(),
380 base::Bind(&WaitForInstallToComplete, base::Passed(&process), 382 base::Bind(&WaitForInstallToComplete, base::Passed(&process),
381 installer_folder, prefs_)); 383 installer_folder, prefs_));
382 384
383 // Returns true regardless of install result since from updater service 385 // Returns true regardless of install result since from updater service
384 // perspective the install is done, even we may need to do elevated 386 // perspective the install is done, even we may need to do elevated
385 // install later. 387 // install later.
386 return true; 388 return true;
387 } 389 }
388 #else 390 #else
389 bool RecoveryComponentInstaller::RunInstallCommand( 391 bool RecoveryComponentInstaller::RunInstallCommand(
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 #endif // OS_WIN 527 #endif // OS_WIN
526 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 528 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
527 } 529 }
528 530
529 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { 531 void DeclinedElevatedRecoveryInstall(PrefService* prefs) {
530 DCHECK_CURRENTLY_ON(BrowserThread::UI); 532 DCHECK_CURRENTLY_ON(BrowserThread::UI);
531 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 533 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
532 } 534 }
533 535
534 } // namespace component_updater 536 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698