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

Side by Side Diff: extensions/browser/preload_check_group.cc

Issue 2740853002: Use PreloadCheckGroup in ExtensionInstallChecker. Make RequirementsChecker a PreloadCheck. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « extensions/browser/preload_check.h ('k') | extensions/browser/requirements_checker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "extensions/browser/preload_check_group.h" 5 #include "extensions/browser/preload_check_group.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 void PreloadCheckGroup::Start(ResultCallback callback) { 26 void PreloadCheckGroup::Start(ResultCallback callback) {
27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
28 DCHECK(running_checks_ == 0); 28 DCHECK(running_checks_ == 0);
29 DCHECK(!callback.is_null()); 29 DCHECK(!callback.is_null());
30 30
31 callback_ = std::move(callback); 31 callback_ = std::move(callback);
32 32
33 running_checks_ = checks_.size(); 33 running_checks_ = checks_.size();
34 for (auto* check : checks_) { 34 for (auto* check : checks_) {
35 check->Start(base::Bind(&PreloadCheckGroup::OnCheckComplete, 35 check->Start(base::BindOnce(&PreloadCheckGroup::OnCheckComplete,
36 weak_ptr_factory_.GetWeakPtr(), check, 36 weak_ptr_factory_.GetWeakPtr(), check,
37 current_sequence_number_)); 37 current_sequence_number_));
38 // Synchronous checks may fail immediately. 38 // Synchronous checks may fail immediately.
39 if (running_checks_ == 0) 39 if (running_checks_ == 0)
40 return; 40 return;
41 } 41 }
42 } 42 }
43 43
44 /* 44 /*
45 base::string16 PreloadCheckGroup::GetErrorMessage() const { 45 base::string16 PreloadCheckGroup::GetErrorMessage() const {
46 DCHECK_NE(error, nullptr); 46 DCHECK_NE(error, nullptr);
47 if (error_.empty()) 47 if (error_.empty())
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 running_checks_ = 0; 81 running_checks_ = 0;
82 ++current_sequence_number_; 82 ++current_sequence_number_;
83 83
84 std::move(callback_).Run(errors_); 84 std::move(callback_).Run(errors_);
85 CHECK(callback_.is_null()); 85 CHECK(callback_.is_null());
86 CHECK(!callback_); 86 CHECK(!callback_);
87 } 87 }
88 } 88 }
89 89
90 } // namespace extensions 90 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/preload_check.h ('k') | extensions/browser/requirements_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698