Bugzilla – Attachment 40993 Details for
Bug 32293
LibreOffice opens and reads the basis-link file ridiculously often
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Experimental patch
link-cache.diff (text/plain), 7.34 KB, created by
Don't use this account, use tml@iki.fi
on 2010-12-10 12:00:11 UTC
(
hide
)
Description:
Experimental patch
Filename:
MIME Type:
Creator:
Don't use this account, use tml@iki.fi
Created:
2010-12-10 12:00:11 UTC
Size:
7.34 KB
patch
obsolete
>--- ../../../clone/ure/sal/rtl/source/bootstrap.cxx 2010-11-03 15:02:16.732664100 +0200 >+++ rtl/source/bootstrap.cxx 2010-12-10 21:45:26.953587100 +0200 >@@ -355,6 +355,10 @@ Bootstrap_Impl::Bootstrap_Impl( OUString > _iniName (rIniName) > { > OUString base_ini( getIniFileName_Impl() ); >+#if OSL_DEBUG_LEVEL > 1 >+ OString sBaseIni = OUStringToOString(base_ini, RTL_TEXTENCODING_ASCII_US); >+ OSL_TRACE(__FILE__" -- Bootstrap_Impl() - base_ini=%s", sBaseIni.getStr()); >+#endif /* OSL_DEBUG_LEVEL > 1 */ > // normalize path > FileStatus status( FileStatusMask_FileURL ); > DirectoryItem dirItem; >@@ -371,7 +375,7 @@ Bootstrap_Impl::Bootstrap_Impl( OUString > > #if OSL_DEBUG_LEVEL > 1 > OString sFile = OUStringToOString(_iniName, RTL_TEXTENCODING_ASCII_US); >- OSL_TRACE(__FILE__" -- Bootstrap_Impl() - %s\n", sFile.getStr()); >+ OSL_TRACE(__FILE__" -- Bootstrap_Impl() - %s", sFile.getStr()); > #endif /* OSL_DEBUG_LEVEL > 1 */ > > oslFileHandle handle; >@@ -396,7 +400,7 @@ Bootstrap_Impl::Bootstrap_Impl( OUString > OString name_tmp = OUStringToOString(nameValue.sName, RTL_TEXTENCODING_ASCII_US); > OString value_tmp = OUStringToOString(nameValue.sValue, RTL_TEXTENCODING_UTF8); > OSL_TRACE( >- __FILE__" -- pushing: name=%s value=%s\n", >+ __FILE__" -- pushing: name=%s value=%s", > name_tmp.getStr(), value_tmp.getStr() ); > #endif /* OSL_DEBUG_LEVEL > 1 */ > >@@ -642,6 +646,37 @@ private: > > bootstrap_map::t * bootstrap_map::m_map = NULL; > >+struct link_map { >+ typedef std::hash_map< >+ rtl::OUString, rtl::OUString, >+ rtl::OUStringHash, std::equal_to< rtl::OUString >, >+ rtl::Allocator< OUString > > t; >+ >+ // get and release must only be called properly synchronized via some mutex >+ // (e.g., osl::Mutex::getGlobalMutex()): >+ >+ static t * get() { >+ if (m_map == NULL) { >+ m_map = new t; >+ } >+ return m_map; >+ } >+ >+ static void release() { >+ if (m_map != NULL && m_map->empty()) { >+ delete m_map; >+ m_map = NULL; >+ } >+ } >+ >+private: >+ link_map(); // not defined >+ >+ static t * m_map; >+}; >+ >+link_map::t * link_map::m_map = NULL; >+ > } > > //---------------------------------------------------------------------------- >@@ -661,6 +696,10 @@ rtlBootstrapHandle SAL_CALL rtl_bootstra > return 0; > } > iniName = status.getFileURL(); >+#if OSL_DEBUG_LEVEL > 1 >+ OString sIniName = OUStringToOString(iniName, RTL_TEXTENCODING_ASCII_US); >+ OSL_TRACE(__FILE__" -- rtl_bootstrap_args_open(%s)", sIniName.getStr()); >+#endif /* OSL_DEBUG_LEVEL > 1 */ > > Bootstrap_Impl * that; > osl::ResettableMutexGuard guard( osl::Mutex::getGlobalMutex() ); >@@ -716,13 +755,7 @@ void SAL_CALL rtl_bootstrap_args_close ( > --that->_nRefCount; > if (that->_nRefCount == 0) > { >- ::std::size_t nLeaking = 8; // only hold up to 8 files statically >- >-#if OSL_DEBUG_LEVEL == 1 // nonpro >- nLeaking = 0; >-#elif OSL_DEBUG_LEVEL > 1 // debug >- nLeaking = 1; >-#endif /* OSL_DEBUG_LEVEL */ >+ ::std::size_t nLeaking = 16; // only hold up to 16 files statically > > if (p_bootstrap_map->size() > nLeaking) > { >@@ -831,7 +864,7 @@ void SAL_CALL rtl_bootstrap_set ( > OString cstr_name( OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ) ); > OString cstr_value( OUStringToOString( value, RTL_TEXTENCODING_ASCII_US ) ); > OSL_TRACE( >- "bootstrap.cxx: explicitly setting: name=%s value=%s\n", >+ "bootstrap.cxx: explicitly setting: name=%s value=%s", > cstr_name.getStr(), cstr_value.getStr() ); > #endif /* OSL_DEBUG_LEVEL > 1 */ > >@@ -980,27 +1013,42 @@ rtl::OUString expandMacros( > if (seg[0].equalsAsciiL( > RTL_CONSTASCII_STRINGPARAM(".link"))) > { >- osl::File f(seg[1]); >- rtl::ByteSequence seq; >- rtl::OUString line; >- rtl::OUString url; >- // Silently ignore any errors (is that good?): >- if (f.open(OpenFlag_Read) == osl::FileBase::E_None && >- f.readLine(seq) == osl::FileBase::E_None && >- rtl_convertStringToUString( >- &line.pData, >- reinterpret_cast< char const * >( >- seq.getConstArray()), >- seq.getLength(), RTL_TEXTENCODING_UTF8, >- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | >- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | >- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)) && >- (osl::File::getFileURLFromSystemPath(line, url) == >- osl::FileBase::E_None)) >+ osl::ResettableMutexGuard guard( osl::Mutex::getGlobalMutex() ); >+ link_map::t* p_link_map = link_map::get(); >+ link_map::t::const_iterator iFind( p_link_map->find (seg[1] )); >+ if (iFind == p_link_map->end()) > { >+ osl::File f(seg[1]); >+ rtl::ByteSequence seq; >+ rtl::OUString line; >+ rtl::OUString url; >+ // Silently ignore any errors (is that good?): >+ if (f.open(OpenFlag_Read) == osl::FileBase::E_None && >+ f.readLine(seq) == osl::FileBase::E_None && >+ rtl_convertStringToUString( >+ &line.pData, >+ reinterpret_cast< char const * >( >+ seq.getConstArray()), >+ seq.getLength(), RTL_TEXTENCODING_UTF8, >+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | >+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | >+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)) && >+ (osl::File::getFileURLFromSystemPath(line, url) == >+ osl::FileBase::E_None)) >+ { >+ try { >+ buf.append( >+ rtl::Uri::convertRelToAbs(seg[1], url)); >+ ::std::pair< link_map::t::iterator, bool > insertion( >+ p_link_map->insert( >+ link_map::t::value_type( seg[1], url ) ) ); >+ OSL_ASSERT( insertion.second ); >+ } catch (rtl::MalformedUriException &) {} >+ } >+ } else { > try { > buf.append( >- rtl::Uri::convertRelToAbs(seg[1], url)); >+ rtl::Uri::convertRelToAbs(seg[1], iFind->second)); > } catch (rtl::MalformedUriException &) {} > } > } else {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 32293
: 40993