LLViewerRegion WIP: Added all headers that are dragged in.

Most in particular llevents.h, which comes along with
the demand that the old events in llevent.h are put
in a namespace LLOldEvents. Made all changes necessary
to compile the rest of the code again (without changing
the actual code: it's still using the old events).

This patch also removes LLStopWhenHandled and LLStandardSignal
from indra/llui/llnotifications.h because those are
moved to llevents.h. That seems to be the only change
to indra/llui/llnotifications.h that isn't floater related,
so I left the rest of that file alone.
This commit is contained in:
Aleric Inglewood
2012-02-17 02:59:36 +01:00
parent 59ee1a1041
commit b8744b9e6a
48 changed files with 6724 additions and 96 deletions

View File

@@ -134,6 +134,7 @@ set(viewer_SOURCE_FILES
llbuildnewviewsscheduler.cpp
llcallbacklist.cpp
llcallingcard.cpp
llcapabilitylistener.cpp
llcaphttpsender.cpp
llchatbar.cpp
llclassifiedinfo.cpp
@@ -492,6 +493,7 @@ set(viewer_SOURCE_FILES
llviewerregion.cpp
llviewershadermgr.cpp
llviewerstats.cpp
llviewerstatsrecorder.cpp
llviewertexteditor.cpp
llviewertexture.cpp
llviewertextureanim.cpp
@@ -620,6 +622,7 @@ set(viewer_HEADER_FILES
llbuildnewviewsscheduler.h
llcallbacklist.h
llcallingcard.h
llcapabilitylistener.h
llcaphttpsender.h
llchatbar.h
llclassifiedinfo.h
@@ -983,6 +986,7 @@ set(viewer_HEADER_FILES
llviewerregion.h
llviewershadermgr.h
llviewerstats.h
llviewerstatsrecorder.h
llviewertexteditor.h
llviewertexture.h
llviewertextureanim.h

View File

@@ -2818,7 +2818,7 @@ void update_group_floaters(const LLUUID& group_id)
gIMMgr->refresh();
}
gAgent.fireEvent(new LLEvent(&gAgent, "new group"), "");
gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "new group"), "");
}
// static

View File

@@ -92,7 +92,7 @@ struct LLGroupData
//
class LLAgent : public LLObservable
class LLAgent : public LLOldEvents::LLObservable
{
LOG_CLASS(LLAgent);

View File

@@ -36,7 +36,7 @@
#include "llmemory.h" // LLSingleton<>
#include "llevent.h"
class LLAgentLanguage: public LLSingleton<LLAgentLanguage>, public LLSimpleListener
class LLAgentLanguage: public LLSingleton<LLAgentLanguage>, public LLOldEvents::LLSimpleListener
{
public:
LLAgentLanguage();

View File

@@ -0,0 +1,202 @@
/**
* @file llcapabilitylistener.cpp
* @author Nat Goodspeed
* @date 2009-01-07
* @brief Implementation for llcapabilitylistener.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Precompiled header
#include "llviewerprecompiledheaders.h"
// associated header
#include "llcapabilitylistener.h"
// STL headers
#include <map>
// std headers
// external library headers
#include <boost/bind.hpp>
// other Linden headers
#include "stringize.h"
#include "llcapabilityprovider.h"
#include "message.h"
class LLCapabilityListener::CapabilityMappers: public LLSingleton<LLCapabilityListener::CapabilityMappers>
{
public:
void registerMapper(const LLCapabilityListener::CapabilityMapper*);
void unregisterMapper(const LLCapabilityListener::CapabilityMapper*);
const LLCapabilityListener::CapabilityMapper* find(const std::string& cap) const;
struct DupCapMapper: public std::runtime_error
{
DupCapMapper(const std::string& what):
std::runtime_error(std::string("DupCapMapper: ") + what)
{}
};
private:
friend class LLSingleton<LLCapabilityListener::CapabilityMappers>;
CapabilityMappers();
typedef std::map<std::string, const LLCapabilityListener::CapabilityMapper*> CapabilityMap;
CapabilityMap mMap;
};
LLCapabilityListener::LLCapabilityListener(const std::string& name,
LLMessageSystem* messageSystem,
const LLCapabilityProvider& provider,
const LLUUID& agentID,
const LLUUID& sessionID):
mEventPump(name),
mMessageSystem(messageSystem),
mProvider(provider),
mAgentID(agentID),
mSessionID(sessionID)
{
mEventPump.listen("self", boost::bind(&LLCapabilityListener::capListener, this, _1));
}
bool LLCapabilityListener::capListener(const LLSD& request)
{
// Extract what we want from the request object. We do it all up front
// partly to document what we expect.
LLSD::String cap(request["message"]);
LLSD payload(request["payload"]);
LLSD::String reply(request["reply"]);
LLSD::String error(request["error"]);
LLSD::Real timeout(request["timeout"]);
// If the LLSD doesn't even have a "message" key, we doubt it was intended
// for this listener.
if (cap.empty())
{
LL_ERRS("capListener") << "capability request event without 'message' key to '"
<< getCapAPI().getName()
<< "' on region\n" << mProvider.getDescription()
<< LL_ENDL;
return false; // in case fatal-error function isn't
}
// Establish default timeout. This test relies on LLSD::asReal() returning
// exactly 0.0 for an undef value.
if (! timeout)
{
timeout = HTTP_REQUEST_EXPIRY_SECS;
}
// Look up the url for the requested capability name.
std::string url = mProvider.getCapability(cap);
if (! url.empty())
{
// This capability is supported by the region to which we're talking.
LLHTTPClient::post(url, payload,
new LLSDMessage::EventResponder(LLEventPumps::instance(),
request,
mProvider.getDescription(),
cap, reply, error),
LLSD(), // headers
timeout);
}
else
{
// Capability not supported -- do we have a registered mapper?
const CapabilityMapper* mapper = CapabilityMappers::instance().find(cap);
if (! mapper) // capability neither supported nor mapped
{
LL_ERRS("capListener") << "unsupported capability '" << cap << "' request to '"
<< getCapAPI().getName() << "' on region\n"
<< mProvider.getDescription()
<< LL_ENDL;
}
else if (! mapper->getReplyName().empty()) // mapper expects reply support
{
LL_ERRS("capListener") << "Mapper for capability '" << cap
<< "' requires unimplemented support for reply message '"
<< mapper->getReplyName()
<< "' on '" << getCapAPI().getName() << "' on region\n"
<< mProvider.getDescription()
<< LL_ENDL;
}
else
{
LL_INFOS("capListener") << "fallback invoked for capability '" << cap
<< "' request to '" << getCapAPI().getName()
<< "' on region\n" << mProvider.getDescription()
<< LL_ENDL;
mapper->buildMessage(mMessageSystem, mAgentID, mSessionID, cap, payload);
mMessageSystem->sendReliable(mProvider.getHost());
}
}
return false;
}
LLCapabilityListener::CapabilityMapper::CapabilityMapper(const std::string& cap, const std::string& reply):
mCapName(cap),
mReplyName(reply)
{
LLCapabilityListener::CapabilityMappers::instance().registerMapper(this);
}
LLCapabilityListener::CapabilityMapper::~CapabilityMapper()
{
LLCapabilityListener::CapabilityMappers::instance().unregisterMapper(this);
}
LLSD LLCapabilityListener::CapabilityMapper::readResponse(LLMessageSystem* messageSystem) const
{
return LLSD();
}
LLCapabilityListener::CapabilityMappers::CapabilityMappers() {}
void LLCapabilityListener::CapabilityMappers::registerMapper(const LLCapabilityListener::CapabilityMapper* mapper)
{
// Try to insert a new map entry by which we can look up the passed mapper
// instance.
std::pair<CapabilityMap::iterator, bool> inserted =
mMap.insert(CapabilityMap::value_type(mapper->getCapName(), mapper));
// If we already have a mapper for that name, insert() merely located the
// existing iterator and returned false. It is a coding error to try to
// register more than one mapper for the same capability name.
if (! inserted.second)
{
throw DupCapMapper(std::string("Duplicate capability name ") + mapper->getCapName());
}
}
void LLCapabilityListener::CapabilityMappers::unregisterMapper(const LLCapabilityListener::CapabilityMapper* mapper)
{
CapabilityMap::iterator found = mMap.find(mapper->getCapName());
if (found != mMap.end())
{
mMap.erase(found);
}
}
const LLCapabilityListener::CapabilityMapper*
LLCapabilityListener::CapabilityMappers::find(const std::string& cap) const
{
CapabilityMap::const_iterator found = mMap.find(cap);
if (found != mMap.end())
{
return found->second;
}
return NULL;
}

View File

@@ -0,0 +1,131 @@
/**
* @file llcapabilitylistener.h
* @author Nat Goodspeed
* @date 2009-01-07
* @brief Provide an event-based API for capability requests
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#if ! defined(LL_LLCAPABILITYLISTENER_H)
#define LL_LLCAPABILITYLISTENER_H
#include "llevents.h" // LLEventPump
#include "llsdmessage.h" // LLSDMessage::ArgError
#include "llerror.h" // LOG_CLASS()
class LLCapabilityProvider;
class LLMessageSystem;
class LLSD;
class LLCapabilityListener
{
LOG_CLASS(LLCapabilityListener);
public:
LLCapabilityListener(const std::string& name, LLMessageSystem* messageSystem,
const LLCapabilityProvider& provider,
const LLUUID& agentID, const LLUUID& sessionID);
/// Capability-request exception
typedef LLSDMessage::ArgError ArgError;
/// Get LLEventPump on which we listen for capability requests
/// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities)
LLEventPump& getCapAPI() { return mEventPump; }
/**
* Base class for mapping an as-yet-undeployed capability name to a (pair
* of) LLMessageSystem message(s). To map a capability name to such
* messages, derive a subclass of CapabilityMapper and declare a static
* instance in a translation unit known to be loaded. The mapping is not
* region-specific. If an LLViewerRegion's capListener() receives a
* request for a supported capability, it will use the capability's URL.
* If not, it will look for an applicable CapabilityMapper subclass
* instance.
*/
class CapabilityMapper
{
public:
/**
* Base-class constructor. Typically your subclass constructor will
* pass these parameters as literals.
* @param cap the capability name handled by this (subclass) instance
* @param reply the name of the response LLMessageSystem message. Omit
* if the LLMessageSystem message you intend to send doesn't prompt a
* reply message, or if you already handle that message in some other
* way.
*/
CapabilityMapper(const std::string& cap, const std::string& reply = "");
virtual ~CapabilityMapper();
/// query the capability name
std::string getCapName() const { return mCapName; }
/// query the reply message name
std::string getReplyName() const { return mReplyName; }
/**
* Override this method to build the LLMessageSystem message we should
* send instead of the requested capability message. DO NOT send that
* message: that will be handled by the caller.
*/
virtual void buildMessage(LLMessageSystem* messageSystem,
const LLUUID& agentID,
const LLUUID& sessionID,
const std::string& capabilityName,
const LLSD& payload) const = 0;
/**
* Override this method if you pass a non-empty @a reply
* LLMessageSystem message name to the constructor: that is, if you
* expect to receive an LLMessageSystem message in response to the
* message you constructed in buildMessage(). If you don't pass a @a
* reply message name, you need not override this method as it won't
* be called.
*
* Using LLMessageSystem message-reading operations, your
* readResponse() override should construct and return an LLSD object
* of the form you expect to receive from the real implementation of
* the capability you intend to invoke, when it finally goes live.
*/
virtual LLSD readResponse(LLMessageSystem* messageSystem) const;
private:
const std::string mCapName;
const std::string mReplyName;
};
private:
/// Bind the LLCapabilityProvider passed to our ctor
const LLCapabilityProvider& mProvider;
/// Post an event to this LLEventPump to invoke a capability message on
/// the bound LLCapabilityProvider's server
/// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities)
LLEventStream mEventPump;
LLMessageSystem* mMessageSystem;
LLUUID mAgentID, mSessionID;
/// listener to process capability requests
bool capListener(const LLSD&);
/// helper class for capListener()
class CapabilityMappers;
};
#endif /* ! defined(LL_LLCAPABILITYLISTENER_H) */

View File

@@ -57,6 +57,8 @@
#include "llavatarname.h"
using namespace LLOldEvents;
const F32 SPEAKER_TIMEOUT = 10.f; // seconds of not being on voice channel before removed from list of active speakers
const F32 RESORT_TIMEOUT = 5.f; // seconds of mouse inactivity before it's ok to sort regardless of mouse-in-view.
const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f);

View File

@@ -49,7 +49,7 @@ class LLVoiceChannel;
// data for a given participant in a voice channel
class LLSpeaker : public LLRefCount, public LLObservable, public LLHandleProvider<LLSpeaker>
class LLSpeaker : public LLRefCount, public LLOldEvents::LLObservable, public LLHandleProvider<LLSpeaker>
{
public:
typedef enum e_speaker_type
@@ -96,21 +96,21 @@ public:
std::string mLegacyName;
};
class LLSpeakerTextModerationEvent : public LLEvent
class LLSpeakerTextModerationEvent : public LLOldEvents::LLEvent
{
public:
LLSpeakerTextModerationEvent(LLSpeaker* source);
/*virtual*/ LLSD getValue();
};
class LLSpeakerVoiceModerationEvent : public LLEvent
class LLSpeakerVoiceModerationEvent : public LLOldEvents::LLEvent
{
public:
LLSpeakerVoiceModerationEvent(LLSpeaker* source);
/*virtual*/ LLSD getValue();
};
class LLSpeakerListChangeEvent : public LLEvent
class LLSpeakerListChangeEvent : public LLOldEvents::LLEvent
{
public:
LLSpeakerListChangeEvent(LLSpeakerMgr* source, const LLUUID& speaker_id);
@@ -120,7 +120,7 @@ private:
const LLUUID& mSpeakerID;
};
class LLSpeakerMgr : public LLObservable
class LLSpeakerMgr : public LLOldEvents::LLObservable
{
public:
LLSpeakerMgr(LLVoiceChannel* channelp);
@@ -237,46 +237,46 @@ public:
static void onChangeModerationMode(LLUICtrl* ctrl, void* user_data);
protected:
class SpeakerMuteListener : public LLSimpleListener
class SpeakerMuteListener : public LLOldEvents::LLSimpleListener
{
public:
SpeakerMuteListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {}
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
LLPanelActiveSpeakers* mPanel;
};
friend class SpeakerAddListener;
class SpeakerAddListener : public LLSimpleListener
class SpeakerAddListener : public LLOldEvents::LLSimpleListener
{
public:
SpeakerAddListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {}
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
LLPanelActiveSpeakers* mPanel;
};
friend class SpeakerRemoveListener;
class SpeakerRemoveListener : public LLSimpleListener
class SpeakerRemoveListener : public LLOldEvents::LLSimpleListener
{
public:
SpeakerRemoveListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {}
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
LLPanelActiveSpeakers* mPanel;
};
friend class SpeakerClearListener;
class SpeakerClearListener : public LLSimpleListener
class SpeakerClearListener : public LLOldEvents::LLSimpleListener
{
public:
SpeakerClearListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {}
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
LLPanelActiveSpeakers* mPanel;
};

View File

@@ -62,6 +62,8 @@
#include "hippolimits.h"
using namespace LLOldEvents;
// static
std::map<const LLUUID, LLFloaterGroupPicker*> LLFloaterGroupPicker::sInstances;

View File

@@ -84,14 +84,14 @@ protected:
static instance_map_t sInstances;
};
class LLPanelGroups : public LLPanel, public LLSimpleListener
class LLPanelGroups : public LLPanel, public LLOldEvents::LLSimpleListener
{
public:
LLPanelGroups();
virtual ~LLPanelGroups();
//LLEventListener
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
// clear the group list, and get a fresh set of info.
void reset();

View File

@@ -99,6 +99,8 @@
#include "statemachine/aifilepicker.h"
// </edit>
using namespace LLOldEvents;
const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not)
const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not)
const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not)

