Cache a view's server token. Avoids getting it for every
BView method that contacts the server. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31134 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
19e179ca4f
commit
fa0ba1f855
@ -317,7 +317,7 @@ public:
|
||||
const BGradient& gradient);
|
||||
void FillPolygon(const BPoint* ptArray, int32 numPts,
|
||||
BRect bounds, const BGradient& gradient);
|
||||
|
||||
|
||||
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
||||
BRect bounds, pattern p = B_SOLID_HIGH);
|
||||
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
||||
@ -356,7 +356,7 @@ public:
|
||||
void FillEllipse(BPoint center, float xRadius,
|
||||
float yRadius, const BGradient& gradient);
|
||||
void FillEllipse(BRect r, const BGradient& gradient);
|
||||
|
||||
|
||||
void StrokeArc(BPoint center, float xRadius,
|
||||
float yRadius, float startAngle, float arcAngle,
|
||||
pattern p = B_SOLID_HIGH);
|
||||
@ -372,14 +372,14 @@ public:
|
||||
const BGradient& gradient);
|
||||
void FillArc(BRect r, float startAngle, float arcAngle,
|
||||
const BGradient& gradient);
|
||||
|
||||
|
||||
void StrokeBezier(BPoint* controlPoints,
|
||||
pattern p = B_SOLID_HIGH);
|
||||
void FillBezier(BPoint* controlPoints,
|
||||
pattern p = B_SOLID_HIGH);
|
||||
void FillBezier(BPoint* controlPoints,
|
||||
const BGradient& gradient);
|
||||
|
||||
|
||||
void StrokeShape(BShape* shape,
|
||||
pattern p = B_SOLID_HIGH);
|
||||
void FillShape(BShape* shape, pattern p = B_SOLID_HIGH);
|
||||
@ -622,7 +622,7 @@ private:
|
||||
void _PrintToStream();
|
||||
void _PrintTree();
|
||||
|
||||
int32 server_token;
|
||||
int32 fServerToken;
|
||||
uint32 fFlags;
|
||||
BPoint fParentOffset;
|
||||
BWindow* fOwner;
|
||||
|
@ -1000,7 +1000,7 @@ BView::SetViewCursor(const BCursor *cursor, bool sync)
|
||||
|
||||
ViewSetViewCursorInfo info;
|
||||
info.cursorToken = cursor->fServerToken;
|
||||
info.viewToken = _get_object_token_(this); // TODO: Use server_token!
|
||||
info.viewToken = fServerToken;
|
||||
info.sync = sync;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
@ -3906,8 +3906,7 @@ BView::_RemoveSelf()
|
||||
if (owner != NULL && !fTopLevelView) {
|
||||
// the top level view is deleted by the app_server automatically
|
||||
owner->fLink->StartMessage(AS_VIEW_DELETE);
|
||||
// TODO: Use server_token
|
||||
owner->fLink->Attach<int32>(_get_object_token_(this));
|
||||
owner->fLink->Attach<int32>(fServerToken);
|
||||
}
|
||||
|
||||
parent->InvalidateLayout();
|
||||
@ -4646,6 +4645,7 @@ BView::_InitData(BRect frame, const char *name, uint32 resizingMode,
|
||||
|
||||
fParentOffset.Set(frame.left, frame.top);
|
||||
|
||||
fServerToken = _get_object_token_(this);
|
||||
fOwner = NULL;
|
||||
fParent = NULL;
|
||||
fNextSibling = NULL;
|
||||
@ -4902,8 +4902,7 @@ BView::_CreateSelf()
|
||||
else
|
||||
fOwner->fLink->StartMessage(AS_VIEW_CREATE);
|
||||
|
||||
// TODO: Use server_token
|
||||
fOwner->fLink->Attach<int32>(_get_object_token_(this));
|
||||
fOwner->fLink->Attach<int32>(fServerToken);
|
||||
fOwner->fLink->AttachString(Name());
|
||||
fOwner->fLink->Attach<BRect>(Frame());
|
||||
fOwner->fLink->Attach<BPoint>(LeftTop());
|
||||
@ -4916,8 +4915,7 @@ BView::_CreateSelf()
|
||||
if (fTopLevelView)
|
||||
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
||||
else
|
||||
// TODO: Use server_token
|
||||
fOwner->fLink->Attach<int32>(_get_object_token_(fParent));
|
||||
fOwner->fLink->Attach<int32>(fParent->fServerToken);
|
||||
fOwner->fLink->Flush();
|
||||
|
||||
_CheckOwnerLockAndSwitchCurrent();
|
||||
@ -5125,8 +5123,7 @@ BView::_Detach()
|
||||
if (fOwner->fLastMouseMovedView == this)
|
||||
fOwner->fLastMouseMovedView = NULL;
|
||||
|
||||
// TODO: Use server_token
|
||||
if (fOwner->fLastViewToken == _get_object_token_(this))
|
||||
if (fOwner->fLastViewToken == fServerToken)
|
||||
fOwner->fLastViewToken = B_NULL_TOKEN;
|
||||
|
||||
_SetOwner(NULL);
|
||||
@ -5343,15 +5340,12 @@ BView::_CheckLock() const
|
||||
void
|
||||
BView::_SwitchServerCurrentView() const
|
||||
{
|
||||
// TODO: Use server_token
|
||||
int32 serverToken = _get_object_token_(this);
|
||||
|
||||
if (fOwner->fLastViewToken != serverToken) {
|
||||
STRACE(("contacting app_server... sending token: %ld\n", serverToken));
|
||||
if (fOwner->fLastViewToken != fServerToken) {
|
||||
STRACE(("contacting app_server... sending token: %ld\n", fServerToken));
|
||||
fOwner->fLink->StartMessage(AS_SET_CURRENT_VIEW);
|
||||
fOwner->fLink->Attach<int32>(serverToken);
|
||||
fOwner->fLink->Attach<int32>(fServerToken);
|
||||
|
||||
fOwner->fLastViewToken = serverToken;
|
||||
fOwner->fLastViewToken = fServerToken;
|
||||
} else {
|
||||
STRACE(("quiet2\n"));
|
||||
}
|
||||
@ -5510,7 +5504,7 @@ BView::_PrintToStream()
|
||||
fNextSibling ? fNextSibling->Name() : "NULL",
|
||||
fPreviousSibling ? fPreviousSibling->Name() : "NULL",
|
||||
fOwner ? fOwner->Name() : "NULL",
|
||||
_get_object_token_(this),
|
||||
fServerToken,
|
||||
fFlags,
|
||||
fParentOffset.x, fParentOffset.y,
|
||||
fBounds.left, fBounds.top, fBounds.right, fBounds.bottom,
|
||||
|
@ -2905,7 +2905,7 @@ BWindow::_CreateTopView()
|
||||
fTopView->fTopLevelView = true;
|
||||
|
||||
//inhibit check_lock()
|
||||
fLastViewToken = _get_object_token_(fTopView);
|
||||
fLastViewToken = fTopView->fServerToken;
|
||||
|
||||
// set fTopView's owner, add it to window's eligible handler list
|
||||
// and also set its next handler to be this window.
|
||||
@ -3089,7 +3089,7 @@ BWindow::_UnpackMessage(unpack_cookie& cookie, BMessage** _message,
|
||||
cookie.focus_token = _get_object_token_(*_target);
|
||||
|
||||
if (fLastMouseMovedView != NULL && cookie.message->what == B_MOUSE_MOVED)
|
||||
cookie.last_view_token = _get_object_token_(fLastMouseMovedView);
|
||||
cookie.last_view_token = fLastMouseMovedView->fServerToken;
|
||||
|
||||
*_usePreferred = false;
|
||||
}
|
||||
@ -3553,8 +3553,10 @@ BView *
|
||||
BWindow::_FindView(int32 token)
|
||||
{
|
||||
BHandler* handler;
|
||||
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN, (void**)&handler) != B_OK)
|
||||
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN,
|
||||
(void**)&handler) != B_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// the view must belong to us in order to be found by this method
|
||||
BView* view = dynamic_cast<BView*>(handler);
|
||||
|
Loading…
Reference in New Issue
Block a user