Replace UNREFERENCED_PARAMETER with NEBULA_UNUSED
Introduce NEBULA_UNUSED macro in platform types and replace usages of UNREFERENCED_PARAMETER across multiple source files to standardize unused-parameter handling. Update various platform stubs (Linux window/host), CEF handlers, and Windows startup code to use NEBULA_UNUSED. Also adjust NebulaController::OnWindowCloseRequested to stop force-destroying the top-level window and rely on MaybeFinishShutdown once browsers report OnBeforeClose.
This commit is contained in:
+2
-2
@@ -12,8 +12,8 @@ int APIENTRY wWinMain(HINSTANCE instance,
|
||||
HINSTANCE previous_instance,
|
||||
LPWSTR command_line,
|
||||
int show_command) {
|
||||
UNREFERENCED_PARAMETER(previous_instance);
|
||||
UNREFERENCED_PARAMETER(command_line);
|
||||
NEBULA_UNUSED(previous_instance);
|
||||
NEBULA_UNUSED(command_line);
|
||||
|
||||
const nebula::platform::AppStartup startup{instance, show_command};
|
||||
return nebula::app::RunNebula(startup, {nebula::app::AppMode::Desktop});
|
||||
|
||||
@@ -12,8 +12,8 @@ int APIENTRY wWinMain(HINSTANCE instance,
|
||||
HINSTANCE previous_instance,
|
||||
LPWSTR command_line,
|
||||
int show_command) {
|
||||
UNREFERENCED_PARAMETER(previous_instance);
|
||||
UNREFERENCED_PARAMETER(command_line);
|
||||
NEBULA_UNUSED(previous_instance);
|
||||
NEBULA_UNUSED(command_line);
|
||||
|
||||
const nebula::platform::AppStartup startup{instance, show_command};
|
||||
return nebula::app::RunNebula(startup, {nebula::app::AppMode::BigPicture});
|
||||
|
||||
@@ -252,11 +252,8 @@ void NebulaController::OnWindowCloseRequested() {
|
||||
}
|
||||
|
||||
// Do not wait for CEF to re-send WM_CLOSE to the host window. On some
|
||||
// Alloy child-window paths that message never arrives, leaving the app
|
||||
// alive with all close affordances disabled until the process is killed.
|
||||
if (window_ && window_->native_handle()) {
|
||||
nebula::platform::DestroyTopLevelWindow(window_->native_handle());
|
||||
}
|
||||
// Alloy child-window paths that message never arrives, so the controller
|
||||
// finishes shutdown once every CEF browser has reported OnBeforeClose.
|
||||
MaybeFinishShutdown();
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -82,8 +82,8 @@ bool NebulaBrowserClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(browser);
|
||||
UNREFERENCED_PARAMETER(source_process);
|
||||
NEBULA_UNUSED(browser);
|
||||
NEBULA_UNUSED(source_process);
|
||||
|
||||
if (!message || message->GetName().ToString() != kChromeCommandMessage) {
|
||||
return false;
|
||||
@@ -162,7 +162,7 @@ bool NebulaBrowserClient::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(os_event);
|
||||
NEBULA_UNUSED(os_event);
|
||||
|
||||
if (role_ == BrowserRole::Content &&
|
||||
event.type == KEYEVENT_RAWKEYDOWN &&
|
||||
@@ -194,17 +194,17 @@ bool NebulaBrowserClient::OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
bool* no_javascript_access) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(frame);
|
||||
UNREFERENCED_PARAMETER(popup_id);
|
||||
UNREFERENCED_PARAMETER(target_frame_name);
|
||||
UNREFERENCED_PARAMETER(target_disposition);
|
||||
UNREFERENCED_PARAMETER(user_gesture);
|
||||
UNREFERENCED_PARAMETER(popupFeatures);
|
||||
UNREFERENCED_PARAMETER(windowInfo);
|
||||
UNREFERENCED_PARAMETER(client);
|
||||
UNREFERENCED_PARAMETER(settings);
|
||||
UNREFERENCED_PARAMETER(extra_info);
|
||||
UNREFERENCED_PARAMETER(no_javascript_access);
|
||||
NEBULA_UNUSED(frame);
|
||||
NEBULA_UNUSED(popup_id);
|
||||
NEBULA_UNUSED(target_frame_name);
|
||||
NEBULA_UNUSED(target_disposition);
|
||||
NEBULA_UNUSED(user_gesture);
|
||||
NEBULA_UNUSED(popupFeatures);
|
||||
NEBULA_UNUSED(windowInfo);
|
||||
NEBULA_UNUSED(client);
|
||||
NEBULA_UNUSED(settings);
|
||||
NEBULA_UNUSED(extra_info);
|
||||
NEBULA_UNUSED(no_javascript_access);
|
||||
|
||||
if (role_ == BrowserRole::Content && delegate_) {
|
||||
delegate_->OnPopupRequested(browser, target_url.ToString());
|
||||
@@ -233,8 +233,8 @@ void NebulaBrowserClient::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(canGoBack);
|
||||
UNREFERENCED_PARAMETER(canGoForward);
|
||||
NEBULA_UNUSED(canGoBack);
|
||||
NEBULA_UNUSED(canGoForward);
|
||||
|
||||
if (role_ == BrowserRole::Content && delegate_) {
|
||||
delegate_->OnContentLoadingStateChanged(browser, isLoading);
|
||||
@@ -245,7 +245,7 @@ void NebulaBrowserClient::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
TransitionType transition_type) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(transition_type);
|
||||
NEBULA_UNUSED(transition_type);
|
||||
|
||||
if (role_ == BrowserRole::Content && delegate_ && frame && frame->IsMain()) {
|
||||
delegate_->OnContentLoadProgressChanged(browser, 0.12);
|
||||
@@ -275,9 +275,9 @@ bool NebulaBrowserClient::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
bool user_gesture,
|
||||
bool is_redirect) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(browser);
|
||||
UNREFERENCED_PARAMETER(user_gesture);
|
||||
UNREFERENCED_PARAMETER(is_redirect);
|
||||
NEBULA_UNUSED(browser);
|
||||
NEBULA_UNUSED(user_gesture);
|
||||
NEBULA_UNUSED(is_redirect);
|
||||
|
||||
if (role_ == BrowserRole::Content && frame && frame->IsMain() && request) {
|
||||
const std::string url = request->GetURL().ToString();
|
||||
@@ -309,8 +309,8 @@ bool NebulaBrowserClient::OnShowPermissionPrompt(
|
||||
uint32_t requested_permissions,
|
||||
CefRefPtr<CefPermissionPromptCallback> callback) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
UNREFERENCED_PARAMETER(prompt_id);
|
||||
UNREFERENCED_PARAMETER(requesting_origin);
|
||||
NEBULA_UNUSED(prompt_id);
|
||||
NEBULA_UNUSED(requesting_origin);
|
||||
|
||||
if (role_ == BrowserRole::Content &&
|
||||
(requested_permissions & CEF_PERMISSION_TYPE_GEOLOCATION) != 0 &&
|
||||
|
||||
@@ -16,8 +16,8 @@ public:
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) override {
|
||||
UNREFERENCED_PARAMETER(object);
|
||||
UNREFERENCED_PARAMETER(retval);
|
||||
NEBULA_UNUSED(object);
|
||||
NEBULA_UNUSED(retval);
|
||||
|
||||
if (name != "postMessage" && name != "sendToHost" && name != "send") {
|
||||
return false;
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
|
||||
void NebulaApp::OnBeforeCommandLineProcessing(const CefString& process_type,
|
||||
CefRefPtr<CefCommandLine> command_line) {
|
||||
UNREFERENCED_PARAMETER(process_type);
|
||||
NEBULA_UNUSED(process_type);
|
||||
|
||||
// The bundled UI is loaded from file:// and uses ES modules.
|
||||
command_line->AppendSwitch("allow-file-access-from-files");
|
||||
@@ -92,8 +92,8 @@ void NebulaApp::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
CEF_REQUIRE_RENDERER_THREAD();
|
||||
UNREFERENCED_PARAMETER(browser);
|
||||
UNREFERENCED_PARAMETER(frame);
|
||||
NEBULA_UNUSED(browser);
|
||||
NEBULA_UNUSED(frame);
|
||||
|
||||
CefRefPtr<CefV8Value> global = context->GetGlobal();
|
||||
CefRefPtr<NativeBridgeHandler> handler = new NativeBridgeHandler();
|
||||
|
||||
@@ -21,32 +21,32 @@ CefWindowInfo MakeDevToolsPopup(NativeWindow parent, const char* title) {
|
||||
}
|
||||
|
||||
void ResizeBrowserWindow(NativeWindow browser_window, const Rect& rect) {
|
||||
UNREFERENCED_PARAMETER(browser_window);
|
||||
UNREFERENCED_PARAMETER(rect);
|
||||
NEBULA_UNUSED(browser_window);
|
||||
NEBULA_UNUSED(rect);
|
||||
}
|
||||
|
||||
void SetBrowserVisible(NativeWindow browser_window, bool visible) {
|
||||
UNREFERENCED_PARAMETER(browser_window);
|
||||
UNREFERENCED_PARAMETER(visible);
|
||||
NEBULA_UNUSED(browser_window);
|
||||
NEBULA_UNUSED(visible);
|
||||
}
|
||||
|
||||
void RaiseBrowserWindow(NativeWindow browser_window) {
|
||||
UNREFERENCED_PARAMETER(browser_window);
|
||||
NEBULA_UNUSED(browser_window);
|
||||
}
|
||||
|
||||
void MoveCursorToBrowserPoint(NativeWindow browser_window, int x, int y) {
|
||||
UNREFERENCED_PARAMETER(browser_window);
|
||||
UNREFERENCED_PARAMETER(x);
|
||||
UNREFERENCED_PARAMETER(y);
|
||||
NEBULA_UNUSED(browser_window);
|
||||
NEBULA_UNUSED(x);
|
||||
NEBULA_UNUSED(y);
|
||||
}
|
||||
|
||||
int ScaleForParentWindow(NativeWindow parent, int value) {
|
||||
UNREFERENCED_PARAMETER(parent);
|
||||
NEBULA_UNUSED(parent);
|
||||
return value;
|
||||
}
|
||||
|
||||
std::pair<int, int> ParentClientSize(NativeWindow parent) {
|
||||
UNREFERENCED_PARAMETER(parent);
|
||||
NEBULA_UNUSED(parent);
|
||||
return {1280, 720};
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ std::string CacheBusterToken() {
|
||||
}
|
||||
|
||||
void DestroyTopLevelWindow(NativeWindow window) {
|
||||
UNREFERENCED_PARAMETER(window);
|
||||
NEBULA_UNUSED(window);
|
||||
}
|
||||
|
||||
} // namespace nebula::platform
|
||||
|
||||
@@ -16,7 +16,7 @@ NebulaWindow::NebulaWindow(WindowDelegate* delegate)
|
||||
NebulaWindow::~NebulaWindow() = default;
|
||||
|
||||
bool NebulaWindow::Create(const platform::AppStartup& startup) {
|
||||
UNREFERENCED_PARAMETER(startup);
|
||||
NEBULA_UNUSED(startup);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,21 +25,21 @@ platform::NativeWindow NebulaWindow::native_handle() const {
|
||||
}
|
||||
|
||||
BrowserLayout NebulaWindow::CurrentLayout(bool show_chrome) const {
|
||||
UNREFERENCED_PARAMETER(show_chrome);
|
||||
NEBULA_UNUSED(show_chrome);
|
||||
return {};
|
||||
}
|
||||
|
||||
void NebulaWindow::ResizeChild(platform::NativeWindow child, const platform::Rect& rect) const {
|
||||
UNREFERENCED_PARAMETER(child);
|
||||
UNREFERENCED_PARAMETER(rect);
|
||||
NEBULA_UNUSED(child);
|
||||
NEBULA_UNUSED(rect);
|
||||
}
|
||||
|
||||
void NebulaWindow::Minimize() {}
|
||||
void NebulaWindow::ToggleMaximize() {}
|
||||
void NebulaWindow::SetFullscreen(bool fullscreen) { UNREFERENCED_PARAMETER(fullscreen); }
|
||||
void NebulaWindow::SetFullscreen(bool fullscreen) { NEBULA_UNUSED(fullscreen); }
|
||||
void NebulaWindow::Close() {}
|
||||
void NebulaWindow::BeginDrag() {}
|
||||
void NebulaWindow::SetTitle(const std::string& title) { UNREFERENCED_PARAMETER(title); }
|
||||
void NebulaWindow::EnableFrameHitTest(platform::NativeWindow child) const { UNREFERENCED_PARAMETER(child); }
|
||||
void NebulaWindow::SetTitle(const std::string& title) { NEBULA_UNUSED(title); }
|
||||
void NebulaWindow::EnableFrameHitTest(platform::NativeWindow child) const { NEBULA_UNUSED(child); }
|
||||
|
||||
} // namespace nebula::window
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef UNREFERENCED_PARAMETER
|
||||
#define UNREFERENCED_PARAMETER(P) (void)(P)
|
||||
#ifndef NEBULA_UNUSED
|
||||
#define NEBULA_UNUSED(P) (void)(P)
|
||||
#endif
|
||||
|
||||
namespace nebula::platform {
|
||||
|
||||
@@ -44,7 +44,7 @@ CefMainArgs MakeMainArgs(const AppStartup& startup) {
|
||||
}
|
||||
|
||||
void InitCommandLine(CefRefPtr<CefCommandLine> command_line, const AppStartup& startup) {
|
||||
UNREFERENCED_PARAMETER(startup);
|
||||
NEBULA_UNUSED(startup);
|
||||
command_line->InitFromString(::GetCommandLineW());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user