Enhancement - Hooks
- Added timing information for event trigger calls.
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
@@ -79,16 +80,15 @@ Hooks::~Hooks ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Enumerate all hooks, and tell API about the script files it must load in
|
||||||
|
// order to call them. Note that API will perform a deferred read, which means
|
||||||
|
// that if it isn't called, a script will not be loaded.
|
||||||
void Hooks::initialize ()
|
void Hooks::initialize ()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBLUA
|
#ifdef HAVE_LIBLUA
|
||||||
api.initialize ();
|
api.initialize ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO Enumerate all hooks, and tell API about the script files it must load
|
|
||||||
// in order to call them. Note that API will perform a deferred read,
|
|
||||||
// which means that if it isn't called, a script will not be loaded.
|
|
||||||
|
|
||||||
std::vector <std::string> vars;
|
std::vector <std::string> vars;
|
||||||
context.config.all (vars);
|
context.config.all (vars);
|
||||||
|
|
||||||
@@ -148,6 +148,8 @@ bool Hooks::trigger (const std::string& event)
|
|||||||
{
|
{
|
||||||
if (it->event == event)
|
if (it->event == event)
|
||||||
{
|
{
|
||||||
|
Timer timer (std::string ("Hooks::trigger ") + event);
|
||||||
|
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
std::string type;
|
std::string type;
|
||||||
if (eventType (event, type))
|
if (eventType (event, type))
|
||||||
|
|||||||
Reference in New Issue
Block a user