Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-job-scheduler.h File Reference
#include <glib.h>
#include "ev-jobs.h"
+ Include dependency graph for ev-job-scheduler.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  EvJobPriority {
  EV_JOB_PRIORITY_URGENT, EV_JOB_PRIORITY_HIGH, EV_JOB_PRIORITY_LOW, EV_JOB_PRIORITY_NONE,
  EV_JOB_N_PRIORITIES
}
 

Functions

void ev_job_scheduler_push_job (EvJob *job, EvJobPriority priority)
 
void ev_job_scheduler_update_job (EvJob *job, EvJobPriority priority)
 
EvJobev_job_scheduler_get_running_thread_job (void)
 

Enumeration Type Documentation

Enumerator
EV_JOB_PRIORITY_URGENT 
EV_JOB_PRIORITY_HIGH 
EV_JOB_PRIORITY_LOW 
EV_JOB_PRIORITY_NONE 
EV_JOB_N_PRIORITIES 

Definition at line 33 of file ev-job-scheduler.h.

33  {
34  EV_JOB_PRIORITY_URGENT, /* Rendering current page range */
35  EV_JOB_PRIORITY_HIGH, /* Rendering current thumbnail range */
36  EV_JOB_PRIORITY_LOW, /* Rendering pages not in current range */
37  EV_JOB_PRIORITY_NONE, /* Any other job: load, save, print, ... */

Function Documentation

EvJob* ev_job_scheduler_get_running_thread_job ( void  )

ev_job_scheduler_get_running_thread_job:

Returns: (transfer none): an EvJob

Definition at line 316 of file ev-job-scheduler.c.

317 {
318  return g_atomic_pointer_get (&running_job);
319 }

+ Here is the caller graph for this function:

void ev_job_scheduler_push_job ( EvJob job,
EvJobPriority  priority 
)

Definition at line 225 of file ev-job-scheduler.c.

227 {
228  static GOnce once_init = G_ONCE_INIT;
229  EvSchedulerJob *s_job;
230 
231  g_once (&once_init, ev_job_scheduler_init, NULL);
232 
233  ev_debug_message (DEBUG_JOBS, "%s pirority %d", EV_GET_TYPE_NAME (job), priority);
234 
235  s_job = g_new0 (EvSchedulerJob, 1);
236  s_job->job = g_object_ref (job);
237  s_job->priority = priority;
238 
240 
241  switch (ev_job_get_run_mode (job)) {
242  case EV_JOB_RUN_THREAD:
243  g_signal_connect_swapped (job->cancellable, "cancelled",
245  s_job);
246  ev_job_queue_push (s_job, priority);
247  break;
249  g_signal_connect_swapped (job, "finished",
250  G_CALLBACK (ev_scheduler_job_destroy),
251  s_job);
252  g_signal_connect_swapped (job, "cancelled",
253  G_CALLBACK (ev_scheduler_job_destroy),
254  s_job);
255  g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
256  (GSourceFunc)ev_job_idle,
257  g_object_ref (job),
258  (GDestroyNotify)g_object_unref);
259  break;
260  default:
261  g_assert_not_reached ();
262  }
263 }

+ Here is the caller graph for this function:

void ev_job_scheduler_update_job ( EvJob job,
EvJobPriority  priority 
)

Definition at line 266 of file ev-job-scheduler.c.

268 {
269  GSList *l;
270  EvSchedulerJob *s_job = NULL;
271  gboolean need_resort = FALSE;
272 
273  /* Main loop jobs are scheduled inmediately */
275  return;
276 
277  ev_debug_message (DEBUG_JOBS, "%s pirority %d", EV_GET_TYPE_NAME (job), priority);
278 
279  G_LOCK (job_list);
280 
281  for (l = job_list; l; l = l->next) {
282  s_job = (EvSchedulerJob *)l->data;
283 
284  if (s_job->job == job) {
285  need_resort = (s_job->priority != priority);
286  break;
287  }
288  }
289 
290  G_UNLOCK (job_list);
291 
292  if (need_resort) {
293  GList *list;
294 
295  g_mutex_lock (&job_queue_mutex);
296 
297  list = g_queue_find (job_queue[s_job->priority], s_job);
298  if (list) {
299  ev_debug_message (DEBUG_JOBS, "Moving job %s from pirority %d to %d",
300  EV_GET_TYPE_NAME (job), s_job->priority, priority);
301  g_queue_delete_link (job_queue[s_job->priority], list);
302  g_queue_push_tail (job_queue[priority], s_job);
303  g_cond_broadcast (&job_queue_cond);
304  }
305 
306  g_mutex_unlock (&job_queue_mutex);
307  }
308 }

+ Here is the caller graph for this function: