[haiku-appserver] Re: [Haiku-commits] r14599 - haiku/trunk/src/servers/app

  • From: Adi Oanca <adioanca@xxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Mon, 31 Oct 2005 22:50:20 +0200

Hi Axel,

-void
-AppServer::RunLooper()
+Desktop *
+AppServer::_CreateDesktop(uid_t userID)
 {
-       rename_thread(find_thread(NULL), "picasso");
-       _message_thread((void *)this);
+       BAutolock locker(fDesktopLock);
+       Desktop* desktop = NULL;
+       try {
+               desktop = new Desktop(userID);
+
+               desktop->Init();
+               desktop->Run();
+
+               if (!fDesktops.AddItem(desktop)) {
+                       delete desktop;
+                       return NULL;
+               }
+       } catch (...) {
+               // there is obviously no memory left
+               return NULL;
+       }
+
+       return desktop;

Wanted to ask on the list for some time:
What if we avoid programming with exceptions and compile the app_server without exceptions support? This should get us some speed...
Is it possible?



+                       while (fDesktops.CountItems() > 0) {
+                               Desktop *desktop = fDesktops.RemoveItemAt(0);
...
+                       }
-                                       Layer *layer;
-                                       for (int32 i = 0; i < windowCount; ++i)
-                                               // is this layer in fact a 
WinBorder?
-                                               if ((layer = 
static_cast<Layer*>(sDesktop->WindowList().ItemAtFast(i)))) {
...
- }

To avoid a few CPU cycles please pull out local declarations from loops.

In RootLayer:
+               // is this layer in fact a WinBorder?
+               WinBorder *winBorder = WindowList().ItemAt(i);

(Not that it is the case here, but,)
Please keep in mind that RootLayer should not know WinBorders are its direct descendants. I want to keep an open mind concerning RootLayer's children. Think of bubbles, dragging something with the mouse, fading effects, other app_server's add-ons. They all could be derived from Layer.




Bye,
Adi.

Other related posts: