app_server: AppFontManager does not need a BLooper
Saves at least a thread and a few semaphores per app. Change-Id: Ied43e5944471918b34b897722346a25d159090df Reviewed-on: https://review.haiku-os.org/c/haiku/+/6073 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
6ae6a38e53
commit
e70df3f778
@ -146,7 +146,6 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
|
||||
desktop->UnlockSingleWindow();
|
||||
|
||||
fAppFontManager = new AppFontManager();
|
||||
fAppFontManager->Run();
|
||||
|
||||
STRACE(("ServerApp %s:\n", Signature()));
|
||||
STRACE(("\tBApp port: %" B_PRId32 "\n", fClientReplyPort));
|
||||
@ -211,8 +210,7 @@ ServerApp::~ServerApp()
|
||||
|
||||
fDesktop->GetCursorManager().DeleteCursors(fClientTeam);
|
||||
|
||||
fAppFontManager->Lock();
|
||||
fAppFontManager->Quit();
|
||||
delete fAppFontManager;
|
||||
|
||||
STRACE(("ServerApp %s::~ServerApp(): Exiting\n", Signature()));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ extern FT_Library gFreeTypeLibrary;
|
||||
rather than the application font.
|
||||
*/
|
||||
AppFontManager::AppFontManager()
|
||||
: FontManager("AppFontManager")
|
||||
: BLocker("AppFontManager")
|
||||
{
|
||||
fNextID = UINT16_MAX;
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include "FontManager.h"
|
||||
|
||||
#include <Locker.h>
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
@ -27,10 +29,14 @@ struct node_ref;
|
||||
\class AppFontManager AppFontManager.h
|
||||
\brief Manager for application-added fonts in the font subsystem
|
||||
*/
|
||||
class AppFontManager : public FontManager {
|
||||
class AppFontManager : public FontManager, BLocker {
|
||||
public:
|
||||
AppFontManager();
|
||||
|
||||
bool Lock() { return BLocker::Lock(); }
|
||||
void Unlock() { BLocker::Unlock(); }
|
||||
bool IsLocked() const { return BLocker::IsLocked(); }
|
||||
|
||||
status_t AddUserFontFromFile(const char* path,
|
||||
uint16& familyID, uint16& styleID);
|
||||
status_t AddUserFontFromMemory(const FT_Byte* fontAddress,
|
||||
|
@ -41,8 +41,8 @@ compare_font_families(const FontFamily* a, const FontFamily* b)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
FontManager::FontManager(const char* className)
|
||||
: BLooper(className),
|
||||
FontManager::FontManager()
|
||||
:
|
||||
fFamilies(20),
|
||||
fNextID(0)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
|
||||
#include <HashMap.h>
|
||||
#include <Looper.h>
|
||||
#include <Node.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
@ -28,12 +27,15 @@ class FontStyle;
|
||||
\class FontManager FontManager.h
|
||||
\brief Base class interface used by GlobalFontManager and AppFontManager
|
||||
*/
|
||||
class FontManager : public BLooper {
|
||||
class FontManager {
|
||||
public:
|
||||
FontManager(
|
||||
const char* className = "FontManagerBase");
|
||||
FontManager();
|
||||
virtual ~FontManager();
|
||||
|
||||
virtual bool Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
virtual bool IsLocked() const = 0;
|
||||
|
||||
virtual int32 CountFamilies();
|
||||
|
||||
virtual int32 CountStyles(const char* family);
|
||||
|
@ -101,7 +101,7 @@ set_entry(node_ref& nodeRef, const char* name, BEntry& entry)
|
||||
|
||||
//! Does basic set up so that directories can be scanned
|
||||
GlobalFontManager::GlobalFontManager()
|
||||
: FontManager("GlobalFontManager"),
|
||||
: BLooper("GlobalFontManager"),
|
||||
fDirectories(10, true),
|
||||
fMappings(10, true),
|
||||
|
||||
@ -289,7 +289,7 @@ GlobalFontManager::MessageReceived(BMessage* message)
|
||||
}
|
||||
|
||||
default:
|
||||
FontManager::MessageReceived(message);
|
||||
BLooper::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "FontManager.h"
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <Looper.h>
|
||||
#include <ObjectList.h>
|
||||
|
||||
|
||||
@ -30,11 +31,15 @@ class ServerFont;
|
||||
\class GlobalFontManager GlobalFontManager.h
|
||||
\brief Manager for system fonts within the font subsystem
|
||||
*/
|
||||
class GlobalFontManager : public FontManager {
|
||||
class GlobalFontManager : public FontManager, public BLooper {
|
||||
public:
|
||||
GlobalFontManager();
|
||||
virtual ~GlobalFontManager();
|
||||
|
||||
bool Lock() { return BLooper::Lock(); }
|
||||
void Unlock() { BLooper::Unlock(); }
|
||||
bool IsLocked() const { return BLooper::IsLocked(); }
|
||||
|
||||
status_t InitCheck() { return fInitStatus; }
|
||||
|
||||
void SaveRecentFontMappings();
|
||||
|
Loading…
Reference in New Issue
Block a user