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

Unified Diff: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h

Issue 2691423006: Introduce the ThrottleManager (Closed)
Patch Set: engedy review 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 side-by-side diff with in-line comments
Download patch
Index: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h
index 2fc7917078c317e52381175990f1d4f19a0c59f1..c3415734a27c14301431306979da5e724a74ee7a 100644
--- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h
+++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h
@@ -63,22 +63,23 @@ class ActivationStateComputingNavigationThrottle
// frame.
std::unique_ptr<AsyncDocumentSubresourceFilter> ReleaseFilter();
- // Gets the activation state calculated for this navigation. Must be called
- // after the navigation is resumed from getting paused in WillProcessResponse,
- // which, for example, will have happened at ReadyToCommitNavigation.
- const ActivationState& GetActivationState() const;
+ AsyncDocumentSubresourceFilter* filter() { return async_filter_.get(); }
+
+ void WillSendActivationToRenderer();
private:
- void SetActivationStateAndResume(ActivationState state);
+ void OnActivationStateComputed(ActivationState state);
+ void set_filter(
+ std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter) {
+ async_filter_ = std::move(async_filter);
+ }
ActivationStateComputingNavigationThrottle(
content::NavigationHandle* navigation_handle,
const base::Optional<ActivationState> parent_activation_state,
VerifiedRuleset::Handle* ruleset_handle);
- // These members are optional to allow DCHECKing their existence at certain
- // points in the navigation flow.
- base::Optional<ActivationState> activation_state_;
+ // Optional to allow for DCHECKing.
base::Optional<ActivationState> parent_activation_state_;
std::unique_ptr<AsyncDocumentSubresourceFilter> async_filter_;
@@ -87,6 +88,12 @@ class ActivationStateComputingNavigationThrottle
// nullptr until NotifyPageActivationWithRuleset is called.
VerifiedRuleset::Handle* ruleset_handle_;
+ // Becomes true when the throttle manager reaches ReadyToCommitNavigation and
+ // sends an activation IPC to the render process. Makes sure a caller cannot
+ // take ownership of the subresource filter unless an activation IPC is sent
+ // to the renderer.
+ bool will_send_activation_to_renderer_ = false;
+
base::WeakPtrFactory<ActivationStateComputingNavigationThrottle>
weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698