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 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER_H_ | 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER_H_ |
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER_H_ | 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Returns the |task_runner| on which the VerifiedRuleset, as well as the | 134 // Returns the |task_runner| on which the VerifiedRuleset, as well as the |
135 // MemoryMappedRuleset it holds a reference to, should be accessed. | 135 // MemoryMappedRuleset it holds a reference to, should be accessed. |
136 base::SequencedTaskRunner* task_runner() { return task_runner_; } | 136 base::SequencedTaskRunner* task_runner() { return task_runner_; } |
137 | 137 |
138 // Invokes |callback| on |task_runner|, providing a pointer to the underlying | 138 // Invokes |callback| on |task_runner|, providing a pointer to the underlying |
139 // VerifiedRuleset as an argument. The pointer is guaranteed to be valid at | 139 // VerifiedRuleset as an argument. The pointer is guaranteed to be valid at |
140 // least until the callback returns. | 140 // least until the callback returns. |
141 void GetRulesetAsync(base::Callback<void(VerifiedRuleset*)> callback); | 141 void GetRulesetAsync(base::Callback<void(VerifiedRuleset*)> callback); |
142 | 142 |
143 private: | 143 private: |
| 144 // This is to allow ADSF to post |ruleset_.get()| pointer to |task_runner_|. |
| 145 friend class AsyncDocumentSubresourceFilter; |
| 146 |
144 // Note: Raw pointer, |ruleset_| already holds a reference to |task_runner_|. | 147 // Note: Raw pointer, |ruleset_| already holds a reference to |task_runner_|. |
145 base::SequencedTaskRunner* task_runner_; | 148 base::SequencedTaskRunner* task_runner_; |
146 std::unique_ptr<VerifiedRuleset, base::OnTaskRunnerDeleter> ruleset_; | 149 std::unique_ptr<VerifiedRuleset, base::OnTaskRunnerDeleter> ruleset_; |
147 base::ThreadChecker thread_checker_; | 150 base::ThreadChecker thread_checker_; |
148 | 151 |
149 DISALLOW_COPY_AND_ASSIGN(Handle); | 152 DISALLOW_COPY_AND_ASSIGN(Handle); |
150 }; | 153 }; |
151 | 154 |
152 } // namespace subresource_filter | 155 } // namespace subresource_filter |
153 | 156 |
154 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER
_H_ | 157 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_VERIFIED_RULESET_DEALER
_H_ |
OLD | NEW |