]> git.lyx.org Git - lyx.git/blobdiff - src/ConverterCache.cpp
Fix trailing whitespace in cpp files.
[lyx.git] / src / ConverterCache.cpp
index 820eb060b5f8ac83d2a2020a740771090c9e8966..60ce245ab9671489e9aa42e35786520df9ad4370 100644 (file)
@@ -56,7 +56,7 @@ static FileName cache_dir;
 
 class CacheItem {
 public:
-       CacheItem() {}
+       CacheItem() : timestamp(0), checksum(0) {}
        CacheItem(FileName const & orig_from, string const & to_format,
                  time_t t, unsigned long c)
                : timestamp(t), checksum(c)
@@ -159,7 +159,11 @@ void ConverterCache::Impl::readIndex()
                FormatCache & format_cache = cache[orig_from_name];
                if (format_cache.from_format.empty())
                        format_cache.from_format =
-                               formats.getFormatFromFile(orig_from_name);
+                               // FIXME perf: This very expensive function is called on all
+                               // cached files on opening. This slows LyX startup a lot. It
+                               // would be better if this information was retrieved in a
+                               // delayed fashion.
+                               theFormats().getFormatFromFile(orig_from_name);
                format_cache.cache[to_format] = item;
        }
        is.close();
@@ -223,7 +227,6 @@ ConverterCache::~ConverterCache()
 }
 
 
-// FIXME THREAD
 ConverterCache & ConverterCache::get()
 {
        // Now return the cache
@@ -251,7 +254,7 @@ void ConverterCache::init()
 
 void ConverterCache::writeIndex() const
 {
-       if (!lyxrc.use_converter_cache 
+       if (!lyxrc.use_converter_cache
                  || cache_dir.empty())
                return;
        pimpl_->writeIndex();
@@ -317,7 +320,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
                        FormatCache & format_cache = pimpl_->cache[orig_from];
                        if (format_cache.from_format.empty())
                                format_cache.from_format =
-                                       formats.getFormatFromFile(orig_from);
+                                       theFormats().getFormatFromFile(orig_from);
                        format_cache.cache[to_format] = new_item;
                } else
                        LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n"