View File

@@ -140,6 +140,8 @@ struct LLMoveInv
void* mUserData;
};
using namespace LLOldEvents;
// Helpers
// bug in busy count inc/dec right now, logic is complex... do we really need it?
void inc_busy_count()

View File

@@ -80,6 +80,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
using namespace LLOldEvents;
const F32 MAP_SCALE_MIN = 32;
const F32 MAP_SCALE_MID = 256;
const F32 MAP_SCALE_MAX = 4096;

View File

@@ -130,55 +130,55 @@ private:
class LLScaleMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCenterMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCheckCenterMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLRotateMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCheckRotateMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLStopTracking : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLEnableTracking : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLShowAgentProfile : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCamFollow : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
@@ -188,37 +188,37 @@ private:
class mmsetred : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetgreen : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetblue : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetyellow : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetcustom : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetunmark : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmenableunmark : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
@@ -228,7 +228,7 @@ private:
class LLEnableProfile : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
};

View File

@@ -261,6 +261,7 @@
#include "hippogridmanager.h"
using namespace LLOldEvents;
using namespace LLVOAvatarDefines;
void init_client_menu(LLMenuGL* menu);
void init_server_menu(LLMenuGL* menu);

View File

@@ -96,6 +96,8 @@
#include "importtracker.h"
using namespace LLOldEvents;
std::deque<std::string> gUploadQueue;
typedef LLMemberListener<LLView> view_listener_t;

