* The BHandler observer mechanism was completely broken in Haiku for remote targets;
this fixes bug #1005. As a result, the Disks icon will now appear in file panels when you change that setting with a panel open. * _ObserverList is now in the BPrivate namespace (and renamed to ObserverList). * its BHandler map is now only temporarily used for handlers that do not belong to a looper yet; when BHandler::SendNotices() is called, they will be transferred into the BMessenger map. * Invalid messengers are now removed from the map when encountered. * Added TODO comments about a possible reference counting if a handler is added twice to a list (right now, this will be ignored). * All {Start|Stop}Watching() methods are now more or less safe to be used in low memory situations (adding some items to the map can still throw an exception...). * Renamed BHandler::InitData() to _InitData(). * Some refactoring and cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+21
-20
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2001-2007, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -17,12 +17,14 @@ class BLooper;
|
||||
class BMessageFilter;
|
||||
class BMessage;
|
||||
class BList;
|
||||
class _ObserverList;
|
||||
|
||||
#define B_OBSERVE_WHAT_CHANGE "be:observe_change_what"
|
||||
#define B_OBSERVE_ORIGINAL_WHAT "be:observe_orig_what"
|
||||
const uint32 B_OBSERVER_OBSERVE_ALL = 0xffffffff;
|
||||
|
||||
namespace BPrivate {
|
||||
class ObserverList;
|
||||
}
|
||||
|
||||
class BHandler : public BArchivable {
|
||||
public:
|
||||
@@ -53,31 +55,29 @@ public:
|
||||
void UnlockLooper();
|
||||
|
||||
// Scripting
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
||||
int32 index,
|
||||
BMessage* specifier,
|
||||
int32 form,
|
||||
const char* property);
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* property);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
// Observer calls, inter-looper and inter-team
|
||||
status_t StartWatching(BMessenger, uint32 what);
|
||||
status_t StartWatchingAll(BMessenger);
|
||||
status_t StopWatching(BMessenger, uint32 what);
|
||||
status_t StopWatchingAll(BMessenger);
|
||||
status_t StartWatching(BMessenger target, uint32 what);
|
||||
status_t StartWatchingAll(BMessenger target);
|
||||
status_t StopWatching(BMessenger target, uint32 what);
|
||||
status_t StopWatchingAll(BMessenger target);
|
||||
|
||||
// Observer calls for observing targets in the same BLooper
|
||||
status_t StartWatching(BHandler* , uint32 what);
|
||||
status_t StartWatchingAll(BHandler* );
|
||||
status_t StopWatching(BHandler* , uint32 what);
|
||||
status_t StopWatchingAll(BHandler* );
|
||||
// Observer calls for observing targets in the local team
|
||||
status_t StartWatching(BHandler* observer, uint32 what);
|
||||
status_t StartWatchingAll(BHandler* observer);
|
||||
status_t StopWatching(BHandler* observer, uint32 what);
|
||||
status_t StopWatchingAll(BHandler* observer);
|
||||
|
||||
|
||||
// Reserved
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
// Notifier calls
|
||||
virtual void SendNotices(uint32 what, const BMessage* = 0);
|
||||
virtual void SendNotices(uint32 what, const BMessage* notice = NULL);
|
||||
bool IsWatched() const;
|
||||
|
||||
private:
|
||||
@@ -90,18 +90,19 @@ private:
|
||||
virtual void _ReservedHandler3();
|
||||
virtual void _ReservedHandler4();
|
||||
|
||||
void InitData(const char* name);
|
||||
void _InitData(const char* name);
|
||||
BPrivate::ObserverList* _ObserverList();
|
||||
|
||||
BHandler(const BHandler&);
|
||||
BHandler& operator=(const BHandler&);
|
||||
void SetLooper(BLooper* loop);
|
||||
void SetLooper(BLooper* looper);
|
||||
|
||||
int32 fToken;
|
||||
char* fName;
|
||||
BLooper* fLooper;
|
||||
BHandler* fNextHandler;
|
||||
BList* fFilters;
|
||||
_ObserverList* fObserverList;
|
||||
BPrivate::ObserverList* fObserverList;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user