From f82c11c0793269f483e03fc6f1a3a93aa1d092f0 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 11 Jan 2008 22:45:06 +0000 Subject: [PATCH] bonefish+mmlr: * Move most of MIME database support out of libbe and into registrar * Use the (async) MessageDeliverer instead of a synchronous SendMessage in _SendMonitorUpdate This fixes a deadlock when the message port of a MIME database watching application gets full as documented in bug #1311. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23423 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/storage/Jamfile | 11 ----------- src/servers/registrar/Jamfile | 15 +++++++++++++++ src/servers/registrar/MIMEManager.cpp | 17 +++++++++-------- src/servers/registrar/MIMEManager.h | 3 ++- .../registrar}/mime/AssociatedTypes.cpp | 4 ++-- .../servers/registrar}/mime/AssociatedTypes.h | 0 .../mime/CreateAppMetaMimeThread.cpp | 8 ++++---- .../registrar}/mime/CreateAppMetaMimeThread.h | 2 +- .../registrar}/mime/Database.cpp | 7 ++++--- .../servers/registrar}/mime/Database.h | 18 ++++++++++-------- .../registrar}/mime/InstalledTypes.cpp | 3 ++- .../servers/registrar}/mime/InstalledTypes.h | 3 +-- .../registrar}/mime/MimeSnifferAddon.cpp | 2 +- .../mime/MimeSnifferAddonManager.cpp | 5 +++-- .../registrar}/mime/MimeSnifferAddonManager.h | 0 .../registrar}/mime/MimeUpdateThread.cpp | 3 ++- .../servers/registrar}/mime/MimeUpdateThread.h | 0 .../registrar}/mime/SnifferRules.cpp | 9 +++++---- .../servers/registrar}/mime/SnifferRules.h | 0 .../registrar}/mime/Supertype.cpp | 2 +- .../servers/registrar}/mime/Supertype.h | 0 .../registrar}/mime/SupportingApps.cpp | 2 +- .../servers/registrar}/mime/SupportingApps.h | 0 .../registrar}/mime/UpdateMimeInfoThread.cpp | 2 +- .../registrar}/mime/UpdateMimeInfoThread.h | 2 +- 25 files changed, 65 insertions(+), 53 deletions(-) rename src/{kits/storage => servers/registrar}/mime/AssociatedTypes.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/AssociatedTypes.h (100%) rename src/{kits/storage => servers/registrar}/mime/CreateAppMetaMimeThread.cpp (98%) rename {headers/private/storage => src/servers/registrar}/mime/CreateAppMetaMimeThread.h (96%) rename src/{kits/storage => servers/registrar}/mime/Database.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/Database.h (97%) rename src/{kits/storage => servers/registrar}/mime/InstalledTypes.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/InstalledTypes.h (98%) rename src/{kits/storage => servers/registrar}/mime/MimeSnifferAddon.cpp (95%) rename src/{kits/storage => servers/registrar}/mime/MimeSnifferAddonManager.cpp (98%) rename {headers/private/storage => src/servers/registrar}/mime/MimeSnifferAddonManager.h (100%) rename src/{kits/storage => servers/registrar}/mime/MimeUpdateThread.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/MimeUpdateThread.h (100%) rename src/{kits/storage => servers/registrar}/mime/SnifferRules.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/SnifferRules.h (100%) rename src/{kits/storage => servers/registrar}/mime/Supertype.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/Supertype.h (100%) rename src/{kits/storage => servers/registrar}/mime/SupportingApps.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/SupportingApps.h (100%) rename src/{kits/storage => servers/registrar}/mime/UpdateMimeInfoThread.cpp (99%) rename {headers/private/storage => src/servers/registrar}/mime/UpdateMimeInfoThread.h (96%) diff --git a/src/kits/storage/Jamfile b/src/kits/storage/Jamfile index c2e180e4bc..852b75afb7 100644 --- a/src/kits/storage/Jamfile +++ b/src/kits/storage/Jamfile @@ -45,17 +45,6 @@ MergeObject storage_kit.o : storage_support.cpp # mime - AssociatedTypes.cpp - CreateAppMetaMimeThread.cpp - Database.cpp - InstalledTypes.cpp - MimeSnifferAddon.cpp - MimeSnifferAddonManager.cpp - MimeUpdateThread.cpp - SnifferRules.cpp - Supertype.cpp - SupportingApps.cpp - UpdateMimeInfoThread.cpp database_access.cpp database_support.cpp diff --git a/src/servers/registrar/Jamfile b/src/servers/registrar/Jamfile index 3ac4b4a7b5..6531173243 100644 --- a/src/servers/registrar/Jamfile +++ b/src/servers/registrar/Jamfile @@ -7,6 +7,8 @@ UsePrivateHeaders storage ; UsePrivateHeaders tracker ; UseArchHeaders $(TARGET_ARCH) ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) mime ] ; + Server registrar : AppInfoList.cpp @@ -33,6 +35,19 @@ Server registrar TRoster.cpp Watcher.cpp WatchingService.cpp + + # mime + AssociatedTypes.cpp + CreateAppMetaMimeThread.cpp + Database.cpp + InstalledTypes.cpp + MimeSnifferAddon.cpp + MimeSnifferAddonManager.cpp + MimeUpdateThread.cpp + SnifferRules.cpp + Supertype.cpp + SupportingApps.cpp + UpdateMimeInfoThread.cpp : be $(TARGET_LIBSTDC++) diff --git a/src/servers/registrar/MIMEManager.cpp b/src/servers/registrar/MIMEManager.cpp index 58d4c50334..a1cbaa715c 100644 --- a/src/servers/registrar/MIMEManager.cpp +++ b/src/servers/registrar/MIMEManager.cpp @@ -1,26 +1,27 @@ // MIMEManager.cpp +#include "MIMEManager.h" + +#include +#include + #include #include #include #include -#include -#include -#include #include #include #include #include -#include -#include +#include "CreateAppMetaMimeThread.h" +#include "MimeSnifferAddonManager.h" +#include "TextSnifferAddon.h" +#include "UpdateMimeInfoThread.h" using namespace std; using namespace BPrivate; -#include "MIMEManager.h" -#include "TextSnifferAddon.h" - /*! \class MIMEManager \brief MIMEManager handles communication between BMimeType and the system-wide diff --git a/src/servers/registrar/MIMEManager.h b/src/servers/registrar/MIMEManager.h index e04db42871..7eda3ab9b7 100644 --- a/src/servers/registrar/MIMEManager.h +++ b/src/servers/registrar/MIMEManager.h @@ -4,9 +4,10 @@ #define MIME_MANAGER_H #include -#include #include +#include "Database.h" + class MIMEManager : public BLooper { public: MIMEManager(); diff --git a/src/kits/storage/mime/AssociatedTypes.cpp b/src/servers/registrar/mime/AssociatedTypes.cpp similarity index 99% rename from src/kits/storage/mime/AssociatedTypes.cpp rename to src/servers/registrar/mime/AssociatedTypes.cpp index 0ca232fee0..27eb14949e 100644 --- a/src/kits/storage/mime/AssociatedTypes.cpp +++ b/src/servers/registrar/mime/AssociatedTypes.cpp @@ -7,7 +7,8 @@ AssociatedTypes class implementation */ -#include "mime/AssociatedTypes.h" +#include "AssociatedTypes.h" +#include "MimeSnifferAddonManager.h" #include #include @@ -16,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/headers/private/storage/mime/AssociatedTypes.h b/src/servers/registrar/mime/AssociatedTypes.h similarity index 100% rename from headers/private/storage/mime/AssociatedTypes.h rename to src/servers/registrar/mime/AssociatedTypes.h diff --git a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp b/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp similarity index 98% rename from src/kits/storage/mime/CreateAppMetaMimeThread.cpp rename to src/servers/registrar/mime/CreateAppMetaMimeThread.cpp index e9b915bd32..bb7f46160b 100644 --- a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp +++ b/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp @@ -8,8 +8,9 @@ */ -#include "mime/CreateAppMetaMimeThread.h" -#include "mime/database_support.h" +#include "CreateAppMetaMimeThread.h" + +#include #include #include @@ -19,8 +20,7 @@ #include #include -#include - +#include namespace BPrivate { namespace Storage { diff --git a/headers/private/storage/mime/CreateAppMetaMimeThread.h b/src/servers/registrar/mime/CreateAppMetaMimeThread.h similarity index 96% rename from headers/private/storage/mime/CreateAppMetaMimeThread.h rename to src/servers/registrar/mime/CreateAppMetaMimeThread.h index acab27d886..aec4b1cbb6 100644 --- a/headers/private/storage/mime/CreateAppMetaMimeThread.h +++ b/src/servers/registrar/mime/CreateAppMetaMimeThread.h @@ -10,7 +10,7 @@ #ifndef _CREATE_APP_META_MIME_THREAD_H #define _CREATE_APP_META_MIME_THREAD_H -#include +#include "MimeUpdateThread.h" namespace BPrivate { namespace Storage { diff --git a/src/kits/storage/mime/Database.cpp b/src/servers/registrar/mime/Database.cpp similarity index 99% rename from src/kits/storage/mime/Database.cpp rename to src/servers/registrar/mime/Database.cpp index d1aa273518..8666334aef 100644 --- a/src/kits/storage/mime/Database.cpp +++ b/src/servers/registrar/mime/Database.cpp @@ -8,7 +8,7 @@ */ -#include +#include "Database.h" #include #include @@ -34,6 +34,7 @@ #include #include +#include "MessageDeliverer.h" //#define DBG(x) x #define DBG(x) @@ -1374,9 +1375,9 @@ Database::_SendMonitorUpdate(BMessage &msg) status_t err; std::set::const_iterator i; for (i = fMonitorMessengers.begin(); i != fMonitorMessengers.end(); i++) { - status_t err = (*i).SendMessage(&msg, (BHandler*)NULL); + status_t err = MessageDeliverer::Default()->DeliverMessage(&msg, *i); if (err) { - DBG(OUT("Database::_SendMonitorUpdate(BMessage&): BMessenger::SendMessage failed, 0x%lx\n", err)); + DBG(OUT("Database::_SendMonitorUpdate(BMessage&): DeliverMessage failed, 0x%lx\n", err)); } } // DBG(OUT("Database::_SendMonitorUpdate(BMessage&) done\n")); diff --git a/headers/private/storage/mime/Database.h b/src/servers/registrar/mime/Database.h similarity index 97% rename from headers/private/storage/mime/Database.h rename to src/servers/registrar/mime/Database.h index 1470ed852e..ba512776b6 100644 --- a/headers/private/storage/mime/Database.h +++ b/src/servers/registrar/mime/Database.h @@ -8,19 +8,21 @@ #ifndef _MIME_DATABASE_H #define _MIME_DATABASE_H +#include +#include +#include #include -#include -#include -#include -#include -#include #include #include -#include -#include -#include +#include + +#include "AssociatedTypes.h" +#include "InstalledTypes.h" +#include "SnifferRules.h" +#include "SupportingApps.h" + class BNode; class BBitmap; diff --git a/src/kits/storage/mime/InstalledTypes.cpp b/src/servers/registrar/mime/InstalledTypes.cpp similarity index 99% rename from src/kits/storage/mime/InstalledTypes.cpp rename to src/servers/registrar/mime/InstalledTypes.cpp index d9fcf33d64..661b37438f 100644 --- a/src/kits/storage/mime/InstalledTypes.cpp +++ b/src/servers/registrar/mime/InstalledTypes.cpp @@ -9,7 +9,8 @@ */ -#include "mime/InstalledTypes.h" +#include "InstalledTypes.h" + #include #include diff --git a/headers/private/storage/mime/InstalledTypes.h b/src/servers/registrar/mime/InstalledTypes.h similarity index 98% rename from headers/private/storage/mime/InstalledTypes.h rename to src/servers/registrar/mime/InstalledTypes.h index 8be45d55c0..1710f689fa 100644 --- a/headers/private/storage/mime/InstalledTypes.h +++ b/src/servers/registrar/mime/InstalledTypes.h @@ -10,8 +10,7 @@ #ifndef _MIME_INSTALLED_TYPES_H #define _MIME_INSTALLED_TYPES_H - -#include +#include "Supertype.h" #include #include diff --git a/src/kits/storage/mime/MimeSnifferAddon.cpp b/src/servers/registrar/mime/MimeSnifferAddon.cpp similarity index 95% rename from src/kits/storage/mime/MimeSnifferAddon.cpp rename to src/servers/registrar/mime/MimeSnifferAddon.cpp index d0c6727379..1460bbda11 100644 --- a/src/kits/storage/mime/MimeSnifferAddon.cpp +++ b/src/servers/registrar/mime/MimeSnifferAddon.cpp @@ -3,7 +3,7 @@ * All rights reserved. Distributed under the terms of the MIT License. */ -#include +#include "MimeSnifferAddon.h" // constructor BMimeSnifferAddon::BMimeSnifferAddon() diff --git a/src/kits/storage/mime/MimeSnifferAddonManager.cpp b/src/servers/registrar/mime/MimeSnifferAddonManager.cpp similarity index 98% rename from src/kits/storage/mime/MimeSnifferAddonManager.cpp rename to src/servers/registrar/mime/MimeSnifferAddonManager.cpp index 8abab3ad72..5f3d433ba0 100644 --- a/src/kits/storage/mime/MimeSnifferAddonManager.cpp +++ b/src/servers/registrar/mime/MimeSnifferAddonManager.cpp @@ -3,14 +3,15 @@ * All rights reserved. Distributed under the terms of the MIT License. */ -#include +#include "MimeSnifferAddonManager.h" #include #include -#include #include +#include "MimeSnifferAddon.h" + using std::nothrow; diff --git a/headers/private/storage/mime/MimeSnifferAddonManager.h b/src/servers/registrar/mime/MimeSnifferAddonManager.h similarity index 100% rename from headers/private/storage/mime/MimeSnifferAddonManager.h rename to src/servers/registrar/mime/MimeSnifferAddonManager.h diff --git a/src/kits/storage/mime/MimeUpdateThread.cpp b/src/servers/registrar/mime/MimeUpdateThread.cpp similarity index 99% rename from src/kits/storage/mime/MimeUpdateThread.cpp rename to src/servers/registrar/mime/MimeUpdateThread.cpp index 11cf41ea61..e671e17ac5 100644 --- a/src/kits/storage/mime/MimeUpdateThread.cpp +++ b/src/servers/registrar/mime/MimeUpdateThread.cpp @@ -12,6 +12,8 @@ MimeUpdateThread implementation */ +#include "MimeUpdateThread.h" + #include #include @@ -21,7 +23,6 @@ #include #include -#include "mime/MimeUpdateThread.h" //#define DBG(x) x #define DBG(x) diff --git a/headers/private/storage/mime/MimeUpdateThread.h b/src/servers/registrar/mime/MimeUpdateThread.h similarity index 100% rename from headers/private/storage/mime/MimeUpdateThread.h rename to src/servers/registrar/mime/MimeUpdateThread.h diff --git a/src/kits/storage/mime/SnifferRules.cpp b/src/servers/registrar/mime/SnifferRules.cpp similarity index 99% rename from src/kits/storage/mime/SnifferRules.cpp rename to src/servers/registrar/mime/SnifferRules.cpp index 8aac2709b7..fac96ec377 100644 --- a/src/kits/storage/mime/SnifferRules.cpp +++ b/src/servers/registrar/mime/SnifferRules.cpp @@ -12,22 +12,23 @@ SnifferRules class implementation */ -#include "mime/SnifferRules.h" +#include "SnifferRules.h" + +#include +#include #include #include #include #include #include -#include #include #include #include #include #include -#include -#include +#include "MimeSnifferAddonManager.h" #define DBG(x) x //#define DBG(x) diff --git a/headers/private/storage/mime/SnifferRules.h b/src/servers/registrar/mime/SnifferRules.h similarity index 100% rename from headers/private/storage/mime/SnifferRules.h rename to src/servers/registrar/mime/SnifferRules.h diff --git a/src/kits/storage/mime/Supertype.cpp b/src/servers/registrar/mime/Supertype.cpp similarity index 99% rename from src/kits/storage/mime/Supertype.cpp rename to src/servers/registrar/mime/Supertype.cpp index 8dab5ed4b4..43342fabd7 100644 --- a/src/kits/storage/mime/Supertype.cpp +++ b/src/servers/registrar/mime/Supertype.cpp @@ -7,7 +7,7 @@ Supertype class implementation */ -#include "mime/Supertype.h" +#include "Supertype.h" #include #include diff --git a/headers/private/storage/mime/Supertype.h b/src/servers/registrar/mime/Supertype.h similarity index 100% rename from headers/private/storage/mime/Supertype.h rename to src/servers/registrar/mime/Supertype.h diff --git a/src/kits/storage/mime/SupportingApps.cpp b/src/servers/registrar/mime/SupportingApps.cpp similarity index 99% rename from src/kits/storage/mime/SupportingApps.cpp rename to src/servers/registrar/mime/SupportingApps.cpp index b9609b7450..69d6b92687 100644 --- a/src/kits/storage/mime/SupportingApps.cpp +++ b/src/servers/registrar/mime/SupportingApps.cpp @@ -9,7 +9,7 @@ */ -#include +#include "SupportingApps.h" #include #include diff --git a/headers/private/storage/mime/SupportingApps.h b/src/servers/registrar/mime/SupportingApps.h similarity index 100% rename from headers/private/storage/mime/SupportingApps.h rename to src/servers/registrar/mime/SupportingApps.h diff --git a/src/kits/storage/mime/UpdateMimeInfoThread.cpp b/src/servers/registrar/mime/UpdateMimeInfoThread.cpp similarity index 99% rename from src/kits/storage/mime/UpdateMimeInfoThread.cpp rename to src/servers/registrar/mime/UpdateMimeInfoThread.cpp index 71ac60f963..9e2489cf49 100644 --- a/src/kits/storage/mime/UpdateMimeInfoThread.cpp +++ b/src/servers/registrar/mime/UpdateMimeInfoThread.cpp @@ -7,7 +7,7 @@ UpdateMimeInfoThread implementation */ -#include "mime/UpdateMimeInfoThread.h" +#include "UpdateMimeInfoThread.h" #include #include diff --git a/headers/private/storage/mime/UpdateMimeInfoThread.h b/src/servers/registrar/mime/UpdateMimeInfoThread.h similarity index 96% rename from headers/private/storage/mime/UpdateMimeInfoThread.h rename to src/servers/registrar/mime/UpdateMimeInfoThread.h index 9dd8183a85..4ef861be1c 100644 --- a/headers/private/storage/mime/UpdateMimeInfoThread.h +++ b/src/servers/registrar/mime/UpdateMimeInfoThread.h @@ -10,7 +10,7 @@ #ifndef _MIME_UPDATE_MIME_INFO_THREAD_H #define _MIME_UPDATE_MIME_INFO_THREAD_H -#include +#include "MimeUpdateThread.h" namespace BPrivate { namespace Storage {