Remove now-unused job dependencies.
authorCarl Hetherington <cth@carlh.net>
Sat, 16 Feb 2013 22:31:58 +0000 (22:31 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 16 Feb 2013 22:31:58 +0000 (22:31 +0000)
13 files changed:
src/lib/ab_transcode_job.cc
src/lib/ab_transcode_job.h
src/lib/examine_content_job.cc
src/lib/examine_content_job.h
src/lib/film.cc
src/lib/job.cc
src/lib/job.h
src/lib/job_manager.cc
src/lib/scp_dcp_job.cc
src/lib/scp_dcp_job.h
src/lib/transcode_job.cc
src/lib/transcode_job.h
test/test.cc

index 0efd277bb73799a76fdbf0f68aec04e36f7ab2d0..025c23c86e633cb00c2867e9d7b370bb5f58cd76 100644 (file)
@@ -32,8 +32,8 @@ using boost::shared_ptr;
 /** @param f Film to compare.
  *  @param o Decode options.
  */
-ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f, DecodeOptions o, shared_ptr<Job> req)
-       : Job (f, req)
+ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f, DecodeOptions o)
+       : Job (f)
        , _decode_opt (o)
 {
        _film_b.reset (new Film (*_film));
index 983842038f936cb4ad0f0e63aeef8600e82712aa..8e3cbe2d8f8990586218b8925f3a9b5ed1514bee 100644 (file)
@@ -39,8 +39,7 @@ class ABTranscodeJob : public Job
 public:
        ABTranscodeJob (
                boost::shared_ptr<Film> f,
-               DecodeOptions o,
-               boost::shared_ptr<Job> req
+               DecodeOptions o
                );
 
        std::string name () const;
index 94e5320fe3a2f8aa39116e533426aa56851f5b9c..31d76c4f7d3317e7bfa46278ee6cb281c762dc1d 100644 (file)
@@ -36,8 +36,8 @@ using std::vector;
 using std::pair;
 using boost::shared_ptr;
 
-ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Job> req)
-       : Job (f, req)
+ExamineContentJob::ExamineContentJob (shared_ptr<Film> f)
+       : Job (f)
 {
 
 }
index 729c287b58fe66488526f02eeff31708d2f7d307..8ee4f0d608de5e8b591e68f23dd2634929065dbe 100644 (file)
@@ -29,7 +29,7 @@
 class ExamineContentJob : public Job
 {
 public:
-       ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
+       ExamineContentJob (boost::shared_ptr<Film>);
        ~ExamineContentJob ();
 
        std::string name () const;
index 36ebe719975bdb11a80133c3edc57e0fe9890956..289a8c3480ff0c445e3f62f0a59a531302e18713 100644 (file)
@@ -300,9 +300,9 @@ Film::make_dcp (bool transcode)
 
        if (transcode) {
                if (dcp_ab()) {
-                       r = JobManager::instance()->add (shared_ptr<Job> (new ABTranscodeJob (shared_from_this(), od, shared_ptr<Job> ())));
+                       r = JobManager::instance()->add (shared_ptr<Job> (new ABTranscodeJob (shared_from_this(), od)));
                } else {
-                       r = JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this(), od, shared_ptr<Job> ())));
+                       r = JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this(), od)));
                }
        }
 }
@@ -315,7 +315,7 @@ Film::examine_content ()
                return;
        }
 
-       _examine_content_job.reset (new ExamineContentJob (shared_from_this(), shared_ptr<Job> ()));
+       _examine_content_job.reset (new ExamineContentJob (shared_from_this()));
        _examine_content_job->Finished.connect (bind (&Film::examine_content_finished, this));
        JobManager::instance()->add (_examine_content_job);
 }
@@ -330,7 +330,7 @@ Film::examine_content_finished ()
 void
 Film::send_dcp_to_tms ()
 {
-       shared_ptr<Job> j (new SCPDCPJob (shared_from_this(), shared_ptr<Job> ()));
+       shared_ptr<Job> j (new SCPDCPJob (shared_from_this()));
        JobManager::instance()->add (j);
 }
 
index dd034bf0cf52d7225b2cb3b0d9f47927ed9165a9..bde2c8cfd69ca47bffb84f837d17199508e454ef 100644 (file)
@@ -33,11 +33,9 @@ using std::stringstream;
 using boost::shared_ptr;
 
 /** @param s Film that we are operating on.
- *  @param req Job that must be completed before this job is run.
  */
-Job::Job (shared_ptr<Film> f, shared_ptr<Job> req)
+Job::Job (shared_ptr<Film> f)
        : _film (f)
-       , _required (req)
        , _state (NEW)
        , _start_time (0)
        , _progress_unknown (false)
