* Coding style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2011-10-29 21:04:22 +00:00
parent 78faf579e3
commit 78fcc847a2
2 changed files with 87 additions and 76 deletions
+18 -13
View File
@@ -1,19 +1,20 @@
/* /*
* Copyright 2001-2007, Haiku. * Copyright 2001-2011, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Erik Jaesler ([email protected]) * Erik Jaesler ([email protected])
*/ */
#ifndef LOOPERLIST_H #ifndef LOOPER_LIST_H
#define LOOPERLIST_H #define LOOPER_LIST_H
#include <vector>
#include <Locker.h> #include <Locker.h>
#include <OS.h> #include <OS.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include <vector>
class BList; class BList;
class BLooper; class BLooper;
@@ -21,8 +22,9 @@ class BLooper;
namespace BPrivate { namespace BPrivate {
class BLooperList { class BLooperList {
public: public:
BLooperList(); BLooperList();
bool Lock(); bool Lock();
@@ -39,7 +41,7 @@ class BLooperList {
BLooper* LooperForName(const char* name); BLooper* LooperForName(const char* name);
BLooper* LooperForPort(port_id port); BLooper* LooperForPort(port_id port);
private: private:
struct LooperData { struct LooperData {
LooperData(); LooperData();
LooperData(BLooper* looper); LooperData(BLooper* looper);
@@ -48,37 +50,40 @@ class BLooperList {
BLooper* looper; BLooper* looper;
}; };
static bool EmptySlotPred(LooperData& Data);
struct FindLooperPred { struct FindLooperPred {
FindLooperPred(const BLooper* loop) : looper(loop) {;} FindLooperPred(const BLooper* loop) : looper(loop) {}
bool operator()(LooperData& Data); bool operator()(LooperData& Data);
const BLooper* looper; const BLooper* looper;
}; };
struct FindThreadPred { struct FindThreadPred {
FindThreadPred(thread_id tid) : thread(tid) {;} FindThreadPred(thread_id tid) : thread(tid) {}
bool operator()(LooperData& Data); bool operator()(LooperData& Data);
thread_id thread; thread_id thread;
}; };
struct FindNamePred { struct FindNamePred {
FindNamePred(const char* n) : name(n) {;} FindNamePred(const char* n) : name(n) {}
bool operator()(LooperData& Data); bool operator()(LooperData& Data);
const char* name; const char* name;
}; };
struct FindPortPred { struct FindPortPred {
FindPortPred(port_id pid) : port(pid) {;} FindPortPred(port_id pid) : port(pid) {}
bool operator()(LooperData& Data); bool operator()(LooperData& Data);
port_id port; port_id port;
}; };
static bool EmptySlotPred(LooperData& Data);
void AssertLocked(); void AssertLocked();
private:
BLocker fLock; BLocker fLock;
std::vector<LooperData> fData; std::vector<LooperData> fData;
}; };
extern BLooperList gLooperList; extern BLooperList gLooperList;
} // namespace BPrivate } // namespace BPrivate
#endif // LOOPERLIST_H
#endif // LOOPER_LIST_H
+16 -10
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2007, Haiku. * Copyright 2001-2011, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -10,13 +10,12 @@
#define _TOKEN_SPACE_H #define _TOKEN_SPACE_H
#include <BeBuild.h>
#include <Locker.h>
#include <SupportDefs.h>
#include <map> #include <map>
#include <stack> #include <stack>
#include <Locker.h>
#include <SupportDefs.h>
// token types as specified in targets // token types as specified in targets
#define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */ #define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */
@@ -30,11 +29,12 @@
namespace BPrivate { namespace BPrivate {
class BDirectMessageTarget; class BDirectMessageTarget;
class BTokenSpace : public BLocker { class BTokenSpace : public BLocker {
public: public:
BTokenSpace(); BTokenSpace();
~BTokenSpace(); ~BTokenSpace();
@@ -43,12 +43,15 @@ class BTokenSpace : public BLocker {
bool RemoveToken(int32 token); bool RemoveToken(int32 token);
bool CheckToken(int32 token, int16 type) const; bool CheckToken(int32 token, int16 type) const;
status_t GetToken(int32 token, int16 type, void** _object) const; status_t GetToken(int32 token, int16 type,
void** _object) const;
status_t SetHandlerTarget(int32 token, BDirectMessageTarget* target); status_t SetHandlerTarget(int32 token,
status_t AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target); BDirectMessageTarget* target);
status_t AcquireHandlerTarget(int32 token,
BDirectMessageTarget** _target);
private: private:
struct token_info { struct token_info {
int16 type; int16 type;
void* object; void* object;
@@ -60,8 +63,11 @@ class BTokenSpace : public BLocker {
int32 fTokenCount; int32 fTokenCount;
}; };
extern BTokenSpace gDefaultTokens; extern BTokenSpace gDefaultTokens;
} // namespace BPrivate } // namespace BPrivate
#endif // _TOKEN_SPACE_H #endif // _TOKEN_SPACE_H