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));
        }
 internal BrowserPageInspectSubscription(MovieBuilderPool pool, IBrowserContent request, IBrowser browser, MovieBuilder builder)
 {
     this.builder = builder;
     this.request = request;
     this.browser = browser;
     this.pool    = pool;
 }
Exemple #3
0
 public PendingBuildAsyncOperation(MovieBuilder builder)
 {
     this.builder = builder;
     Interlocked.Increment(ref builder.waitingEvents);
 }
        public MovieBuilder CreateBuilder(BasicMovieInfo movieInfo)
        {
            var builder = new MovieBuilder(this, movieInfo);

            return(builder);
        }
 public RunningPage(Uri uri, MovieBuilder builder, IBrowser browser)
 {
     Uri     = uri;
     Builder = builder;
     Browser = browser;
 }
 public Page(IBrowserContent request, MovieBuilder builder)
 {
     Request = request;
     Builder = builder;
 }