OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |