Turned _init_message_(), _delete_message_(), and _clean_msg_cache_() into
proper private static BMessage members and made them accessible through BMessage::Private. Got rid of unused _reconstruct_message_(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11106 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -301,8 +301,6 @@ friend class BMessenger;
|
|||||||
friend class BApplication;
|
friend class BApplication;
|
||||||
friend class Private;
|
friend class Private;
|
||||||
|
|
||||||
friend void _msg_cache_cleanup_();
|
|
||||||
friend BMessage *_reconstruct_msg_(uint32,uint32,uint32);
|
|
||||||
friend inline void _set_message_target_(BMessage *, int32, bool);
|
friend inline void _set_message_target_(BMessage *, int32, bool);
|
||||||
friend inline void _set_message_reply_(BMessage *, BMessenger);
|
friend inline void _set_message_reply_(BMessage *, BMessenger);
|
||||||
friend inline int32 _get_message_target_(BMessage *);
|
friend inline int32 _get_message_target_(BMessage *);
|
||||||
@@ -362,13 +360,15 @@ static status_t _SendFlattenedMessage(void *data, int32 size,
|
|||||||
port_id port, int32 token, bool preferred,
|
port_id port, int32 token, bool preferred,
|
||||||
bigtime_t timeout);
|
bigtime_t timeout);
|
||||||
|
|
||||||
|
static void _StaticInit();
|
||||||
|
static void _StaticCleanup();
|
||||||
|
static void _StaticCacheCleanup();
|
||||||
|
|
||||||
enum { sNumReplyPorts = 3 };
|
enum { sNumReplyPorts = 3 };
|
||||||
static port_id sReplyPorts[sNumReplyPorts];
|
static port_id sReplyPorts[sNumReplyPorts];
|
||||||
static long sReplyPortInUse[sNumReplyPorts];
|
static long sReplyPortInUse[sNumReplyPorts];
|
||||||
static int32 sGetCachedReplyPort();
|
static int32 sGetCachedReplyPort();
|
||||||
|
|
||||||
friend int _init_message_();
|
|
||||||
friend int _delete_message_();
|
|
||||||
static BBlockCache *sMsgCache;
|
static BBlockCache *sMsgCache;
|
||||||
|
|
||||||
struct dyn_array {
|
struct dyn_array {
|
||||||
|
|||||||
@@ -6,25 +6,10 @@
|
|||||||
#ifndef MESSAGEPRIVATE_H
|
#ifndef MESSAGEPRIVATE_H
|
||||||
#define MESSAGEPRIVATE_H
|
#define MESSAGEPRIVATE_H
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <MessengerPrivate.h>
|
#include <MessengerPrivate.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern "C" void _msg_cache_cleanup_();
|
|
||||||
extern "C" int _init_message_();
|
|
||||||
extern "C" int _delete_message_();
|
|
||||||
|
|
||||||
class BMessage::Private
|
class BMessage::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -36,6 +21,7 @@ class BMessage::Private
|
|||||||
fMessage->fTarget = token;
|
fMessage->fTarget = token;
|
||||||
fMessage->fPreferred = preferred;
|
fMessage->fPreferred = preferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetReply(BMessenger messenger)
|
inline void SetReply(BMessenger messenger)
|
||||||
{
|
{
|
||||||
BMessenger::Private mp(messenger);
|
BMessenger::Private mp(messenger);
|
||||||
@@ -44,10 +30,12 @@ class BMessage::Private
|
|||||||
fMessage->fReplyTo.team = mp.Team();
|
fMessage->fReplyTo.team = mp.Team();
|
||||||
fMessage->fReplyTo.preferred = mp.IsPreferredTarget();
|
fMessage->fReplyTo.preferred = mp.IsPreferredTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32 GetTarget()
|
inline int32 GetTarget()
|
||||||
{
|
{
|
||||||
return fMessage->fTarget;
|
return fMessage->fTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool UsePreferredTarget()
|
inline bool UsePreferredTarget()
|
||||||
{
|
{
|
||||||
return fMessage->fPreferred;
|
return fMessage->fPreferred;
|
||||||
@@ -60,6 +48,21 @@ class BMessage::Private
|
|||||||
preferred, timeout);
|
preferred, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void StaticInit()
|
||||||
|
{
|
||||||
|
BMessage::_StaticInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void StaticCleanup()
|
||||||
|
{
|
||||||
|
BMessage::_StaticCleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void StaticCacheCleanup()
|
||||||
|
{
|
||||||
|
BMessage::_StaticCacheCleanup();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMessage* fMessage;
|
BMessage* fMessage;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ initialize_before()
|
|||||||
{
|
{
|
||||||
DBG(OUT("initialize_before()\n"));
|
DBG(OUT("initialize_before()\n"));
|
||||||
|
|
||||||
_init_message_();
|
BMessage::Private::StaticInit();
|
||||||
BRoster::Private::InitBeRoster();
|
BRoster::Private::InitBeRoster();
|
||||||
BPrivate::init_clipboard();
|
BPrivate::init_clipboard();
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ terminate_after()
|
|||||||
DBG(OUT("terminate_after()\n"));
|
DBG(OUT("terminate_after()\n"));
|
||||||
|
|
||||||
BRoster::Private::DeleteBeRoster();
|
BRoster::Private::DeleteBeRoster();
|
||||||
_delete_message_();
|
BMessage::Private::StaticCleanup();
|
||||||
_msg_cache_cleanup_();
|
BMessage::Private::StaticCacheCleanup();
|
||||||
|
|
||||||
DBG(OUT("terminate_after() done\n"));
|
DBG(OUT("terminate_after() done\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-38
@@ -101,44 +101,6 @@ static status_t handle_reply(port_id reply_port,
|
|||||||
static status_t convert_message(const KMessage *fromMessage,
|
static status_t convert_message(const KMessage *fromMessage,
|
||||||
BMessage *toMessage);
|
BMessage *toMessage);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
extern "C" {
|
|
||||||
void _msg_cache_cleanup_()
|
|
||||||
{
|
|
||||||
delete BMessage::sMsgCache;
|
|
||||||
BMessage::sMsgCache = NULL;
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int _init_message_()
|
|
||||||
{
|
|
||||||
BMessage::sReplyPorts[0] = create_port(1, "tmp_rport0");
|
|
||||||
BMessage::sReplyPorts[1] = create_port(1, "tmp_rport1");
|
|
||||||
BMessage::sReplyPorts[2] = create_port(1, "tmp_rport2");
|
|
||||||
|
|
||||||
BMessage::sReplyPortInUse[0] = 0;
|
|
||||||
BMessage::sReplyPortInUse[1] = 0;
|
|
||||||
BMessage::sReplyPortInUse[2] = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int _delete_message_()
|
|
||||||
{
|
|
||||||
delete_port(BMessage::sReplyPorts[0]);
|
|
||||||
BMessage::sReplyPorts[0] = -1;
|
|
||||||
delete_port(BMessage::sReplyPorts[1]);
|
|
||||||
BMessage::sReplyPorts[1] = -1;
|
|
||||||
delete_port(BMessage::sReplyPorts[2]);
|
|
||||||
BMessage::sReplyPorts[2] = -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} // extern "C"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BMessage *_reconstruct_msg_(uint32,uint32,uint32)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void BMessage::_ReservedMessage1() {}
|
void BMessage::_ReservedMessage1() {}
|
||||||
void BMessage::_ReservedMessage2() {}
|
void BMessage::_ReservedMessage2() {}
|
||||||
void BMessage::_ReservedMessage3() {}
|
void BMessage::_ReservedMessage3() {}
|
||||||
@@ -1976,6 +1938,39 @@ BMessage::_SendFlattenedMessage(void *data, int32 size, port_id port,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMessage::_StaticCacheCleanup()
|
||||||
|
{
|
||||||
|
delete sMsgCache;
|
||||||
|
sMsgCache = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMessage::_StaticInit()
|
||||||
|
{
|
||||||
|
sReplyPorts[0] = create_port(1, "tmp_rport0");
|
||||||
|
sReplyPorts[1] = create_port(1, "tmp_rport1");
|
||||||
|
sReplyPorts[2] = create_port(1, "tmp_rport2");
|
||||||
|
|
||||||
|
sReplyPortInUse[0] = 0;
|
||||||
|
sReplyPortInUse[1] = 0;
|
||||||
|
sReplyPortInUse[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMessage::_StaticCleanup()
|
||||||
|
{
|
||||||
|
delete_port(sReplyPorts[0]);
|
||||||
|
sReplyPorts[0] = -1;
|
||||||
|
delete_port(sReplyPorts[1]);
|
||||||
|
sReplyPorts[1] = -1;
|
||||||
|
delete_port(sReplyPorts[2]);
|
||||||
|
sReplyPorts[2] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BMessage::sGetCachedReplyPort()
|
BMessage::sGetCachedReplyPort()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user