Reconnect BPicture to the app_server.
* maintain a list of all BPictures to do so * BView downloads the BPicture data after recording the picture. This could probably done more efficiently using shared memory in the first place.
This commit is contained in:
@@ -35,6 +35,7 @@ public:
|
|||||||
status_t Flatten(BDataIO* stream);
|
status_t Flatten(BDataIO* stream);
|
||||||
status_t Unflatten(BDataIO* stream);
|
status_t Unflatten(BDataIO* stream);
|
||||||
|
|
||||||
|
class Private;
|
||||||
private:
|
private:
|
||||||
// FBC padding and forbidden methods
|
// FBC padding and forbidden methods
|
||||||
virtual void _ReservedPicture1();
|
virtual void _ReservedPicture1();
|
||||||
@@ -47,6 +48,7 @@ private:
|
|||||||
friend class BWindow;
|
friend class BWindow;
|
||||||
friend class BView;
|
friend class BView;
|
||||||
friend class BPrintJob;
|
friend class BPrintJob;
|
||||||
|
friend class Private;
|
||||||
|
|
||||||
void _InitData();
|
void _InitData();
|
||||||
void _DisposeData();
|
void _DisposeData();
|
||||||
@@ -71,7 +73,6 @@ private:
|
|||||||
void Usurp(BPicture* lameDuck);
|
void Usurp(BPicture* lameDuck);
|
||||||
BPicture* StepDown();
|
BPicture* StepDown();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fToken;
|
int32 fToken;
|
||||||
_BPictureExtent_* fExtent;
|
_BPictureExtent_* fExtent;
|
||||||
|
|||||||
@@ -9,22 +9,56 @@
|
|||||||
//! BPicture records a series of drawing instructions that can be "replayed" later.
|
//! BPicture records a series of drawing instructions that can be "replayed" later.
|
||||||
|
|
||||||
|
|
||||||
#include <AppServerLink.h>
|
|
||||||
#include <PicturePlayer.h>
|
|
||||||
#include <ServerProtocol.h>
|
|
||||||
|
|
||||||
//#define DEBUG 1
|
|
||||||
#include <Debug.h>
|
|
||||||
#include <ByteOrder.h>
|
|
||||||
#include <List.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Picture.h>
|
#include <Picture.h>
|
||||||
|
|
||||||
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <new>
|
//#define DEBUG 1
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
#include <Debug.h>
|
||||||
|
#include <List.h>
|
||||||
|
#include <Message.h>
|
||||||
|
|
||||||
|
#include <AppServerLink.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
#include <ObjectList.h>
|
||||||
|
#include <PicturePlayer.h>
|
||||||
|
#include <ServerProtocol.h>
|
||||||
|
|
||||||
|
#include "PicturePrivate.h"
|
||||||
|
|
||||||
|
|
||||||
|
static BObjectList<BPicture> sPictureList;
|
||||||
|
static BLocker sPictureListLock;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
reconnect_pictures_to_app_server()
|
||||||
|
{
|
||||||
|
BAutolock _(sPictureListLock);
|
||||||
|
for (int32 i = 0; i < sPictureList.CountItems(); i++) {
|
||||||
|
BPicture::Private picture(sPictureList.ItemAt(i));
|
||||||
|
picture.ReconnectToAppServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BPicture::Private::Private(BPicture* picture)
|
||||||
|
:
|
||||||
|
fPicture(picture)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BPicture::Private::ReconnectToAppServer()
|
||||||
|
{
|
||||||
|
fPicture->_Upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct _BPictureExtent_ {
|
struct _BPictureExtent_ {
|
||||||
_BPictureExtent_(const int32 &size = 0);
|
_BPictureExtent_(const int32 &size = 0);
|
||||||
@@ -179,11 +213,16 @@ BPicture::_InitData()
|
|||||||
fUsurped = NULL;
|
fUsurped = NULL;
|
||||||
|
|
||||||
fExtent = new (std::nothrow) _BPictureExtent_;
|
fExtent = new (std::nothrow) _BPictureExtent_;
|
||||||
|
|
||||||
|
BAutolock _(sPictureListLock);
|
||||||
|
sPictureList.AddItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPicture::~BPicture()
|
BPicture::~BPicture()
|
||||||
{
|
{
|
||||||
|
BAutolock _(sPictureListLock);
|
||||||
|
sPictureList.RemoveItem(this);
|
||||||
_DisposeData();
|
_DisposeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,8 +424,8 @@ BPicture::_AssertServerCopy()
|
|||||||
status_t
|
status_t
|
||||||
BPicture::_Upload()
|
BPicture::_Upload()
|
||||||
{
|
{
|
||||||
ASSERT(fToken == -1);
|
if (fExtent == NULL || fExtent->Data() == NULL)
|
||||||
ASSERT(fExtent->Data() != NULL);
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
|
|
||||||
|
|||||||
@@ -3637,6 +3637,9 @@ BView::EndPicture()
|
|||||||
fCurrentPicture = picture->StepDown();
|
fCurrentPicture = picture->StepDown();
|
||||||
picture->SetToken(token);
|
picture->SetToken(token);
|
||||||
|
|
||||||
|
// TODO do this more efficient e.g. use a shared area and let the
|
||||||
|
// client write into it
|
||||||
|
picture->_Download();
|
||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user