summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-12-01 00:36:08 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-12-01 00:36:08 +1000
commitc2146b319172d8fa8b4e9cdfee362fcbdfde632f (patch)
treedd981e4150f14cec496a794ceb376dad714a7b43
parentf86ca84e783c34e701f3742902161cb365e6e940 (diff)
parent04ae67db5330c379ab05e91132dd28c517e280c6 (diff)
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: Reduce unnecessary QtCore DLL loads during Symbian app thread creation
-rw-r--r--src/s60main/newallocator_hook.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/s60main/newallocator_hook.cpp b/src/s60main/newallocator_hook.cpp
index 7e0b344bac..4cec214c79 100644
--- a/src/s60main/newallocator_hook.cpp
+++ b/src/s60main/newallocator_hook.cpp
@@ -109,26 +109,38 @@ struct SStdEpocThreadCreateInfo : public SThreadCreateInfo
* startup. On return, there is some kind of heap allocator installed on the
* thread.
*/
+typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
+// keep the SetupThreadHeap() pointer so that we don't reload QtCore.dll after the first time
+static TSetupThreadHeapFunc gp_qt_symbian_SetupThreadHeap = 0;
+static bool gp_qt_symbian_SetupThreadHeap_set = false;
+
TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
{
TInt r = KErrNone;
#ifndef __WINS__
- // attempt to create the fast allocator through a known export ordinal in qtcore.dll
- RLibrary qtcore;
- if (qtcore.Load(QtCoreLibName) == KErrNone)
- {
- const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
- TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);
- if (libFunc)
- {
- typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
- TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc);
- r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo);
+ // on first call, aNotFirst will be false.
+ // on second call, gp_qt_symbian_SetupThreadHeap_set will be false(!) because WSD is zeroed after the first call
+ // on subsequent calls, both will be true and we can use the stored SetupThreadHeap() pointer
+ if (aNotFirst && gp_qt_symbian_SetupThreadHeap_set) {
+ if (gp_qt_symbian_SetupThreadHeap)
+ return (*gp_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo);
+ } else {
+ // attempt to create the fast allocator through a known export ordinal in qtcore.dll
+ RLibrary qtcore;
+ gp_qt_symbian_SetupThreadHeap_set = true;
+ if (qtcore.Load(QtCoreLibName) == KErrNone) {
+ const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
+ TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);
+ if (libFunc) {
+ TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc);
+ gp_qt_symbian_SetupThreadHeap = p_qt_symbian_SetupThreadHeap;
+ r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo);
+ }
+ qtcore.Close();
+ if (libFunc)
+ return r;
}
- qtcore.Close();
- if (libFunc)
- return r;
}
#endif