View File

@@ -0,0 +1,258 @@
/**
* @file llviewerstatsrecorder.cpp
* @brief record info about viewer events to a metrics log file
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llviewerstatsrecorder.h"
#if LL_RECORD_VIEWER_STATS
#include "llfile.h"
#include "llviewerregion.h"
#include "llviewerobject.h"
// To do - something using region name or global position
#if LL_WINDOWS
static const std::string STATS_FILE_NAME("C:\\ViewerObjectCacheStats.csv");
#else
static const std::string STATS_FILE_NAME("/tmp/viewerstats.csv");
#endif
LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL;
LLViewerStatsRecorder::LLViewerStatsRecorder() :
mObjectCacheFile(NULL),
mTimer(),
mRegionp(NULL),
mStartTime(0.f),
mProcessingTime(0.f)
{
if (NULL != sInstance)
{
llerrs << "Attempted to create multiple instances of LLViewerStatsRecorder!" << llendl;
}
sInstance = this;
clearStats();
}
LLViewerStatsRecorder::~LLViewerStatsRecorder()
{
if (mObjectCacheFile != NULL)
{
LLFile::close(mObjectCacheFile);
mObjectCacheFile = NULL;
}
}
// static
void LLViewerStatsRecorder::initClass()
{
sInstance = new LLViewerStatsRecorder();
}
// static
void LLViewerStatsRecorder::cleanupClass()
{
delete sInstance;
sInstance = NULL;
}
void LLViewerStatsRecorder::initStatsRecorder(LLViewerRegion *regionp)
{
if (mObjectCacheFile == NULL)
{
mStartTime = LLTimer::getTotalTime();
mObjectCacheFile = LLFile::fopen(STATS_FILE_NAME, "wb");
if (mObjectCacheFile)
{ // Write column headers
std::ostringstream data_msg;
data_msg << "EventTime, "
<< "ProcessingTime, "
<< "CacheHits, "
<< "CacheFullMisses, "
<< "CacheCrcMisses, "
<< "FullUpdates, "
<< "TerseUpdates, "
<< "CacheMissRequests, "
<< "CacheMissResponses, "
<< "CacheUpdateDupes, "
<< "CacheUpdateChanges, "
<< "CacheUpdateAdds, "
<< "CacheUpdateReplacements, "
<< "UpdateFailures"
<< "\n";
fwrite(data_msg.str().c_str(), 1, data_msg.str().size(), mObjectCacheFile );
}
}
}
void LLViewerStatsRecorder::beginObjectUpdateEvents(LLViewerRegion *regionp)
{
initStatsRecorder(regionp);
mRegionp = regionp;
mProcessingTime = LLTimer::getTotalTime();
clearStats();
}
void LLViewerStatsRecorder::clearStats()
{
mObjectCacheHitCount = 0;
mObjectCacheMissFullCount = 0;
mObjectCacheMissCrcCount = 0;
mObjectFullUpdates = 0;
mObjectTerseUpdates = 0;
mObjectCacheMissRequests = 0;
mObjectCacheMissResponses = 0;
mObjectCacheUpdateDupes = 0;
mObjectCacheUpdateChanges = 0;
mObjectCacheUpdateAdds = 0;
mObjectCacheUpdateReplacements = 0;
mObjectUpdateFailures = 0;
}
void LLViewerStatsRecorder::recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type)
{
mObjectUpdateFailures++;
}
void LLViewerStatsRecorder::recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type)
{
if (LLViewerRegion::CACHE_MISS_TYPE_FULL == cache_miss_type)
{
mObjectCacheMissFullCount++;
}
else
{
mObjectCacheMissCrcCount++;
}
}
void LLViewerStatsRecorder::recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp)
{
switch (update_type)
{
case OUT_FULL:
mObjectFullUpdates++;
break;
case OUT_TERSE_IMPROVED:
mObjectTerseUpdates++;
break;
case OUT_FULL_COMPRESSED:
mObjectCacheMissResponses++;
break;
case OUT_FULL_CACHED:
mObjectCacheHitCount++;
break;
default:
llwarns << "Unknown update_type" << llendl;
break;
};
}
void LLViewerStatsRecorder::recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp)
{
switch (update_result)
{
case LLViewerRegion::CACHE_UPDATE_DUPE:
mObjectCacheUpdateDupes++;
break;
case LLViewerRegion::CACHE_UPDATE_CHANGED:
mObjectCacheUpdateChanges++;
break;
case LLViewerRegion::CACHE_UPDATE_ADDED:
mObjectCacheUpdateAdds++;
break;
case LLViewerRegion::CACHE_UPDATE_REPLACED:
mObjectCacheUpdateReplacements++;
break;
default:
llwarns << "Unknown update_result type" << llendl;
break;
};
}
void LLViewerStatsRecorder::recordRequestCacheMissesEvent(S32 count)
{
mObjectCacheMissRequests += count;
}
void LLViewerStatsRecorder::endObjectUpdateEvents()
{
llinfos << "ILX: "
<< mObjectCacheHitCount << " hits, "
<< mObjectCacheMissFullCount << " full misses, "
<< mObjectCacheMissCrcCount << " crc misses, "
<< mObjectFullUpdates << " full updates, "
<< mObjectTerseUpdates << " terse updates, "
<< mObjectCacheMissRequests << " cache miss requests, "
<< mObjectCacheMissResponses << " cache miss responses, "
<< mObjectCacheUpdateDupes << " cache update dupes, "
<< mObjectCacheUpdateChanges << " cache update changes, "
<< mObjectCacheUpdateAdds << " cache update adds, "
<< mObjectCacheUpdateReplacements << " cache update replacements, "
<< mObjectUpdateFailures << " update failures"
<< llendl;
S32 total_objects = mObjectCacheHitCount + mObjectCacheMissCrcCount + mObjectCacheMissFullCount + mObjectFullUpdates + mObjectTerseUpdates + mObjectCacheMissRequests + mObjectCacheMissResponses + mObjectCacheUpdateDupes + mObjectCacheUpdateChanges + mObjectCacheUpdateAdds + mObjectCacheUpdateReplacements + mObjectUpdateFailures;
if (mObjectCacheFile != NULL &&
total_objects > 0)
{
std::ostringstream data_msg;
F32 processing32 = (F32) ((LLTimer::getTotalTime() - mProcessingTime) / 1000.0);
data_msg << getTimeSinceStart()
<< ", " << processing32
<< ", " << mObjectCacheHitCount
<< ", " << mObjectCacheMissFullCount
<< ", " << mObjectCacheMissCrcCount
<< ", " << mObjectFullUpdates
<< ", " << mObjectTerseUpdates
<< ", " << mObjectCacheMissRequests
<< ", " << mObjectCacheMissResponses
<< ", " << mObjectCacheUpdateDupes
<< ", " << mObjectCacheUpdateChanges
<< ", " << mObjectCacheUpdateAdds
<< ", " << mObjectCacheUpdateReplacements
<< ", " << mObjectUpdateFailures
<< "\n";
fwrite(data_msg.str().c_str(), 1, data_msg.str().size(), mObjectCacheFile );
}
clearStats();
}
F32 LLViewerStatsRecorder::getTimeSinceStart()
{
return (F32) ((LLTimer::getTotalTime() - mStartTime) / 1000.0);
}
#endif

View File

@@ -0,0 +1,97 @@
/**
* @file llviewerstatsrecorder.h
* @brief record info about viewer events to a metrics log file
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLVIEWERSTATSRECORDER_H
#define LLVIEWERSTATSRECORDER_H
// This is a diagnostic class used to record information from the viewer
// for analysis.
// This is normally 0. Set to 1 to enable viewer stats recording
#define LL_RECORD_VIEWER_STATS 0
#if LL_RECORD_VIEWER_STATS
#include "llframetimer.h"
#include "llviewerobject.h"
#include "llviewerregion.h"
class LLMutex;
class LLViewerRegion;
class LLViewerObject;
class LLViewerStatsRecorder
{
public:
LLViewerStatsRecorder();
~LLViewerStatsRecorder();
static void initClass();
static void cleanupClass();
static LLViewerStatsRecorder* instance() {return sInstance; }
void initStatsRecorder(LLViewerRegion *regionp);
void beginObjectUpdateEvents(LLViewerRegion *regionp);
void recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type);
void recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type);
void recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp);
void recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp);
void recordRequestCacheMissesEvent(S32 count);
void endObjectUpdateEvents();
F32 getTimeSinceStart();
private:
static LLViewerStatsRecorder* sInstance;
LLFILE * mObjectCacheFile; // File to write data into
LLFrameTimer mTimer;
LLViewerRegion* mRegionp;
F64 mStartTime;
F64 mProcessingTime;
S32 mObjectCacheHitCount;
S32 mObjectCacheMissFullCount;
S32 mObjectCacheMissCrcCount;
S32 mObjectFullUpdates;
S32 mObjectTerseUpdates;
S32 mObjectCacheMissRequests;
S32 mObjectCacheMissResponses;
S32 mObjectCacheUpdateDupes;
S32 mObjectCacheUpdateChanges;
S32 mObjectCacheUpdateAdds;
S32 mObjectCacheUpdateReplacements;
S32 mObjectUpdateFailures;
void clearStats();
};
#endif // LL_RECORD_VIEWER_STATS
#endif // LLVIEWERSTATSRECORDER_H

View File

@@ -40,6 +40,8 @@
#include "llviewerstats.h"
#include "lldatapacker.h"
using namespace LLOldEvents;
// consts
// The viewer is allowed to set the under-the-hood bandwidth to 50%

View File

@@ -31,6 +31,8 @@
#include "rlvcommon.h"
#include "rlvhandler.h"
using namespace LLOldEvents;
// ============================================================================
// RlvNotifications
//

View File

@@ -195,7 +195,7 @@ typedef bool (RlvCommandHandler::*rlvCommandHandler)(const RlvCommand& rlvCmd, E
class RlvEnableIfNot : public LLMemberListener<LLView>
{
bool handleEvent(LLPointer<LLEvent>, const LLSD&);
bool handleEvent(LLPointer<LLOldEvents::LLEvent>, const LLSD&);
};
// ============================================================================