LLVOCache class implemented.
This commit is contained in:
@@ -42,18 +42,18 @@
|
||||
#include "llcloud.h"
|
||||
#include "llstat.h"
|
||||
#include "v3dmath.h"
|
||||
#include "llhost.h"
|
||||
#include "llstring.h"
|
||||
#include "llregionflags.h"
|
||||
#include "lluuid.h"
|
||||
#include "lldatapacker.h"
|
||||
#include "llvocache.h"
|
||||
#include "llweb.h"
|
||||
#include "llcapabilityprovider.h"
|
||||
#include "m4math.h" // LLMatrix4
|
||||
#include "llhttpclient.h"
|
||||
|
||||
// Surface id's
|
||||
#define LAND 1
|
||||
#define WATER 2
|
||||
const U32 MAX_OBJECT_CACHE_ENTRIES = 10000;
|
||||
const U32 MAX_OBJECT_CACHE_ENTRIES = 50000;
|
||||
|
||||
|
||||
class LLEventPoll;
|
||||
@@ -66,8 +66,16 @@ class LLSurface;
|
||||
class LLVOCache;
|
||||
class LLVOCacheEntry;
|
||||
class LLSpatialPartition;
|
||||
class LLEventPump;
|
||||
//class LLCapabilityListener;
|
||||
class LLDataPacker;
|
||||
class LLDataPackerBinaryBuffer;
|
||||
class LLHost;
|
||||
class LLBBox;
|
||||
|
||||
class LLViewerRegion
|
||||
class LLViewerRegionImpl;
|
||||
|
||||
class LLViewerRegion: public LLCapabilityProvider // implements this interface
|
||||
{
|
||||
public:
|
||||
//MUST MATCH THE ORDER OF DECLARATION IN CONSTRUCTOR
|
||||
@@ -96,9 +104,8 @@ public:
|
||||
~LLViewerRegion();
|
||||
|
||||
// Call this after you have the region name and handle.
|
||||
void loadCache();
|
||||
|
||||
void saveCache();
|
||||
void loadObjectCache();
|
||||
void saveObjectCache();
|
||||
|
||||
void sendMessage(); // Send the current message to this region's simulator
|
||||
void sendReliableMessage(); // Send the current message to this region's simulator
|
||||
@@ -161,19 +168,19 @@ public:
|
||||
F32 getTimeDilation() const { return mTimeDilation; }
|
||||
|
||||
// Origin height is at zero.
|
||||
const LLVector3d &getOriginGlobal() const { return mOriginGlobal; }
|
||||
const LLVector3d &getOriginGlobal() const;
|
||||
LLVector3 getOriginAgent() const;
|
||||
|
||||
// Center is at the height of the water table.
|
||||
const LLVector3d &getCenterGlobal() const { return mCenterGlobal; }
|
||||
const LLVector3d &getCenterGlobal() const;
|
||||
LLVector3 getCenterAgent() const;
|
||||
|
||||
void setRegionNameAndZone(const std::string& name_and_zone);
|
||||
const std::string& getName() const { return mName; }
|
||||
const std::string& getZoning() const { return mZoning; }
|
||||
|
||||
void setOwner(const LLUUID& owner_id) { mOwnerID = owner_id; }
|
||||
const LLUUID& getOwner() const { return mOwnerID; }
|
||||
void setOwner(const LLUUID& owner_id);
|
||||
const LLUUID& getOwner() const;
|
||||
|
||||
// Is the current agent on the estate manager list for this region?
|
||||
void setIsEstateManager(BOOL b) { mIsEstateManager = b; }
|
||||
@@ -205,7 +212,7 @@ public:
|
||||
// can process the message.
|
||||
static void processRegionInfo(LLMessageSystem* msg, void**);
|
||||
|
||||
void setCacheID(const LLUUID& id) { mCacheID = id; }
|
||||
void setCacheID(const LLUUID& id);
|
||||
|
||||
F32 getWidth() const { return mWidth; }
|
||||
|
||||
@@ -221,27 +228,35 @@ public:
|
||||
|
||||
U32 getPacketsLost() const;
|
||||
|
||||
void setHttpResponderPtrNULL() {mHttpResponderPtr = NULL ;}
|
||||
const LLHTTPClient::ResponderPtr getHttpResponderPtr() const {return mHttpResponderPtr ;}
|
||||
void setHttpResponderPtrNULL();
|
||||
const LLHTTPClient::ResponderPtr getHttpResponderPtr() const;
|
||||
|
||||
// Get/set named capability URLs for this region.
|
||||
void setSeedCapability(const std::string& url);
|
||||
void setCapability(const std::string& name, const std::string& url);
|
||||
std::string getCapability(const std::string& name) const;
|
||||
static bool isSpecialCapabilityName(const std::string &name);
|
||||
void logActiveCapabilities() const;
|
||||
// implements LLCapabilityProvider
|
||||
virtual std::string getCapability(const std::string& name) const;
|
||||
|
||||
// has region received its final (not seed) capability list?
|
||||
bool capabilitiesReceived() const;
|
||||
void setCapabilitiesReceived(bool received);
|
||||
|
||||
const LLHost &getHost() const { return mHost; }
|
||||
static bool isSpecialCapabilityName(const std::string &name);
|
||||
void logActiveCapabilities() const;
|
||||
|
||||
/// Get LLEventPump on which we listen for capability requests
|
||||
/// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities)
|
||||
// LLEventPump& getCapAPI() const;
|
||||
|
||||
/// implements LLCapabilityProvider
|
||||
/*virtual*/ const LLHost& getHost() const;
|
||||
const U64 &getHandle() const { return mHandle; }
|
||||
|
||||
LLSurface &getLand() const { return *mLandp; }
|
||||
LLSurface &getLand() const;
|
||||
|
||||
// set and get the region id
|
||||
const LLUUID& getRegionID() const { return mRegionID; }
|
||||
void setRegionID(const LLUUID& region_id) { mRegionID = region_id; }
|
||||
const LLUUID& getRegionID() const;
|
||||
void setRegionID(const LLUUID& region_id);
|
||||
|
||||
BOOL pointInRegionGlobal(const LLVector3d &point_global) const;
|
||||
LLVector3 getPosRegionFromGlobal(const LLVector3d &point_global) const;
|
||||
@@ -249,7 +264,7 @@ public:
|
||||
LLVector3 getPosAgentFromRegion(const LLVector3 ®ion_pos) const;
|
||||
LLVector3d getPosGlobalFromRegion(const LLVector3 &offset) const;
|
||||
|
||||
LLVLComposition *getComposition() const { return mCompositionp; }
|
||||
LLVLComposition *getComposition() const;
|
||||
F32 getCompositionXY(const S32 x, const S32 y) const;
|
||||
|
||||
BOOL isOwnedSelf(const LLVector3& pos);
|
||||
@@ -263,10 +278,26 @@ public:
|
||||
F32 getLandHeightRegion(const LLVector3& region_pos);
|
||||
|
||||
void getInfo(LLSD& info);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CACHE_MISS_TYPE_FULL = 0,
|
||||
CACHE_MISS_TYPE_CRC,
|
||||
CACHE_MISS_TYPE_NONE
|
||||
} eCacheMissType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CACHE_UPDATE_DUPE = 0,
|
||||
CACHE_UPDATE_CHANGED,
|
||||
CACHE_UPDATE_ADDED,
|
||||
CACHE_UPDATE_REPLACED
|
||||
} eCacheUpdateResult;
|
||||
|
||||
// handle a full update message
|
||||
void cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp);
|
||||
LLDataPacker *getDP(U32 local_id, U32 crc);
|
||||
eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp);
|
||||
LLDataPacker *getDP(U32 local_id, U32 crc, U8 &cache_miss_type);
|
||||
void requestCacheMisses();
|
||||
void addCacheMissFull(const U32 local_id);
|
||||
|
||||
@@ -281,8 +312,14 @@ public:
|
||||
|
||||
// used by LCD to get details for debug screen
|
||||
U32 getNetDetailsForLCD();
|
||||
|
||||
/// implements LLCapabilityProvider
|
||||
virtual std::string getDescription() const;
|
||||
std::string getHttpUrl() const { return mHttpUrl ;}
|
||||
|
||||
LLSpatialPartition* getSpatialPartition(U32 type);
|
||||
|
||||
bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const;
|
||||
public:
|
||||
struct CompareDistance
|
||||
{
|
||||
@@ -319,34 +356,19 @@ public:
|
||||
LLDynamicArray<LLUUID> mMapAvatarIDs;
|
||||
|
||||
private:
|
||||
// The surfaces and other layers
|
||||
LLSurface* mLandp;
|
||||
LLViewerRegionImpl * mImpl;
|
||||
|
||||
// Region geometry data
|
||||
LLVector3d mOriginGlobal; // Location of southwest corner of region (meters)
|
||||
LLVector3d mCenterGlobal; // Location of center in world space (meters)
|
||||
F32 mWidth; // Width of region on a side (meters)
|
||||
|
||||
U64 mHandle;
|
||||
LLHost mHost;
|
||||
|
||||
// The unique ID for this region.
|
||||
LLUUID mRegionID;
|
||||
|
||||
F32 mTimeDilation; // time dilation of physics simulation on simulator
|
||||
|
||||
// simulator name
|
||||
std::string mName;
|
||||
std::string mZoning;
|
||||
|
||||
// region/estate owner - usually null.
|
||||
LLUUID mOwnerID;
|
||||
|
||||
// Is this agent on the estate managers list for this region?
|
||||
BOOL mIsEstateManager;
|
||||
|
||||
// Network statistics for the region's circuit...
|
||||
LLTimer mLastNetUpdate;
|
||||
U32 mPacketsIn;
|
||||
U32 mBitsIn;
|
||||
U32 mLastBitsIn;
|
||||
@@ -358,9 +380,6 @@ private:
|
||||
U32 mPingDelay;
|
||||
F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc
|
||||
|
||||
// Misc
|
||||
LLVLComposition *mCompositionp; // Composition layer for the surface
|
||||
|
||||
U32 mRegionFlags; // includes damage flags
|
||||
U8 mSimAccess;
|
||||
F32 mBillableFactor;
|
||||
@@ -370,43 +389,24 @@ private:
|
||||
// Information for Homestead / CR-53
|
||||
S32 mClassID;
|
||||
S32 mCPURatio;
|
||||
|
||||
std::string mColoName;
|
||||
std::string mProductSKU;
|
||||
std::string mProductName;
|
||||
|
||||
std::string mHttpUrl ;
|
||||
|
||||
// Maps local ids to cache entries.
|
||||
// Regions can have order 10,000 objects, so assume
|
||||
// a structure of size 2^14 = 16,000
|
||||
BOOL mCacheLoaded;
|
||||
typedef std::map<U32, LLVOCacheEntry *> cache_map_t;
|
||||
cache_map_t mCacheMap;
|
||||
LLVOCacheEntry mCacheStart;
|
||||
LLVOCacheEntry mCacheEnd;
|
||||
U32 mCacheEntriesCount;
|
||||
BOOL mCacheDirty;
|
||||
|
||||
LLDynamicArray<U32> mCacheMissFull;
|
||||
LLDynamicArray<U32> mCacheMissCRC;
|
||||
// time?
|
||||
// LRU info?
|
||||
|
||||
// Cache ID is unique per-region, across renames, moving locations,
|
||||
// etc.
|
||||
LLUUID mCacheID;
|
||||
|
||||
typedef std::map<std::string, std::string> CapabilityMap;
|
||||
CapabilityMap mCapabilities;
|
||||
|
||||
LLEventPoll* mEventPoll;
|
||||
|
||||
private:
|
||||
bool mAlive; // can become false if circuit disconnects
|
||||
bool mCapabilitiesReceived;
|
||||
|
||||
//spatial partitions for objects in this region
|
||||
std::vector<LLSpatialPartition*> mObjectPartition;
|
||||
|
||||
LLHTTPClient::ResponderPtr mHttpResponderPtr ;
|
||||
|
||||
BOOL mReleaseNotesRequested;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user