1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Pass function objects through const references.

This commit is contained in:
Bartosz Taudul
2023-04-16 16:44:18 +02:00
parent 778d0cb3fb
commit a0221c8660
16 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ class RunQueue;
class Backend
{
public:
Backend( const char* title, std::function<void()> redraw, RunQueue* mainThreadTasks );
Backend( const char* title, const std::function<void()>& redraw, RunQueue* mainThreadTasks );
~Backend();
void Show();
+1 -1
View File
@@ -60,7 +60,7 @@ static void glfw_window_iconify_callback( GLFWwindow*, int iconified )
}
Backend::Backend( const char* title, std::function<void()> redraw, RunQueue* mainThreadTasks )
Backend::Backend( const char* title, const std::function<void()>& redraw, RunQueue* mainThreadTasks )
{
glfwSetErrorCallback( glfw_error_callback );
if( !glfwInit() ) exit( 1 );
+1 -1
View File
@@ -630,7 +630,7 @@ static void SetupCursor()
s_cursorY = cursor->images[0]->hotspot_y / s_maxScale;
}
Backend::Backend( const char* title, std::function<void()> redraw, RunQueue* mainThreadTasks )
Backend::Backend( const char* title, const std::function<void()>& redraw, RunQueue* mainThreadTasks )
{
s_redraw = redraw;
s_mainThreadTasks = mainThreadTasks;
+1 -1
View File
@@ -72,7 +72,7 @@ static const char* GetOsInfo()
return buf;
}
void HttpRequest( const char* server, const char* resource, int port, std::function<void(int, char*)> cb )
void HttpRequest( const char* server, const char* resource, int port, const std::function<void(int, char*)>& cb )
{
tracy::Socket sock;
if( !sock.ConnectBlocking( server, port ) ) return;
+1 -1
View File
@@ -3,6 +3,6 @@
#include <functional>
void HttpRequest( const char* server, const char* resource, int port, std::function<void(int, char*)> cb );
void HttpRequest( const char* server, const char* resource, int port, const std::function<void(int, char*)>& cb );
#endif
+1 -1
View File
@@ -5,7 +5,7 @@ RunQueue::RunQueue()
{
}
void RunQueue::Queue( std::function<void()> cb, bool forceDelay )
void RunQueue::Queue( const std::function<void()>& cb, bool forceDelay )
{
if( !forceDelay && std::this_thread::get_id() == m_mainThread )
{
+1 -1
View File
@@ -11,7 +11,7 @@ class RunQueue
public:
RunQueue();
void Queue( std::function<void()> cb, bool forceDelay = false );
void Queue( const std::function<void()>& cb, bool forceDelay = false );
void Run();
private:
+1 -1
View File
@@ -114,7 +114,7 @@ static void AttentionCallback()
static void DrawContents();
void RunOnMainThread( std::function<void()> cb, bool forceDelay = false )
static void RunOnMainThread( const std::function<void()>& cb, bool forceDelay = false )
{
mainThreadTasks.Queue( cb, forceDelay );
}