refactor: move impl classes into unnamed namespaces (#42390)

* refactor: move ReplyChannel into an anonymous namespace

* refactor: move ChunkedDataPipeReadableStream into an anonymous namespace

* refactor: move linux helpers into an anonymous namespace

* refactor: move linux helpers into an anonymous namespace
This commit is contained in:
Charles Kerr 2024-06-10 17:00:20 -05:00 committed by GitHub
parent c4abaec56a
commit f2481ed44f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 4 deletions

View file

@ -1893,6 +1893,8 @@ void WebContents::OnFirstNonEmptyLayout(
}
}
namespace {
// This object wraps the InvokeCallback so that if it gets GC'd by V8, we can
// still call the callback and send an error. Not doing so causes a Mojo DCHECK,
// since Mojo requires callbacks to be called before they are destroyed.
@ -1949,6 +1951,8 @@ class ReplyChannel : public gin::Wrappable<ReplyChannel> {
gin::WrapperInfo ReplyChannel::kWrapperInfo = {gin::kEmbedderNativeGin};
} // namespace
gin::Handle<gin_helper::internal::Event> WebContents::MakeEventWithSender(
v8::Isolate* isolate,
content::RenderFrameHost* frame,

View file

@ -25,6 +25,8 @@
namespace electron {
namespace {
const char kXdgSettings[] = "xdg-settings";
const char kXdgSettingsDefaultSchemeHandler[] = "default-url-scheme-handler";
@ -84,6 +86,8 @@ bool SetDefaultWebClient(const std::string& protocol) {
return ran_ok && exit_code == EXIT_SUCCESS;
}
} // namespace
void Browser::AddRecentDocument(const base::FilePath& path) {}
void Browser::ClearRecentDocuments() {}

View file

@ -18,6 +18,10 @@
#include "shell/common/thread_restrictions.h"
#endif
namespace electron {
namespace {
constexpr std::string_view kElectronOzonePlatformHint{
"ELECTRON_OZONE_PLATFORM_HINT"};
@ -55,10 +59,6 @@ bool HasWaylandDisplay(base::Environment* env) {
constexpr char kPlatformX11[] = "x11";
#endif
namespace electron {
namespace {
// Evaluates the environment and returns the effective platform name for the
// given |ozone_platform_hint|.
// For the "auto" value, returns "wayland" if the XDG session type is "wayland",

View file

@ -250,6 +250,8 @@ bool Converter<net::HttpRequestHeaders>::FromV8(v8::Isolate* isolate,
return true;
}
namespace {
class ChunkedDataPipeReadableStream
: public gin::Wrappable<ChunkedDataPipeReadableStream> {
public:
@ -489,9 +491,12 @@ class ChunkedDataPipeReadableStream
v8::Global<v8::ArrayBufferView> buf_;
gin_helper::Promise<int> promise_;
};
gin::WrapperInfo ChunkedDataPipeReadableStream::kWrapperInfo = {
gin::kEmbedderNativeGin};
} // namespace
// static
v8::Local<v8::Value> Converter<network::ResourceRequestBody>::ToV8(
v8::Isolate* isolate,