[Haiku-commits] r31134 - in haiku/trunk: headers/os/interface src/kits/interface
stippi at BerliOS
stippi at mail.berlios.de
Sat Jun 20 16:12:31 CEST 2009
Author: stippi
Date: 2009-06-20 16:12:30 +0200 (Sat, 20 Jun 2009)
New Revision: 31134
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31134&view=rev
Modified:
haiku/trunk/headers/os/interface/View.h
haiku/trunk/src/kits/interface/View.cpp
haiku/trunk/src/kits/interface/Window.cpp
Log:
Cache a view's server token. Avoids getting it for every
BView method that contacts the server.
Modified: haiku/trunk/headers/os/interface/View.h
===================================================================
--- haiku/trunk/headers/os/interface/View.h 2009-06-20 12:11:49 UTC (rev 31133)
+++ haiku/trunk/headers/os/interface/View.h 2009-06-20 14:12:30 UTC (rev 31134)
@@ -317,7 +317,7 @@
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 @@
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 @@
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 @@
void _PrintToStream();
void _PrintTree();
- int32 server_token;
+ int32 fServerToken;
uint32 fFlags;
BPoint fParentOffset;
BWindow* fOwner;
Modified: haiku/trunk/src/kits/interface/View.cpp
===================================================================
--- haiku/trunk/src/kits/interface/View.cpp 2009-06-20 12:11:49 UTC (rev 31133)
+++ haiku/trunk/src/kits/interface/View.cpp 2009-06-20 14:12:30 UTC (rev 31134)
@@ -1000,7 +1000,7 @@
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 @@
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 @@
fParentOffset.Set(frame.left, frame.top);
+ fServerToken = _get_object_token_(this);
fOwner = NULL;
fParent = NULL;
fNextSibling = NULL;
@@ -4902,8 +4902,7 @@
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 @@
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 @@
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 @@
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 @@
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,
Modified: haiku/trunk/src/kits/interface/Window.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Window.cpp 2009-06-20 12:11:49 UTC (rev 31133)
+++ haiku/trunk/src/kits/interface/Window.cpp 2009-06-20 14:12:30 UTC (rev 31134)
@@ -2905,7 +2905,7 @@
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 @@
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 @@
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);
More information about the Haiku-commits
mailing list