Пример #1
0
void Load::loadSingleFile() {
  std::string loaderName = getPropertyValue("LoaderName");
  if (loaderName.empty()) {
    m_loader = getFileLoader(getPropertyValue("Filename"));
    loaderName = m_loader->name();
  } else {
    m_loader = createLoader(0, 1);
    findFilenameProperty(m_loader);
  }
  g_log.information() << "Using " << loaderName << " version "
                      << m_loader->version() << ".\n";
  /// get the list properties for the concrete loader load algorithm
  const std::vector<Kernel::Property *> &loader_props =
      m_loader->getProperties();

  // Loop through and set the properties on the Child Algorithm
  std::vector<Kernel::Property *>::const_iterator itr;
  for (itr = loader_props.begin(); itr != loader_props.end(); ++itr) {
    const std::string propName = (*itr)->name();
    if (this->existsProperty(propName)) {
      m_loader->setPropertyValue(propName, getPropertyValue(propName));
    } else if (propName == m_filenamePropName) {
      m_loader->setPropertyValue(propName, getPropertyValue("Filename"));
    }
  }

  // Execute the concrete loader
  m_loader->execute();
  // Set the workspace. Deals with possible multiple periods
  setOutputWorkspace(m_loader);
}
Пример #2
0
void RemoteSource::automaticLoad(
		Data::FileOrigin origin,
		const HistoryItem *item) {
	if (!item || cancelled()) {
		return;
	}
	const auto loadFromCloud = Data::AutoDownload::Should(
		Auth().settings().autoDownload(),
		item->history()->peer,
		this);

	if (_loader) {
		if (loadFromCloud) {
			_loader->permitLoadFromCloud();
		}
	} else {
		_loader = createLoader(
			origin,
			loadFromCloud ? LoadFromCloudOrLocal : LoadFromLocalOnly,
			true);
	}
	if (loaderValid()) {
		_loader->start();
	}
}
Пример #3
0
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
{
    ASSERT(!request.url().isEmpty() && request.url().isValid());
    ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));

    if (HTMLImportChild* childToShareWith = root()->find(request.url())) {
        HTMLImportLoader* loader = childToShareWith->loader();
        ASSERT(loader);
        HTMLImportChild* child = createChild(request.url(), loader, parent, client);
        child->didShareLoader();
        return child;
    }

    bool sameOriginRequest = master()->securityOrigin()->canRequest(request.url());
    request.setCrossOriginAccessControl(
        master()->securityOrigin(), sameOriginRequest ? AllowStoredCredentials : DoNotAllowStoredCredentials,
        ClientDidNotRequestCredentials);
    ResourcePtr<RawResource> resource = parent->document()->fetcher()->fetchImport(request);
    if (!resource)
        return 0;

    HTMLImportLoader* loader = createLoader();
    HTMLImportChild* child = createChild(request.url(), loader, parent, client);
    // We set resource after the import tree is built since
    // Resource::addClient() immediately calls back to feed the bytes when the resource is cached.
    loader->startLoading(resource);
    child->didStartLoading();
    return child;
}
Пример #4
0
void RemoteSource::loadLocal() {
	if (loaderValid()) {
		return;
	}

	_loader = createLoader(Data::FileOrigin(), LoadFromLocalOnly, true);
	if (_loader) _loader->start();
}
Пример #5
0
void HTMLImportChild::ensureLoader()
{
    if (m_loader)
        return;

    if (HTMLImportChild* found = root()->findLinkFor(m_url, this))
        shareLoader(found);
    else
        createLoader();
}
void testRootAutoLibraryLoader::testString()
{
   if(not edmplugin::PluginManager::isAvailable()) {
      edmplugin::PluginManager::configure(edmplugin::standard::config());
   }
   edm::RootAutoLibraryLoader* loader = createLoader();
   
   CPPUNIT_ASSERT(0!=loader->GetClass("edm::Wrapper<std::basic_string<char> >", true));
   
   CPPUNIT_ASSERT(0==loader->GetClass("ThisClassDoesNotExist",true));
}
Пример #7
0
void RemoteSource::load(
		Data::FileOrigin origin,
		bool loadFirst,
		bool prior) {
	if (!_loader) {
		_loader = createLoader(origin, LoadFromCloudOrLocal, false);
	}
	if (loaderValid()) {
		_loader->start(loadFirst, prior);
	}
}
Пример #8
0
void HTMLImportChild::ensureLoader()
{
    if (m_loader)
        return;

    if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_url, this))
        shareLoader(found);
    else
        createLoader();

    if (!isDone() && !formsCycle()) {
        ASSERT(!m_customElementMicrotaskStep);
        m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->weakPtr();
    }
}
Пример #9
0
void RemoteSource::setImageBytes(const QByteArray &bytes) {
	if (bytes.isEmpty()) {
		return;
	} else if (loaderValid()) {
		unload();
	}
	_loader = createLoader({}, LoadFromLocalOnly, true);
	_loader->finishWithBytes(bytes);

	const auto location = this->location();
	if (!location.isNull()
		&& !bytes.isEmpty()
		&& bytes.size() <= Storage::kMaxFileInMemory) {
		Auth().data().cache().putIfEmpty(
			Data::StorageCacheKey(location),
			Storage::Cache::Database::TaggedValue(
				base::duplicate(bytes),
				Data::kImageCacheTag));
	}
}
Пример #10
0
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
{
    ASSERT(!request.url().isEmpty() && request.url().isValid());
    ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));

    if (HTMLImportChild* childToShareWith = root()->find(request.url())) {
        HTMLImportLoader* loader = childToShareWith->loader();
        ASSERT(loader);
        HTMLImportChild* child = createChild(request.url(), loader, parent, client);
        child->didShareLoader();
        return child;
    }

    HTMLImportLoader* loader = createLoader();
    HTMLImportChild* child = createChild(request.url(), loader, parent, client);
    // We set resource after the import tree is built since
    // Resource::addClient() immediately calls back to feed the bytes when the resource is cached.
    loader->startLoading(request.url());
    child->didStartLoading();
    return child;
}