index 1ea0a9b17373793693c45eaaa2c64c1c749d5e57..1538e2779563910e67e998b2ec87c10f80838fcd 100644 (file)
@@ -37,7 +37,7 @@ class Film;
 class Job : public boost::enable_shared_from_this<Job>
 {
 public:
-       Job (boost::shared_ptr<Film> s, boost::shared_ptr<Job> req);
+       Job (boost::shared_ptr<Film> s);
        virtual ~Job() {}
 
        /** @return user-readable name of this job */
@@ -65,10 +65,6 @@ public:
        void descend (float);
        float overall_progress () const;
 
-       boost::shared_ptr<Job> required () const {
-               return _required;
-       }
-
        boost::signals2::signal<void()> Finished;
 
 protected:
@@ -93,8 +89,6 @@ private:
 
        void run_wrapper ();
 
-       boost::shared_ptr<Job> _required;
-
        /** mutex for _state and _error */
        mutable boost::mutex _state_mutex;
        /** current state of the job */
index fa02fd37014454cb992e74bb800290c85e762957..9105976280dd3b7d5ab58f81a362bdb72dcf5a9d 100644 (file)
@@ -111,13 +111,10 @@ JobManager::scheduler ()
                                }
                                
                                if ((*i)->is_new()) {
-                                       shared_ptr<Job> r = (*i)->required ();
-                                       if (!r || r->finished_ok ()) {
-                                               (*i)->start ();
-
-                                               /* Only start one job at once */
-                                               break;
-                                       }
+                                       (*i)->start ();
+                                       
+                                       /* Only start one job at once */
+                                       break;
                                }
                        }
                }
index 3d941888e76585350f461417893d9bd4daab32dd..30d02eff87604ceb9a697a4386f3619d9efa9276 100644 (file)
@@ -94,8 +94,8 @@ public:
 };
 
 
-SCPDCPJob::SCPDCPJob (shared_ptr<Film> f, shared_ptr<Job> req)
-       : Job (f, req)
+SCPDCPJob::SCPDCPJob (shared_ptr<Film> f)
+       : Job (f)
        , _status ("Waiting")
 {
 
index 5d0bfe7b4187939a633f88e6cecdbc450171b6ed..08d8e2c787ec9b26abaec751127e875dd5f627e4 100644 (file)
@@ -26,7 +26,7 @@
 class SCPDCPJob : public Job
 {
 public:
-       SCPDCPJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
+       SCPDCPJob (boost::shared_ptr<Film>);
 
        std::string name () const;
        void run ();
index e9a59c743ad3fc81e12abceb3c320f11a4db485d..87e9a47c4b6ca678d5b7978f04471f91babe5ebe 100644 (file)
@@ -38,10 +38,9 @@ using boost::shared_ptr;
 
 /** @param s Film to use.
  *  @param o Decode options.
- *  @param req Job that must be completed before this job is run.
  */
-TranscodeJob::TranscodeJob (shared_ptr<Film> f, DecodeOptions o, shared_ptr<Job> req)
-       : Job (f, req)
+TranscodeJob::TranscodeJob (shared_ptr<Film> f, DecodeOptions o)
+       : Job (f)
        , _decode_opt (o)
 {
        
index 8f78e7f6a899b8d3e5dda3f11da4adce2a1fdfcc..9b69e4e6563ac39f7260f6821afd2cad881c181b 100644 (file)
@@ -33,7 +33,7 @@ class Encoder;
 class TranscodeJob : public Job
 {
 public:
-       TranscodeJob (boost::shared_ptr<Film> f, DecodeOptions od, boost::shared_ptr<Job> req);
+       TranscodeJob (boost::shared_ptr<Film> f, DecodeOptions od);
        
        std::string name () const;
        void run ();
index 75199fac7ebd834e29d918405d1915a76b264a51..771325d2977ee75680fafab61d1fad5caef892bd 100644 (file)
@@ -652,8 +652,8 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
 class TestJob : public Job
 {
 public:
-       TestJob (shared_ptr<Film> f, shared_ptr<Job> req)
-               : Job (f, req)
+       TestJob (shared_ptr<Film> f)
+               : Job (f)
        {
 
        }
@@ -684,8 +684,8 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
 {
        shared_ptr<Film> f;
 
-       /* Single job, no dependency */
-       shared_ptr<TestJob> a (new TestJob (f, shared_ptr<Job> ()));
+       /* Single job */
+       shared_ptr<TestJob> a (new TestJob (f));
 
        JobManager::instance()->add (a);
        dvdomatic_sleep (1);
@@ -693,37 +693,6 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
        a->set_finished_ok ();
        dvdomatic_sleep (2);
        BOOST_CHECK_EQUAL (a->finished_ok(), true);
-
-       /* Two jobs, dependency */
-       a.reset (new TestJob (f, shared_ptr<Job> ()));
-       shared_ptr<TestJob> b (new TestJob (f, a));
-
-       JobManager::instance()->add (a);
-       JobManager::instance()->add (b);
-       dvdomatic_sleep (2);
-       BOOST_CHECK_EQUAL (a->running(), true);
-       BOOST_CHECK_EQUAL (b->running(), false);
-       a->set_finished_ok ();
-       dvdomatic_sleep (2);
-       BOOST_CHECK_EQUAL (a->finished_ok(), true);
-       BOOST_CHECK_EQUAL (b->running(), true);
-       b->set_finished_ok ();
-       dvdomatic_sleep (2);
-       BOOST_CHECK_EQUAL (b->finished_ok(), true);
-
-       /* Two jobs, dependency, first fails */
-       a.reset (new TestJob (f, shared_ptr<Job> ()));
-       b.reset (new TestJob (f, a));
-
-       JobManager::instance()->add (a);
-       JobManager::instance()->add (b);
-       dvdomatic_sleep (2);
-       BOOST_CHECK_EQUAL (a->running(), true);
-       BOOST_CHECK_EQUAL (b->running(), false);
-       a->set_finished_error ();
-       dvdomatic_sleep (2);
-       BOOST_CHECK_EQUAL (a->finished_in_error(), true);
-       BOOST_CHECK_EQUAL (b->running(), false);
 }
 
 BOOST_AUTO_TEST_CASE (compact_image_test)