Skip to content

Commit

Permalink
Remove superfluous includes from render_frame_host.h
Browse files Browse the repository at this point in the history
This is a large and fairly widely included header. The size of itself
and all the files it includes is 13 MB, it is part of ca 2,000
translation units for the 'chrome' target. Its added size for that
target is ca 5 GB. The compile time of the header alone is ca 4 s.

This change reduces the compile time of the header to ca 1 s,
and saves 8 CPU minutes of build time for the chrome target.

Bug: 242216
Change-Id: Idcaa4f6326545a64324a9d7fa45d6d27b136f622
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2794474
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#868174}
  • Loading branch information
zmodem authored and Chromium LUCI CQ committed Mar 31, 2021
1 parent 406e168 commit 7d15b70
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 48 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/installable/quality_enforcer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "chrome/android/chrome_jni_headers/QualityEnforcer_jni.h"
#include "content/public/browser/render_frame_host.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/devtools/inspector_issue.mojom-shared.h"
#include "third_party/blink/public/mojom/devtools/inspector_issue.mojom.h"
#include "url/gurl.h"

using base::android::JavaParamRef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/memory_pressure_monitor.h"
#include "components/paint_preview/browser/file_manager.h"
#include "content/public/browser/global_routing_id.h"

#include "chrome/browser/share/android/jni_headers/LongScreenshotsTabService_jni.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/net/reporting_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_features.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "components/paint_preview/browser/paint_preview_base_service.h"
#include "components/paint_preview/browser/paint_preview_policy.h"
#include "components/paint_preview/common/proto/paint_preview.pb.h"
#include "content/public/browser/global_routing_id.h"

#if defined(os_android)
#include "base/android/jni_android.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "components/security_state/core/security_state.h"
#include "components/ukm/content/source_url_recorder.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/page_visibility_state.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "url/gurl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "components/page_info/page_info_ui.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/optimization_guide/proto/public_image_metadata.pb.h"
#include "components/subresource_redirect/common/subresource_redirect_features.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "components/autofill/content/browser/content_autofill_driver.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "components/content_capture/browser/content_capture_consumer.h"
#include "components/content_capture/browser/content_capture_receiver.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "content/public/browser/render_frame_host.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "url/gurl.h"

