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