mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:42:44 +00:00 
			
		
		
		
	WindowServer: Get rid of the WSWindow lock now that accesses are serial.
This commit is contained in:
		
							parent
							
								
									e5df2a5d5b
								
							
						
					
					
						commit
						c4703bedea
					
				
					 4 changed files with 17 additions and 43 deletions
				
			
		|  | @ -68,7 +68,6 @@ WSWindow& WSMenu::ensure_menu_window() | |||
|         } | ||||
| 
 | ||||
|         auto window = make<WSWindow>(*this); | ||||
|         WSWindowLocker locker(*window); | ||||
|         window->set_rect(0, 0, width(), height()); | ||||
|         m_menu_window = move(window); | ||||
|         draw(); | ||||
|  | @ -79,7 +78,6 @@ WSWindow& WSMenu::ensure_menu_window() | |||
| void WSMenu::draw() | ||||
| { | ||||
|     ASSERT(menu_window()); | ||||
|     WSWindowLocker locker(*menu_window()); | ||||
|     ASSERT(menu_window()->backing()); | ||||
|     Painter painter(*menu_window()->backing()); | ||||
| 
 | ||||
|  | @ -105,7 +103,6 @@ void WSMenu::draw() | |||
| 
 | ||||
| void WSMenu::on_window_message(WSMessage& message) | ||||
| { | ||||
|     WSWindowLocker locker(*menu_window()); | ||||
|     ASSERT(menu_window()); | ||||
|     if (message.type() == WSMessage::MouseMove) { | ||||
|         auto* item = item_at(static_cast<WSMouseEvent&>(message).position()); | ||||
|  |  | |||
|  | @ -5,16 +5,14 @@ | |||
| #include <WindowServer/WSClientConnection.h> | ||||
| 
 | ||||
| WSWindow::WSWindow(WSMenu& menu) | ||||
|     : m_lock("WSWindow (menu)") | ||||
|     , m_type(WSWindowType::Menu) | ||||
|     : m_type(WSWindowType::Menu) | ||||
|     , m_menu(&menu) | ||||
| { | ||||
|     WSWindowManager::the().add_window(*this); | ||||
| } | ||||
| 
 | ||||
| WSWindow::WSWindow(int client_id, int window_id) | ||||
|     : m_lock("WSWindow (normal)") | ||||
|     , m_client_id(client_id) | ||||
|     : m_client_id(client_id) | ||||
|     , m_type(WSWindowType::Normal) | ||||
|     , m_window_id(window_id) | ||||
| { | ||||
|  | @ -28,21 +26,15 @@ WSWindow::~WSWindow() | |||
| 
 | ||||
| void WSWindow::set_title(String&& title) | ||||
| { | ||||
|     { | ||||
|         WSWindowLocker locker(*this); | ||||
|     if (m_title == title) | ||||
|         return; | ||||
|     m_title = move(title); | ||||
|     } | ||||
| 
 | ||||
|     WSWindowManager::the().notify_title_changed(*this); | ||||
| } | ||||
| 
 | ||||
| void WSWindow::set_rect(const Rect& rect) | ||||
| { | ||||
|     Rect old_rect; | ||||
|     { | ||||
|         WSWindowLocker locker(*this); | ||||
|     auto* client = WSClientConnection::from_client_id(m_client_id); | ||||
|     if (!client && !m_menu) | ||||
|         return; | ||||
|  | @ -57,7 +49,6 @@ void WSWindow::set_rect(const Rect& rect) | |||
|             m_backing = client->create_bitmap(m_rect.size()); | ||||
| 
 | ||||
|     } | ||||
|     } | ||||
|     WSWindowManager::the().notify_rect_changed(*this, old_rect, rect); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,15 +4,12 @@ | |||
| #include <SharedGraphics/GraphicsBitmap.h> | ||||
| #include <AK/AKString.h> | ||||
| #include <AK/InlineLinkedList.h> | ||||
| #include <AK/Lock.h> | ||||
| #include <AK/Badge.h> | ||||
| #include "WSMessageReceiver.h" | ||||
| #include <WindowServer/WSWindowType.h> | ||||
| 
 | ||||
| class WSMenu; | ||||
| 
 | ||||
| class WSWindow final : public WSMessageReceiver, public InlineLinkedListNode<WSWindow> { | ||||
|     friend class WSWindowLocker; | ||||
| public: | ||||
|     WSWindow(int client_id, int window_id); | ||||
|     explicit WSWindow(WSMenu&); | ||||
|  | @ -66,7 +63,6 @@ public: | |||
|     WSWindow* m_prev { nullptr }; | ||||
| 
 | ||||
| private: | ||||
|     Lock m_lock; | ||||
|     int m_client_id { 0 }; | ||||
|     String m_title; | ||||
|     Rect m_rect; | ||||
|  | @ -80,12 +76,3 @@ private: | |||
|     RetainPtr<GraphicsBitmap> m_backing; | ||||
|     int m_window_id { -1 }; | ||||
| }; | ||||
| 
 | ||||
| class WSWindowLocker { | ||||
| public: | ||||
|     WSWindowLocker(WSWindow& window) : m_locker(window.m_lock) { } | ||||
|     ~WSWindowLocker() { } | ||||
| private: | ||||
|     Locker m_locker; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -633,7 +633,6 @@ void WSWindowManager::compose() | |||
|     } | ||||
| 
 | ||||
|     for_each_visible_window_from_back_to_front([&] (WSWindow& window) { | ||||
|         WSWindowLocker locker(window); | ||||
|         RetainPtr<GraphicsBitmap> backing = window.backing(); | ||||
|         if (!backing) | ||||
|             return IterationDecision::Continue; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling