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
This commit is contained in:
Michael Lotz 2008-01-11 22:45:06 +00:00
parent 8d2dd6d32f
commit f82c11c079
25 changed files with 65 additions and 53 deletions

View File

@ -45,17 +45,6 @@ MergeObject <libbe>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

View File

@ -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++)

View File

@ -1,26 +1,27 @@
// MIMEManager.cpp
#include "MIMEManager.h"
#include <stdio.h>
#include <string>
#include <Bitmap.h>
#include <ClassInfo.h>
#include <Message.h>
#include <Messenger.h>
#include <mime/CreateAppMetaMimeThread.h>
#include <mime/MimeSnifferAddonManager.h>
#include <mime/UpdateMimeInfoThread.h>
#include <Path.h>
#include <RegistrarDefs.h>
#include <String.h>
#include <TypeConstants.h>
#include <stdio.h>
#include <string>
#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

View File

@ -4,9 +4,10 @@
#define MIME_MANAGER_H
#include <Looper.h>
#include <mime/Database.h>
#include <RegistrarThreadManager.h>
#include "Database.h"
class MIMEManager : public BLooper {
public:
MIMEManager();

View File

@ -7,7 +7,8 @@
AssociatedTypes class implementation
*/
#include "mime/AssociatedTypes.h"
#include "AssociatedTypes.h"
#include "MimeSnifferAddonManager.h"
#include <Directory.h>
#include <Entry.h>
@ -16,7 +17,6 @@
#include <Path.h>
#include <String.h>
#include <mime/database_support.h>
#include <mime/MimeSnifferAddonManager.h>
#include <storage_support.h>
#include <new>

View File

@ -8,8 +8,9 @@
*/
#include "mime/CreateAppMetaMimeThread.h"
#include "mime/database_support.h"
#include "CreateAppMetaMimeThread.h"
#include <stdio.h>
#include <AppFileInfo.h>
#include <Bitmap.h>
@ -19,8 +20,7 @@
#include <Path.h>
#include <String.h>
#include <stdio.h>
#include <mime/database_support.h>
namespace BPrivate {
namespace Storage {

View File

@ -10,7 +10,7 @@
#ifndef _CREATE_APP_META_MIME_THREAD_H
#define _CREATE_APP_META_MIME_THREAD_H
#include <mime/MimeUpdateThread.h>
#include "MimeUpdateThread.h"
namespace BPrivate {
namespace Storage {

View File

@ -8,7 +8,7 @@
*/
#include <mime/Database.h>
#include "Database.h"
#include <mime/database_access.h>
#include <mime/database_support.h>
@ -34,6 +34,7 @@
#include <stdio.h>
#include <string>
#include "MessageDeliverer.h"
//#define DBG(x) x
#define DBG(x)
@ -1374,9 +1375,9 @@ Database::_SendMonitorUpdate(BMessage &msg)
status_t err;
std::set<BMessenger>::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"));

View File

@ -8,19 +8,21 @@
#ifndef _MIME_DATABASE_H
#define _MIME_DATABASE_H
#include <map>
#include <set>
#include <string>
#include <Mime.h>
#include <mime/AssociatedTypes.h>
#include <mime/InstalledTypes.h>
#include <mime/SnifferRules.h>
#include <mime/SupportingApps.h>
#include <mime/database_access.h>
#include <Messenger.h>
#include <StorageDefs.h>
#include <string>
#include <map>
#include <set>
#include <mime/database_access.h>
#include "AssociatedTypes.h"
#include "InstalledTypes.h"
#include "SnifferRules.h"
#include "SupportingApps.h"
class BNode;
class BBitmap;

View File

@ -9,7 +9,8 @@
*/
#include "mime/InstalledTypes.h"
#include "InstalledTypes.h"
#include <mime/database_support.h>
#include <storage_support.h>

View File

@ -10,8 +10,7 @@
#ifndef _MIME_INSTALLED_TYPES_H
#define _MIME_INSTALLED_TYPES_H
#include <mime/Supertype.h>
#include "Supertype.h"
#include <SupportDefs.h>
#include <string>

View File

@ -3,7 +3,7 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include <MimeSnifferAddon.h>
#include "MimeSnifferAddon.h"
// constructor
BMimeSnifferAddon::BMimeSnifferAddon()

View File

@ -3,14 +3,15 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include <mime/MimeSnifferAddonManager.h>
#include "MimeSnifferAddonManager.h"
#include <new>
#include <Autolock.h>
#include <MimeSnifferAddon.h>
#include <MimeType.h>
#include "MimeSnifferAddon.h"
using std::nothrow;

View File

@ -12,6 +12,8 @@
MimeUpdateThread implementation
*/
#include "MimeUpdateThread.h"
#include <stdio.h>
#include <Directory.h>
@ -21,7 +23,6 @@
#include <Volume.h>
#include <storage_support.h>
#include "mime/MimeUpdateThread.h"
//#define DBG(x) x
#define DBG(x)

View File

@ -12,22 +12,23 @@
SnifferRules class implementation
*/
#include "mime/SnifferRules.h"
#include "SnifferRules.h"
#include <stdio.h>
#include <sys/stat.h>
#include <Directory.h>
#include <Entry.h>
#include <File.h>
#include <MimeType.h>
#include <mime/database_support.h>
#include <mime/MimeSnifferAddonManager.h>
#include <sniffer/Parser.h>
#include <sniffer/Rule.h>
#include <StorageDefs.h>
#include <storage_support.h>
#include <String.h>
#include <stdio.h>
#include <sys/stat.h>
#include "MimeSnifferAddonManager.h"
#define DBG(x) x
//#define DBG(x)

View File

@ -7,7 +7,7 @@
Supertype class implementation
*/
#include "mime/Supertype.h"
#include "Supertype.h"
#include <Message.h>
#include <mime/database_support.h>

View File

@ -9,7 +9,7 @@
*/
#include <mime/SupportingApps.h>
#include "SupportingApps.h"
#include <mime/database_support.h>
#include <storage_support.h>

View File

@ -7,7 +7,7 @@
UpdateMimeInfoThread implementation
*/
#include "mime/UpdateMimeInfoThread.h"
#include "UpdateMimeInfoThread.h"
#include <AppFileInfo.h>
#include <Bitmap.h>

View File

@ -10,7 +10,7 @@
#ifndef _MIME_UPDATE_MIME_INFO_THREAD_H
#define _MIME_UPDATE_MIME_INFO_THREAD_H
#include <mime/MimeUpdateThread.h>
#include "MimeUpdateThread.h"
namespace BPrivate {
namespace Storage {