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

Unified Diff: content/browser/loader/loader_io_thread_notifier.h

Issue 2180933002: Add experimental code behind a flag for Content Size Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on dependent PS Created 4 years, 5 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: content/browser/loader/loader_io_thread_notifier.h
diff --git a/content/browser/loader/loader_io_thread_notifier.h b/content/browser/loader/loader_io_thread_notifier.h
index 8528ecde6cbfa81723a9255c4d7c8cdfe79635bd..8c153b8c337bfa4646f9a9265b40bfe532d03da5 100644
--- a/content/browser/loader/loader_io_thread_notifier.h
+++ b/content/browser/loader/loader_io_thread_notifier.h
@@ -6,10 +6,14 @@
#define CONTENT_BROWSER_LOADER_LOADER_IO_THREAD_NOTIFIER
#include "base/macros.h"
+#include "content/browser/loader/global_routing_id.h"
+#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/web_contents_observer.h"
namespace content {
+class FrameTreeNode;
+class NavigationHandle;
class RenderFrameHost;
class WebContents;
@@ -23,10 +27,40 @@ class LoaderIOThreadNotifier : public WebContentsObserver {
explicit LoaderIOThreadNotifier(WebContents* web_contents);
~LoaderIOThreadNotifier() override;
- // content::WebContentsObserver:
+ // WebContentsObserver:
+ void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
+ static void UpdateGlobalDataAccounting(
+ std::unique_ptr<std::map<GlobalFrameRoutingId, int>> updates);
+
+ static NavigationThrottle* MaybeCreateThrottle(NavigationHandle* handle);
+ NavigationThrottle::ThrottleCheckResult WillProcessNavigationResponse(
+ NavigationHandle* handle);
+
private:
+ struct FrameSize {
+ int content_left = 0;
+ int content_limit = 0;
+ };
+
+ // Returns the effective size limit of this FrameTreeNode by walking up the
+ // tree.
+ LoaderIOThreadNotifier::FrameSize* AddNewFrame(FrameTreeNode* node,
+ int limit);
+ LoaderIOThreadNotifier::FrameSize* GetEffectiveLimit(FrameTreeNode* node);
+
+ static void NotifyFramesWentOverSizeLimits(
+ std::unique_ptr<std::set<GlobalFrameRoutingId>> frames);
+ static void NotifyFrameHasLimit(const GlobalFrameRoutingId& frame,
+ int limit);
+
+ void UpdateDataAccounting(
+ std::map<GlobalFrameRoutingId, int> updates);
+
+ // frame_tree_node_id -> FrameSize map.
+ std::map<int, FrameSize> frame_tree_node_sizes_;
mmenke 2016/08/05 17:16:27 This really doesn't belong in something called "Lo
Charlie Harrison 2016/08/08 14:04:39 Fair point. I mainly stuffed this logic here becau
+
DISALLOW_COPY_AND_ASSIGN(LoaderIOThreadNotifier);
};

Powered by Google App Engine
This is Rietveld 408576698