clutter-main: start mainloop timer on clutter_init()
By creating and starting the timer on clutter_main() an assumption is made that that is how the main loop will be run for all clutter applications. With more and more applications moving to GApplication, this assumption no longer holds true. Moving to clutter_init() means we are starting the timer earlier than we should, and by not stopping it when the main loop quits we are taking a measure that is later than we should. I believe it is safe to consider those are close enough to the actual beginning and quitting of the main loop in practice. https://bugzilla.gnome.org/show_bug.cgi?id=728521
This commit is contained in:
parent
20e619f8a6
commit
d7b183a4e3
@ -901,14 +901,6 @@ void
|
|||||||
clutter_main (void)
|
clutter_main (void)
|
||||||
{
|
{
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
CLUTTER_STATIC_TIMER (mainloop_timer,
|
|
||||||
NULL, /* no parent */
|
|
||||||
"Mainloop",
|
|
||||||
"The time spent in the clutter mainloop",
|
|
||||||
0 /* no application private data */);
|
|
||||||
|
|
||||||
if (clutter_main_loop_level == 0)
|
|
||||||
CLUTTER_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);
|
|
||||||
|
|
||||||
if (!_clutter_context_is_initialized ())
|
if (!_clutter_context_is_initialized ())
|
||||||
{
|
{
|
||||||
@ -942,9 +934,6 @@ clutter_main (void)
|
|||||||
g_main_loop_unref (loop);
|
g_main_loop_unref (loop);
|
||||||
|
|
||||||
clutter_main_loop_level--;
|
clutter_main_loop_level--;
|
||||||
|
|
||||||
if (clutter_main_loop_level == 0)
|
|
||||||
CLUTTER_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1493,6 +1482,14 @@ clutter_init_real (GError **error)
|
|||||||
ClutterMainContext *ctx;
|
ClutterMainContext *ctx;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
|
|
||||||
|
#ifdef CLUTTER_ENABLE_PROFILE
|
||||||
|
CLUTTER_STATIC_TIMER (mainloop_timer,
|
||||||
|
NULL, /* no parent */
|
||||||
|
"Mainloop",
|
||||||
|
"The time spent in the clutter mainloop",
|
||||||
|
0 /* no application private data */);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Note, creates backend if not already existing, though parse args will
|
/* Note, creates backend if not already existing, though parse args will
|
||||||
* have likely created it
|
* have likely created it
|
||||||
*/
|
*/
|
||||||
@ -1554,6 +1551,8 @@ clutter_init_real (GError **error)
|
|||||||
uprof_init (NULL, NULL);
|
uprof_init (NULL, NULL);
|
||||||
_clutter_uprof_init ();
|
_clutter_uprof_init ();
|
||||||
|
|
||||||
|
CLUTTER_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);
|
||||||
|
|
||||||
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
|
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
|
||||||
_clutter_profile_suspend ();
|
_clutter_profile_suspend ();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user