Ejemplo n.º 1
0
        internal void Enqueue(IBrowserContent request, MovieBuilder builder)
        {
            IBrowser browser;

            if (runningPages.Count < MaxRunningPages && availableWorkers.TryDequeue(out browser))
            {
                try
                {
                    lock (this)
                    {
                        runningPages.Add(new RunningPage(request.Uri, builder, browser));
                    }
                    browser.Navigate(request.Uri).ContinueWith(task => PageLoaded(new BrowserPageInspectSubscription(this, request, browser, builder)));
                    return;
                }
                catch (Exception ex)
                {
                    logger.Error(string.Format("Unable to navigate to the page {0}", request.Uri), ex);
                    availableWorkers.Enqueue(browser);
                    throw;
                }
            }

            logger.Info("An address has been enqueued: " + request.Uri);
            enqueuedPages.Enqueue(new Page(request, builder));
        }
Ejemplo n.º 2
0
 internal BrowserPageInspectSubscription(MovieBuilderPool pool, IBrowserContent request, IBrowser browser, MovieBuilder builder)
 {
     this.builder = builder;
     this.request = request;
     this.browser = browser;
     this.pool    = pool;
 }
Ejemplo n.º 3
0
 public PendingBuildAsyncOperation(MovieBuilder builder)
 {
     this.builder = builder;
     Interlocked.Increment(ref builder.waitingEvents);
 }
Ejemplo n.º 4
0
        public MovieBuilder CreateBuilder(BasicMovieInfo movieInfo)
        {
            var builder = new MovieBuilder(this, movieInfo);

            return(builder);
        }
Ejemplo n.º 5
0
 public RunningPage(Uri uri, MovieBuilder builder, IBrowser browser)
 {
     Uri     = uri;
     Builder = builder;
     Browser = browser;
 }
Ejemplo n.º 6
0
 public Page(IBrowserContent request, MovieBuilder builder)
 {
     Request = request;
     Builder = builder;
 }