feat: ServiceWorkerMain (#45341)
This commit is contained in:
parent
59e4794ff5
commit
cc6164fe27
23 changed files with 1265 additions and 50 deletions
25
shell/common/gin_converters/service_worker_converter.cc
Normal file
25
shell/common/gin_converters/service_worker_converter.cc
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright (c) 2025 Salesforce, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/gin_converters/service_worker_converter.h"
|
||||
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Converter<blink::EmbeddedWorkerStatus>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::EmbeddedWorkerStatus& val) {
|
||||
static constexpr auto Lookup =
|
||||
base::MakeFixedFlatMap<blink::EmbeddedWorkerStatus, std::string_view>({
|
||||
{blink::EmbeddedWorkerStatus::kStarting, "starting"},
|
||||
{blink::EmbeddedWorkerStatus::kRunning, "running"},
|
||||
{blink::EmbeddedWorkerStatus::kStopping, "stopping"},
|
||||
{blink::EmbeddedWorkerStatus::kStopped, "stopped"},
|
||||
});
|
||||
return StringToV8(isolate, Lookup.at(val));
|
||||
}
|
||||
|
||||
} // namespace gin
|
21
shell/common/gin_converters/service_worker_converter.h
Normal file
21
shell/common/gin_converters/service_worker_converter.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2025 Salesforce, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_SERVICE_WORKER_CONVERTER_H_
|
||||
#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_SERVICE_WORKER_CONVERTER_H_
|
||||
|
||||
#include "gin/converter.h"
|
||||
#include "third_party/blink/public/common/service_worker/embedded_worker_status.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<blink::EmbeddedWorkerStatus> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const blink::EmbeddedWorkerStatus& val);
|
||||
};
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_SERVICE_WORKER_CONVERTER_H_
|
|
@ -49,39 +49,40 @@
|
|||
#include "shell/common/crash_keys.h"
|
||||
#endif
|
||||
|
||||
#define ELECTRON_BROWSER_BINDINGS(V) \
|
||||
V(electron_browser_app) \
|
||||
V(electron_browser_auto_updater) \
|
||||
V(electron_browser_content_tracing) \
|
||||
V(electron_browser_crash_reporter) \
|
||||
V(electron_browser_desktop_capturer) \
|
||||
V(electron_browser_dialog) \
|
||||
V(electron_browser_event_emitter) \
|
||||
V(electron_browser_global_shortcut) \
|
||||
V(electron_browser_image_view) \
|
||||
V(electron_browser_in_app_purchase) \
|
||||
V(electron_browser_menu) \
|
||||
V(electron_browser_message_port) \
|
||||
V(electron_browser_native_theme) \
|
||||
V(electron_browser_notification) \
|
||||
V(electron_browser_power_monitor) \
|
||||
V(electron_browser_power_save_blocker) \
|
||||
V(electron_browser_protocol) \
|
||||
V(electron_browser_printing) \
|
||||
V(electron_browser_push_notifications) \
|
||||
V(electron_browser_safe_storage) \
|
||||
V(electron_browser_session) \
|
||||
V(electron_browser_screen) \
|
||||
V(electron_browser_system_preferences) \
|
||||
V(electron_browser_base_window) \
|
||||
V(electron_browser_tray) \
|
||||
V(electron_browser_utility_process) \
|
||||
V(electron_browser_view) \
|
||||
V(electron_browser_web_contents) \
|
||||
V(electron_browser_web_contents_view) \
|
||||
V(electron_browser_web_frame_main) \
|
||||
V(electron_browser_web_view_manager) \
|
||||
V(electron_browser_window) \
|
||||
#define ELECTRON_BROWSER_BINDINGS(V) \
|
||||
V(electron_browser_app) \
|
||||
V(electron_browser_auto_updater) \
|
||||
V(electron_browser_content_tracing) \
|
||||
V(electron_browser_crash_reporter) \
|
||||
V(electron_browser_desktop_capturer) \
|
||||
V(electron_browser_dialog) \
|
||||
V(electron_browser_event_emitter) \
|
||||
V(electron_browser_global_shortcut) \
|
||||
V(electron_browser_image_view) \
|
||||
V(electron_browser_in_app_purchase) \
|
||||
V(electron_browser_menu) \
|
||||
V(electron_browser_message_port) \
|
||||
V(electron_browser_native_theme) \
|
||||
V(electron_browser_notification) \
|
||||
V(electron_browser_power_monitor) \
|
||||
V(electron_browser_power_save_blocker) \
|
||||
V(electron_browser_protocol) \
|
||||
V(electron_browser_printing) \
|
||||
V(electron_browser_push_notifications) \
|
||||
V(electron_browser_safe_storage) \
|
||||
V(electron_browser_service_worker_main) \
|
||||
V(electron_browser_session) \
|
||||
V(electron_browser_screen) \
|
||||
V(electron_browser_system_preferences) \
|
||||
V(electron_browser_base_window) \
|
||||
V(electron_browser_tray) \
|
||||
V(electron_browser_utility_process) \
|
||||
V(electron_browser_view) \
|
||||
V(electron_browser_web_contents) \
|
||||
V(electron_browser_web_contents_view) \
|
||||
V(electron_browser_web_frame_main) \
|
||||
V(electron_browser_web_view_manager) \
|
||||
V(electron_browser_window) \
|
||||
V(electron_common_net)
|
||||
|
||||
#define ELECTRON_COMMON_BINDINGS(V) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue