summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-08-30 15:51:29 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-08-30 16:06:49 +0900
commit44c69c8d31ac840c727568600f56f92691d8c720 (patch)
tree3a9027899b64b83d39783fda697ee84e3802c56e
parent40c3cedd6a504e63887eac10bbb83f400b189527 (diff)
terminology: let's not recreate timer all over the place for nothing.
-rw-r--r--src/bin/termptysave.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/bin/termptysave.c b/src/bin/termptysave.c
index 75f032f..15eca1e 100644
--- a/src/bin/termptysave.c
+++ b/src/bin/termptysave.c
@@ -297,14 +297,15 @@ _timer(void *data EINA_UNUSED)
297 return EINA_FALSE; 297 return EINA_FALSE;
298} 298}
299 299
300static void 300static inline void
301_check_compressor(void) 301_check_compressor(Eina_Bool frozen)
302{ 302{
303 if (freeze) return;
303 if (idler) return; 304 if (idler) return;
304 if ((ts_uncomp > 256) || (ts_freeops > 256)) 305 if ((ts_uncomp > 256) || (ts_freeops > 256))
305 { 306 {
306 if (timer) ecore_timer_reset(timer); 307 if (timer && !frozen) ecore_timer_reset(timer);
307 else timer = ecore_timer_add(0.2, _timer, NULL); 308 else if (!timer) timer = ecore_timer_add(0.2, _timer, NULL);
308 } 309 }
309} 310}
310 311
@@ -313,17 +314,15 @@ termpty_save_freeze(void)
313{ 314{
314 // XXX: suspend compressor - this probably should be in a thread but right 315 // XXX: suspend compressor - this probably should be in a thread but right
315 // now it'll be fine here 316 // now it'll be fine here
316 freeze++; 317 if (!freeze++)
318 {
319 if (timer) ecore_timer_freeze(timer);
320 }
317 if (idler) 321 if (idler)
318 { 322 {
319 ecore_idler_del(idler); 323 ecore_idler_del(idler);
320 idler = NULL; 324 idler = NULL;
321 } 325 }
322 if (timer)
323 {
324 ecore_timer_del(timer);
325 timer = NULL;
326 }
327} 326}
328 327
329void 328void
@@ -331,7 +330,11 @@ termpty_save_thaw(void)
331{ 330{
332 // XXX: resume compressor 331 // XXX: resume compressor
333 freeze--; 332 freeze--;
334 if (freeze <= 0) _check_compressor(); 333 if (freeze <= 0)
334 {
335 if (timer) ecore_timer_thaw(timer);
336 _check_compressor(EINA_TRUE);
337 }
335} 338}
336 339
337void 340void
@@ -380,10 +383,10 @@ termpty_save_extract(Termsave *ts)
380 ts_compfreeze++; 383 ts_compfreeze++;
381 _mem_free(ts); 384 _mem_free(ts);
382 ts_compfreeze--; 385 ts_compfreeze--;
383 _check_compressor(); 386 _check_compressor(EINA_FALSE);
384 return ts2; 387 return ts2;
385 } 388 }
386 _check_compressor(); 389 _check_compressor(EINA_FALSE);
387 return ts; 390 return ts;
388} 391}
389 392
@@ -395,7 +398,7 @@ termpty_save_new(int w)
395 ts->gen = _mem_gen_get(); 398 ts->gen = _mem_gen_get();
396 ts->w = w; 399 ts->w = w;
397 if (!ts_compfreeze) ts_uncomp++; 400 if (!ts_compfreeze) ts_uncomp++;
398 _check_compressor(); 401 _check_compressor(EINA_FALSE);
399 return ts; 402 return ts;
400} 403}
401 404
@@ -410,5 +413,5 @@ termpty_save_free(Termsave *ts)
410 ts_freeops++; 413 ts_freeops++;
411 } 414 }
412 _mem_free(ts); 415 _mem_free(ts);
413 _check_compressor(); 416 _check_compressor(EINA_FALSE);
414} 417}