Merge change 26917 into eclair
* changes: Fix invokables to make sure script pointers are setup before invoking function calls. Reduce app startup time up to 1s.
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.android.fountain">
|
package="com.android.fountain">
|
||||||
<application android:label="Fountain">
|
<application android:label="Fountain">
|
||||||
<activity android:name="Fountain"
|
<activity android:name="Fountain">
|
||||||
android:theme="@android:style/Theme.Translucent">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(!mRunning) {
|
while(!mRunning) {
|
||||||
sleep(1);
|
usleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_attr_destroy(&threadAttr);
|
pthread_attr_destroy(&threadAttr);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes)
|
|||||||
if ((mPut+bytes) > mEnd) {
|
if ((mPut+bytes) > mEnd) {
|
||||||
// Need to loop regardless of where get is.
|
// Need to loop regardless of where get is.
|
||||||
while((mGet > mPut) && (mBuffer+4 >= mGet)) {
|
while((mGet > mPut) && (mBuffer+4 >= mGet)) {
|
||||||
sleep(1);
|
usleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toss in a reset then the normal wait for space will do the rest.
|
// Toss in a reset then the normal wait for space will do the rest.
|
||||||
@@ -170,7 +170,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes)
|
|||||||
|
|
||||||
// it will fit here so we just need to wait for space.
|
// it will fit here so we just need to wait for space.
|
||||||
while(getFreeSpace() < bytes) {
|
while(getFreeSpace() < bytes) {
|
||||||
sleep(1);
|
usleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot)
|
|||||||
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot)
|
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot)
|
||||||
{
|
{
|
||||||
Script *s = static_cast<Script *>(vs);
|
Script *s = static_cast<Script *>(vs);
|
||||||
|
s->setupScript();
|
||||||
s->mEnviroment.mInvokables[slot]();
|
s->mEnviroment.mInvokables[slot]();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual void setupScript() = 0;
|
||||||
virtual bool run(Context *, uint32_t launchID) = 0;
|
virtual bool run(Context *, uint32_t launchID) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,15 @@ ScriptC::~ScriptC()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptC::setupScript()
|
||||||
|
{
|
||||||
|
for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) {
|
||||||
|
if (mProgram.mSlotPointers[ct]) {
|
||||||
|
*mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ScriptC::run(Context *rsc, uint32_t launchIndex)
|
bool ScriptC::run(Context *rsc, uint32_t launchIndex)
|
||||||
{
|
{
|
||||||
@@ -66,12 +75,7 @@ bool ScriptC::run(Context *rsc, uint32_t launchIndex)
|
|||||||
mEnviroment.mStartTimeMillis
|
mEnviroment.mStartTimeMillis
|
||||||
= nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
|
= nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
|
||||||
}
|
}
|
||||||
|
setupScript();
|
||||||
for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) {
|
|
||||||
if (mProgram.mSlotPointers[ct]) {
|
|
||||||
*mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
tls->mScript = this;
|
tls->mScript = this;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
|
|
||||||
ACCscript* mAccScript;
|
ACCscript* mAccScript;
|
||||||
|
|
||||||
|
virtual void setupScript();
|
||||||
virtual bool run(Context *, uint32_t launchID);
|
virtual bool run(Context *, uint32_t launchID);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user