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

Side by Side Diff: components/component_updater/default_component_installer.cc

Issue 2889683003: Rename TaskRunner::RunsTasksOnCurrentThread() in //components (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/component_updater/default_component_installer.h" 5 #include "components/component_updater/default_component_installer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 current_install_dir_ = path; 204 current_install_dir_ = path;
205 current_manifest_ = std::move(manifest); 205 current_manifest_ = std::move(manifest);
206 current_version_ = version; 206 current_version_ = version;
207 return true; 207 return true;
208 } 208 }
209 209
210 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { 210 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) {
211 VLOG(1) << __func__ << " for " << installer_traits_->GetName(); 211 VLOG(1) << __func__ << " for " << installer_traits_->GetName();
212 DCHECK(task_runner_.get()); 212 DCHECK(task_runner_.get());
213 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 213 DCHECK(task_runner_->RunsTasksInCurrentSequence());
214 214
215 base::Version latest_version(kNullVersion); 215 base::Version latest_version(kNullVersion);
216 216
217 // First check for an installation set up alongside Chrome itself. 217 // First check for an installation set up alongside Chrome itself.
218 base::FilePath root; 218 base::FilePath root;
219 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) && 219 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) &&
220 FindPreinstallation(root)) { 220 FindPreinstallation(root)) {
221 latest_version = current_version_; 221 latest_version = current_version_;
222 } 222 }
223 223
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 302
303 // Remove older versions of the component. None should be in use during 303 // Remove older versions of the component. None should be in use during
304 // browser startup. 304 // browser startup.
305 for (const auto& older_path : older_paths) 305 for (const auto& older_path : older_paths)
306 base::DeleteFile(older_path, true); 306 base::DeleteFile(older_path, true);
307 } 307 }
308 308
309 void DefaultComponentInstaller::UninstallOnTaskRunner() { 309 void DefaultComponentInstaller::UninstallOnTaskRunner() {
310 DCHECK(task_runner_.get()); 310 DCHECK(task_runner_.get());
311 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 311 DCHECK(task_runner_->RunsTasksInCurrentSequence());
312 312
313 // Only try to delete any files that are in our user-level install path. 313 // Only try to delete any files that are in our user-level install path.
314 base::FilePath userInstallPath; 314 base::FilePath userInstallPath;
315 if (!PathService::Get(DIR_COMPONENT_USER, &userInstallPath)) 315 if (!PathService::Get(DIR_COMPONENT_USER, &userInstallPath))
316 return; 316 return;
317 if (!userInstallPath.IsParent(current_install_dir_)) 317 if (!userInstallPath.IsParent(current_install_dir_))
318 return; 318 return;
319 319
320 const base::FilePath base_dir = current_install_dir_.DirName(); 320 const base::FilePath base_dir = current_install_dir_.DirName();
321 base::FileEnumerator file_enumerator(base_dir, false, 321 base::FileEnumerator file_enumerator(base_dir, false,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 void DefaultComponentInstaller::ComponentReady( 381 void DefaultComponentInstaller::ComponentReady(
382 std::unique_ptr<base::DictionaryValue> manifest) { 382 std::unique_ptr<base::DictionaryValue> manifest) {
383 VLOG(1) << "Component ready, version " << current_version_.GetString() 383 VLOG(1) << "Component ready, version " << current_version_.GetString()
384 << " in " << current_install_dir_.value(); 384 << " in " << current_install_dir_.value();
385 installer_traits_->ComponentReady(current_version_, current_install_dir_, 385 installer_traits_->ComponentReady(current_version_, current_install_dir_,
386 std::move(manifest)); 386 std::move(manifest));
387 } 387 }
388 388
389 } // namespace component_updater 389 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698