mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 fa8b64d59a
			
		
	
	
		fa8b64d59a
		
	
	
	
	
		
			
			On Serenity, it's not trivial to extract the peer pid from a socket that is created by SystemServer and then passed to a forked service process. This patch adds an API to let the WebContent process notify the UI directly, which makes the WebContent process show up in the Serenity port's TaskManagerWidget. It seems that we will need to do something of this sort in order to properly gather metrics on macOS as well, due to the way that self mach ports work.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			534 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			534 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibIPC/Decoder.h>
 | |
| #include <LibIPC/Encoder.h>
 | |
| #include <LibWebView/ProcessHandle.h>
 | |
| 
 | |
| template<>
 | |
| ErrorOr<void> IPC::encode(IPC::Encoder& encoder, WebView::ProcessHandle const& handle)
 | |
| {
 | |
|     TRY(encoder.encode(handle.pid));
 | |
|     return {};
 | |
| }
 | |
| 
 | |
| template<>
 | |
| ErrorOr<WebView::ProcessHandle> IPC::decode(IPC::Decoder& decoder)
 | |
| {
 | |
|     auto pid = TRY(decoder.decode<pid_t>());
 | |
|     return WebView::ProcessHandle { pid };
 | |
| }
 |