chore: iwyu commonly-included headers in shell/ (#50778)

* chore: iwyu in shell/browser/api/electron_api_web_contents.h

* chore: iwyu in shell/browser/browser.h

* chore: iwyu in shell/browser/javascript_environment.h

* chore: iwyu in shell/common/gin_hhelper/function_template.h

* chore: do not include node_includes.h if we are not using it

* chore: fix transitive include
This commit is contained in:
Charles Kerr
2026-04-08 09:33:42 -05:00
committed by GitHub
parent 0828de3ccd
commit 8679522922
16 changed files with 51 additions and 21 deletions

View File

@@ -77,6 +77,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/language_util.h"
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"

View File

@@ -8,7 +8,6 @@
#include "base/path_service.h"
#include "shell/common/electron_paths.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "shell/common/thread_restrictions.h"

View File

@@ -19,7 +19,6 @@
#include "shell/browser/api/electron_api_web_frame_main.h"
#include "shell/browser/native_window.h"
#include "shell/common/keyboard_util.h"
#include "shell/common/node_includes.h"
#include "ui/base/cocoa/menu_utils.h"
#include "v8/include/cppgc/allocation.h"
#include "v8/include/v8-cppgc.h"

View File

@@ -26,7 +26,6 @@
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "skia/ext/skia_utils_mac.h"

View File

@@ -47,11 +47,13 @@
#include "content/browser/renderer_host/render_widget_host_impl.h" // nogncheck
#include "content/browser/renderer_host/render_widget_host_view_base.h" // nogncheck
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/desktop_streams_registry.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_request_utils.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/file_select_listener.h"
@@ -90,9 +92,11 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "shell/browser/api/electron_api_browser_window.h"
#include "shell/browser/api/electron_api_debugger.h"
#include "shell/browser/api/electron_api_session.h"
#include "shell/browser/api/electron_api_web_frame_main.h"
#include "shell/browser/api/frame_subscriber.h"
#include "shell/browser/api/message_port.h"
#include "shell/browser/api/save_page_handler.h"
#include "shell/browser/browser.h"
#include "shell/browser/child_web_contents_tracker.h"
#include "shell/browser/electron_autofill_driver_factory.h"

View File

@@ -22,8 +22,6 @@
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" // nogncheck
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "content/common/frame.mojom-forward.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/frame_tree_node_id.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/javascript_dialog_manager.h"
@@ -33,9 +31,6 @@
#include "content/public/common/stop_find_action.h"
#include "electron/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "shell/browser/api/electron_api_debugger.h"
#include "shell/browser/api/electron_api_session.h"
#include "shell/browser/api/save_page_handler.h"
#include "shell/browser/background_throttling_source.h"
#include "shell/browser/event_emitter_mixin.h"
#include "shell/browser/extended_web_contents_observer.h"
@@ -43,13 +38,10 @@
#include "shell/browser/preload_script.h"
#include "shell/browser/ui/inspectable_web_contents_delegate.h"
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/handle.h"
#include "shell/common/gin_helper/pinnable.h"
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/web_contents_utility.mojom.h"
#include "ui/base/models/image_model.h"
#include "v8/include/cppgc/persistent.h"
@@ -66,8 +58,14 @@ struct DeviceEmulationParams;
// enum class PermissionType;
} // namespace blink
namespace base {
class FilePath;
class Value;
} // namespace base
namespace content {
enum class KeyboardEventProcessingResult;
class DevToolsAgentHost;
class WebContents;
} // namespace content
@@ -79,6 +77,8 @@ namespace gin_helper {
class Dictionary;
class ErrorThrower;
template <typename T>
class Handle;
template <typename T>
class Promise;
} // namespace gin_helper
@@ -110,7 +110,9 @@ class OffScreenWebContentsView;
namespace api {
class BaseWindow;
class Debugger;
class FrameSubscriber;
class Session;
// Wrapper around the content::WebContents.
class WebContents final : public ExclusiveAccessContext,

View File

@@ -22,6 +22,7 @@
#include "shell/browser/window_list.h"
#include "shell/common/application_info.h"
#include "shell/common/gin_converters/login_item_settings_converter.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/thread_restrictions.h"
namespace electron {

View File

@@ -15,7 +15,6 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/values.h"
#include "shell/browser/window_list_observer.h"
#include "shell/common/gin_helper/promise.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
@@ -35,7 +34,17 @@ class Arguments;
namespace gin_helper {
class Arguments;
}
template <typename T>
class Promise;
} // namespace gin_helper
namespace v8 {
template <typename T>
class Local;
class Isolate;
class Promise;
class Value;
} // namespace v8
namespace electron {

View File

@@ -42,6 +42,7 @@
#include "shell/common/gin_converters/image_converter.h"
#include "shell/common/gin_converters/login_item_settings_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/skia_util.h"
#include "shell/common/thread_restrictions.h"
#include "skia/ext/font_utils.h"

View File

@@ -17,12 +17,15 @@
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/initialization_util.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"
#include "shell/browser/microtasks_runner.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/node_includes.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/electron_node/src/node_wasm_web_api.h"
#include "v8/include/v8-isolate.h"
#include "v8/include/v8-locker.h"
namespace {
v8::Isolate* g_isolate;
@@ -137,6 +140,10 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop,
return isolate;
}
v8::Isolate* JavascriptEnvironment::isolate() const {
return isolate_holder_->isolate();
}
// static
v8::Isolate* JavascriptEnvironment::GetIsolate() {
CHECK(g_isolate);

View File

@@ -7,15 +7,22 @@
#include <memory>
#include "gin/public/isolate_holder.h"
#include "uv.h" // NOLINT(build/include_directory)
#include "v8/include/v8-locker.h"
namespace gin {
class IsolateHolder;
} // namespace gin
namespace node {
class Environment;
class MultiIsolatePlatform;
} // namespace node
namespace v8 {
class Isolate;
class Locker;
} // namespace v8
namespace electron {
class MicrotasksRunner;
@@ -34,14 +41,13 @@ class JavascriptEnvironment {
void DestroyMicrotasksRunner();
node::MultiIsolatePlatform* platform() const { return platform_.get(); }
[[nodiscard]] v8::Isolate* isolate() const {
return isolate_holder_->isolate();
}
size_t max_young_generation_size_in_bytes() const {
return max_young_generation_size_;
}
static v8::Isolate* GetIsolate();
[[nodiscard]] v8::Isolate* isolate() const;
[[nodiscard]] static v8::Isolate* GetIsolate();
private:
v8::Isolate* Initialize(uv_loop_t* event_loop, bool setup_wasm_streaming);

View File

@@ -7,6 +7,7 @@
#include <utility>
#include "base/task/sequenced_task_runner.h"
#include "content/public/browser/browser_thread.h"
#include "gin/arguments.h"
#include "gin/dictionary.h"
#include "shell/browser/api/electron_api_app.h"

View File

@@ -6,6 +6,7 @@
#include "base/i18n/rtl.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_version.h"
#include "components/embedder_support/user_agent_utils.h"

View File

@@ -13,6 +13,7 @@
#include "shell/common/gin_helper/function_template.h"
#include "shell/common/gin_helper/locker.h"
#include "v8/include/cppgc/persistent.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-function.h"
#include "v8/include/v8-microtask-queue.h"
// Implements safe conversions between JS functions and base::RepeatingCallback.

View File

@@ -16,7 +16,6 @@
#include "gin/public/gin_embedders.h"
#include "shell/common/gin_helper/destroyable.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-external.h"
#include "v8/include/v8-microtask-queue.h"
#include "v8/include/v8-template.h"

View File

@@ -15,7 +15,6 @@
#include "shell/common/gin_converters/blink_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/heap_snapshot.h"
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_util.h"
@@ -27,6 +26,7 @@
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_message_port_converter.h"
#include "v8/include/v8-context.h"
namespace electron {