namespace on_load_script_injector {

Expand Down
4 changes: 4 additions & 0 deletions components/page_info/page_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ namespace permissions {
class ChooserContextBase;
}

namespace ui {
class Event;
}

class HostContentSettingsMap;
class PageInfoDelegate;
class PageInfoUI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "components/page_load_metrics/browser/page_load_metrics_event.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer_delegate.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/base/host_port_pair.h"
Expand Down
1 change: 1 addition & 0 deletions components/paint_preview/browser/paint_preview_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "components/ukm/content/source_url_recorder.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
Expand Down
1 change: 1 addition & 0 deletions components/safe_browsing/content/triggers/trigger_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <string>

#include "base/strings/string_util.h"
#include "content/public/browser/render_frame_host.h"

namespace safe_browsing {
Expand Down
1 change: 1 addition & 0 deletions content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,7 @@ source_set("browser") {
"renderer_host/raw_clipboard_host_impl.h",
"renderer_host/recently_destroyed_hosts.cc",
"renderer_host/recently_destroyed_hosts.h",
"renderer_host/render_frame_host.cc",
"renderer_host/render_frame_host_csp_context.cc",
"renderer_host/render_frame_host_csp_context.h",
"renderer_host/render_frame_host_delegate.cc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_MAC_H_

#include "content/browser/accessibility/accessibility_event_recorder.h"

#include "base/mac/scoped_cftyperef.h"
#include "content/browser/accessibility/browser_accessibility_cocoa.h"

@class BrowserAccessibilityCocoa;
Expand Down
12 changes: 12 additions & 0 deletions content/browser/renderer_host/render_frame_host.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/public/browser/render_frame_host.h"

// render_frame_host.h is a widely included header and its size has significant
// impact on build time. Try not to raise this limit unless necessary. See
// https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md
#ifndef NACL_TC_REV
#pragma clang max_tokens_here 650000
#endif
11 changes: 6 additions & 5 deletions content/browser/renderer_host/render_frame_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ PendingNavigation::PendingNavigation(
navigation_client(std::move(navigation_client)) {}

// static
RenderFrameHost* RenderFrameHost::FromID(GlobalFrameRoutingId id) {
RenderFrameHost* RenderFrameHost::FromID(const GlobalFrameRoutingId& id) {
return RenderFrameHostImpl::FromID(id);
}

Expand Down Expand Up @@ -1037,7 +1037,7 @@ RenderFrameHostImpl* RenderFrameHostImpl::FromFrameToken(
}

// static
RenderFrameHost* RenderFrameHost::FromAXTreeID(ui::AXTreeID ax_tree_id) {
RenderFrameHost* RenderFrameHost::FromAXTreeID(const ui::AXTreeID& ax_tree_id) {
return RenderFrameHostImpl::FromAXTreeID(ax_tree_id);
}

Expand Down Expand Up @@ -1750,7 +1750,7 @@ void RenderFrameHostImpl::ExecuteMediaPlayerActionAtLocation(
}

bool RenderFrameHostImpl::CreateNetworkServiceDefaultFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
mojo::PendingReceiver<network::mojom::URLLoaderFactory>&&
default_factory_receiver) {
// By providing null |navigation_request| we will always use the last
// committed Origin and ClientSecurityState (using GetPageUkmSourceId()
Expand Down Expand Up @@ -1857,7 +1857,7 @@ void RenderFrameHostImpl::AddMessageToConsole(
void RenderFrameHostImpl::ExecuteJavaScriptMethod(
const std::u16string& object_name,
const std::u16string& method_name,
base::Value arguments,
base::Value&& arguments,
JavaScriptResultCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(arguments.is_list());
Expand Down Expand Up @@ -3943,7 +3943,8 @@ void RenderFrameHostImpl::ReportInspectorIssue(
this, std::move(info));
}

void RenderFrameHostImpl::WriteIntoTracedValue(perfetto::TracedValue context) {
void RenderFrameHostImpl::WriteIntoTracedValue(
perfetto::TracedValue&& context) {
auto dict = std::move(context).WriteDictionary();
dict.Add("process", GetProcess());
dict.Add("routing_id", GetRoutingID());
Expand Down
7 changes: 4 additions & 3 deletions content/browser/renderer_host/render_frame_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
#include "third_party/blink/public/common/loader/previews_state.h"
#include "third_party/blink/public/common/permissions_policy/document_policy.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
Expand Down Expand Up @@ -339,7 +340,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
const std::string& message) override;
void ExecuteJavaScriptMethod(const std::u16string& object_name,
const std::u16string& method_name,
base::Value arguments,
base::Value&& arguments,
JavaScriptResultCallback callback) override;
void ExecuteJavaScript(const std::u16string& javascript,
JavaScriptResultCallback callback) override;
Expand Down Expand Up @@ -388,7 +389,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
const gfx::Point&,
const blink::mojom::MediaPlayerAction& action) override;
bool CreateNetworkServiceDefaultFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
mojo::PendingReceiver<network::mojom::URLLoaderFactory>&&
default_factory_receiver) override;
void MarkIsolatedWorldsAsRequiringSeparateURLLoaderFactory(
base::flat_set<url::Origin> isolated_world_origins,
Expand Down Expand Up @@ -419,7 +420,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
StoragePartition* GetStoragePartition() override;
BrowserContext* GetBrowserContext() override;
void ReportInspectorIssue(blink::mojom::InspectorIssueInfoPtr info) override;
void WriteIntoTracedValue(perfetto::TracedValue context) override;
void WriteIntoTracedValue(perfetto::TracedValue&& context) override;

// Determines if a clipboard paste using |data| of type |data_type| is allowed
// in this renderer frame. The implementation delegates to
Expand Down

0 comments on commit 7d15b70

Please sign in to comment.