You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ft...@apache.org on 2014/01/27 18:23:57 UTC
[5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB
waits up to 20s per SWF before we can start debugging (without code clean up)
FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/59659f7c
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/59659f7c
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/59659f7c
Branch: refs/heads/develop
Commit: 59659f7cc66a20a9450d4a3117a5f999f1fa41c7
Parents: fb33548
Author: Frédéric Thomas <ft...@cpaglobal.com>
Authored: Mon Jan 27 17:17:38 2014 +0000
Committer: Frédéric Thomas <ft...@cpaglobal.com>
Committed: Mon Jan 27 17:17:38 2014 +0000
----------------------------------------------------------------------
.../java/flex/tools/debugger/cli/DebugCLI.java | 130 -------------------
.../flex/tools/debugger/cli/Extensions.java | 7 -
2 files changed, 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/59659f7c/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java b/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
index 83b603c..0f29cf3 100644
--- a/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
+++ b/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
@@ -296,18 +296,6 @@ public class DebugCLI implements Runnable, SourceLocator
*/
private static final String INFO_STACK_SHOW_THIS = "$infostackshowthis"; //$NON-NLS-1$
- /**
- * Number of milliseconds to wait for metadata.
- */
- private static final String METADATA_ATTEMPTS_PERIOD = "$metadataattemptsperiod"; //$NON-NLS-1$
-
- private static final String METADATA_NOT_AVAILABLE = "$metadatanotavailable"; //$NON-NLS-1$
-
- /**
- * How many times we should try to get metadata.
- */
- private static final String METADATA_ATTEMPTS = "$metadataattempts"; //$NON-NLS-1$
-
private static final String PLAYER_FULL_SUPPORT = "$playerfullsupport"; //$NON-NLS-1$
/**
@@ -1691,101 +1679,6 @@ public class DebugCLI implements Runnable, SourceLocator
}
}
- public void waitForMetaData() throws InProgressException
- {
- // perform a query to see if our metadata has loaded
- int metadatatries = propertyGet(METADATA_ATTEMPTS);
- int maxPerCall = 8; // cap on how many attempt we make per call
-
- int tries = Math.min(maxPerCall, metadatatries);
- if (tries > 0)
- {
- int remain = metadatatries - tries; // assume all get used up
-
- // perform the call and then update our remaining number of attempts
- try
- {
- tries = waitForMetaData(tries);
- remain = metadatatries - tries; // update our used count
- }
- catch(InProgressException ipe)
- {
- propertyPut(METADATA_ATTEMPTS, remain);
- throw ipe;
- }
- }
- }
-
- /**
- * Wait for the API to load function names, which
- * exist in the form of external meta-data.
- *
- * Only do this tries times, then give up
- *
- * We wait period * attempts
- */
- public int waitForMetaData(int attempts) throws InProgressException
- {
- int start = attempts;
- int period = propertyGet(METADATA_ATTEMPTS_PERIOD);
- while(attempts > 0)
- {
- // are we done yet?
- if (isMetaDataAvailable())
- break;
- else
- try { attempts--; Thread.sleep(period); } catch(InterruptedException ie) {}
- }
-
- // throw exception if still not ready
- if (!isMetaDataAvailable())
- throw new InProgressException();
-
- return start-attempts; // remaining number of tries
- }
-
- /**
- * Ask each swf if metadata processing is complete
- */
- public boolean isMetaDataAvailable()
- {
- boolean allLoaded = true;
- try
- {
- // we need to ask the session since our fileinfocache will hide the exception
- SwfInfo[] swfs = m_session.getSwfs();
- for(int i=0; i<swfs.length; i++)
- {
- // check if our processing is finished.
- SwfInfo swf = swfs[i];
- if (swf != null && !swf.isProcessingComplete())
- {
- allLoaded = false;
- break;
- }
- }
- }
- catch(NoResponseException nre)
- {
- // ok we still need to wait for player to read the swd in
- allLoaded = false;
- }
-
- // count the number of times we checked and it wasn't there
- if (!allLoaded)
- {
- int count = propertyGet(METADATA_NOT_AVAILABLE);
- count++;
- propertyPut(METADATA_NOT_AVAILABLE, count);
- }
- else
- {
- // success so we reset our attempt counter
- propertyPut(METADATA_ATTEMPTS, METADATA_RETRIES);
- }
- return allLoaded;
- }
-
void doInfoHandle()
{
if (hasMoreTokens())
@@ -1825,9 +1718,6 @@ public class DebugCLI implements Runnable, SourceLocator
// we take an optional single arg which specifies a module
try
{
- // let's wait a bit for the background load to complete
- waitForMetaData();
-
if (hasMoreTokens())
{
arg = nextToken();
@@ -1869,10 +1759,6 @@ public class DebugCLI implements Runnable, SourceLocator
{
err(ae.getMessage());
}
- catch(InProgressException ipe)
- {
- err(getLocalizationManager().getLocalizedTextString("functionListBeingPrepared")); //$NON-NLS-1$
- }
}
void listFunctionsFor(StringBuilder sb, SourceFile m)
@@ -2218,10 +2104,6 @@ public class DebugCLI implements Runnable, SourceLocator
// then see if it because of a swfloaded event
if( reason == SuspendReason.ScriptLoaded)
{
- // since the player takes a long time to provide swf/swd, try 80 * 250ms = ~20s
- if (propertyGet(METADATA_ATTEMPTS) > 0)
- try { waitForMetaData(80); } catch(InProgressException ipe) { }
-
m_fileInfo.setDirty();
processEvents();
propagateBreakpoints();
@@ -4186,8 +4068,6 @@ public class DebugCLI implements Runnable, SourceLocator
*/
private int[] parseFunctionName(int module, String partialFunctionName, boolean onlyThisModule) throws NoMatchException, AmbiguousException
{
- try { waitForMetaData(); } catch(InProgressException ipe) {} // wait a bit before we try this to give the background thread time to complete
-
SourceFile m = m_fileInfo.getFile(module);
ArrayList<ModuleFunctionPair> functionNames = new ArrayList<ModuleFunctionPair>(); // each member is a ModuleFunctionPair
@@ -4692,9 +4572,6 @@ public class DebugCLI implements Runnable, SourceLocator
// pause for a while during startup, don't let exceptions ripple outwards
try { waitTilHalted(); } catch(Exception e) {}
- // pause for a while during startup, don't let exceptions ripple outwards
- try { waitForMetaData(); } catch(Exception e) {}
-
setInitialSourceFile();
out(getLocalizationManager().getLocalizedTextString("setBreakpointsThenResume")); //$NON-NLS-1$
@@ -6484,9 +6361,6 @@ public class DebugCLI implements Runnable, SourceLocator
propertyPut(LAST_FRAME_DEPTH, 0);
propertyPut(CURRENT_FRAME_DEPTH, 0);
propertyPut(DISPLAY_FRAME_NUMBER, 0);
- propertyPut(METADATA_ATTEMPTS_PERIOD, 250); // 1/4s per attempt
- propertyPut(METADATA_NOT_AVAILABLE, 0); // counter for failures
- propertyPut(METADATA_ATTEMPTS, METADATA_RETRIES);
propertyPut(PLAYER_FULL_SUPPORT, correctVersion ? 1 : 0);
String previousURI = m_mruURI;
@@ -6513,10 +6387,6 @@ public class DebugCLI implements Runnable, SourceLocator
*/
void reapplyBreakpoints()
{
- // give us a bit of time to process the newly loaded swf
- if (propertyGet(METADATA_ATTEMPTS) > 0)
- try { waitForMetaData(80); } catch(InProgressException ipe) { }
-
int count = breakpointCount();
for(int i=0; i<count; i++)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/59659f7c/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java b/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
index aeedd72..0332100 100644
--- a/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
+++ b/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
@@ -116,9 +116,6 @@ public class Extensions
// we take an optional single arg which specifies a module
try
{
- // let's wait a bit for the background load to complete
- cli.waitForMetaData();
-
if (cli.hasMoreTokens())
{
arg = cli.nextToken();
@@ -160,10 +157,6 @@ public class Extensions
{
cli.err(nme.getMessage());
}
- catch(InProgressException ipe)
- {
- cli.err(getLocalizationManager().getLocalizedTextString("key20")); //$NON-NLS-1$
- }
}
/**
RE: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062:
FDB waits up to 20s per SWF before we can start debugging (without code
clean up)
Posted by Frédéric THOMAS <we...@hotmail.com>.
Justin,
yes, indeed, I'm trying to, making tests in IJ and FB, in many ways I can.
Frédéric THOMAS
> Subject: Re: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
> From: justin@classsoftware.com
> Date: Tue, 28 Jan 2014 08:31:28 +1100
> To: dev@flex.apache.org
>
> Hi,
>
> > I can't process as you say, there are small changes all over the classes, create a JIRA for each change would be a nightmare
> No need for a JIRA for each change - just a few more commits explaining the changes so they can be understood step by step.
>
> Some changes while valid (eg changing access from public to private because no one calls or marking something as final) it may change the intent so you might want to be a little careful with changes like that.
>
> Thanks,
> Justin
Re: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
> I can't process as you say, there are small changes all over the classes, create a JIRA for each change would be a nightmare
No need for a JIRA for each change - just a few more commits explaining the changes so they can be understood step by step.
Some changes while valid (eg changing access from public to private because no one calls or marking something as final) it may change the intent so you might want to be a little careful with changes like that.
Thanks,
Justin
RE: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062:
FDB waits up to 20s per SWF before we can start debugging (without code
clean up)
Posted by Frédéric THOMAS <we...@hotmail.com>.
Hi Justin,
I can't process as you say, there are small changes all over the classes, create a JIRA for each change would be a nightmare, if I do it again, it will be in one shot again, there are no unit tests but I do manual functional tests on my company projects and ask the team to do the same, it is not perfect but it still that.
Frédéric THOMAS
> Subject: Re: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
> From: justin@classsoftware.com
> Date: Tue, 28 Jan 2014 08:01:52 +1100
> To: dev@flex.apache.org
>
> Hi,
>
> Much nicer and easier to understand. Thanks for that.
>
> If you want to clean up the code go for it but try and commit in small bits explaining each change so the changes can be reviewed easily. We currently not running unit test for this code so need to be a little careful in making changes.
>
> Thanks,
> Justin
Re: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
Much nicer and easier to understand. Thanks for that.
If you want to clean up the code go for it but try and commit in small bits explaining each change so the changes can be reviewed easily. We currently not running unit test for this code so need to be a little careful in making changes.
Thanks,
Justin
RE: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062:
FDB waits up to 20s per SWF before we can start debugging (without code
clean up)
Posted by Frédéric THOMAS <we...@hotmail.com>.
Btw, it has been reverted and re-committed with the fix only !
Frédéric THOMAS
> From: fthomas@apache.org
> To: commits@flex.apache.org
> Date: Mon, 27 Jan 2014 17:23:57 +0000
> Subject: [5/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
>
> FLEX-34062: FDB waits up to 20s per SWF before we can start debugging (without code clean up)
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/59659f7c
> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/59659f7c
> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/59659f7c
>
> Branch: refs/heads/develop
> Commit: 59659f7cc66a20a9450d4a3117a5f999f1fa41c7
> Parents: fb33548
> Author: Frédéric Thomas <ft...@cpaglobal.com>
> Authored: Mon Jan 27 17:17:38 2014 +0000
> Committer: Frédéric Thomas <ft...@cpaglobal.com>
> Committed: Mon Jan 27 17:17:38 2014 +0000
>
> ----------------------------------------------------------------------
> .../java/flex/tools/debugger/cli/DebugCLI.java | 130 -------------------
> .../flex/tools/debugger/cli/Extensions.java | 7 -
> 2 files changed, 137 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/59659f7c/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
> ----------------------------------------------------------------------
> diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java b/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
> index 83b603c..0f29cf3 100644
> --- a/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
> +++ b/modules/debugger/src/java/flex/tools/debugger/cli/DebugCLI.java
> @@ -296,18 +296,6 @@ public class DebugCLI implements Runnable, SourceLocator
> */
> private static final String INFO_STACK_SHOW_THIS = "$infostackshowthis"; //$NON-NLS-1$
>
> - /**
> - * Number of milliseconds to wait for metadata.
> - */
> - private static final String METADATA_ATTEMPTS_PERIOD = "$metadataattemptsperiod"; //$NON-NLS-1$
> -
> - private static final String METADATA_NOT_AVAILABLE = "$metadatanotavailable"; //$NON-NLS-1$
> -
> - /**
> - * How many times we should try to get metadata.
> - */
> - private static final String METADATA_ATTEMPTS = "$metadataattempts"; //$NON-NLS-1$
> -
> private static final String PLAYER_FULL_SUPPORT = "$playerfullsupport"; //$NON-NLS-1$
>
> /**
> @@ -1691,101 +1679,6 @@ public class DebugCLI implements Runnable, SourceLocator
> }
> }
>
> - public void waitForMetaData() throws InProgressException
> - {
> - // perform a query to see if our metadata has loaded
> - int metadatatries = propertyGet(METADATA_ATTEMPTS);
> - int maxPerCall = 8; // cap on how many attempt we make per call
> -
> - int tries = Math.min(maxPerCall, metadatatries);
> - if (tries > 0)
> - {
> - int remain = metadatatries - tries; // assume all get used up
> -
> - // perform the call and then update our remaining number of attempts
> - try
> - {
> - tries = waitForMetaData(tries);
> - remain = metadatatries - tries; // update our used count
> - }
> - catch(InProgressException ipe)
> - {
> - propertyPut(METADATA_ATTEMPTS, remain);
> - throw ipe;
> - }
> - }
> - }
> -
> - /**
> - * Wait for the API to load function names, which
> - * exist in the form of external meta-data.
> - *
> - * Only do this tries times, then give up
> - *
> - * We wait period * attempts
> - */
> - public int waitForMetaData(int attempts) throws InProgressException
> - {
> - int start = attempts;
> - int period = propertyGet(METADATA_ATTEMPTS_PERIOD);
> - while(attempts > 0)
> - {
> - // are we done yet?
> - if (isMetaDataAvailable())
> - break;
> - else
> - try { attempts--; Thread.sleep(period); } catch(InterruptedException ie) {}
> - }
> -
> - // throw exception if still not ready
> - if (!isMetaDataAvailable())
> - throw new InProgressException();
> -
> - return start-attempts; // remaining number of tries
> - }
> -
> - /**
> - * Ask each swf if metadata processing is complete
> - */
> - public boolean isMetaDataAvailable()
> - {
> - boolean allLoaded = true;
> - try
> - {
> - // we need to ask the session since our fileinfocache will hide the exception
> - SwfInfo[] swfs = m_session.getSwfs();
> - for(int i=0; i<swfs.length; i++)
> - {
> - // check if our processing is finished.
> - SwfInfo swf = swfs[i];
> - if (swf != null && !swf.isProcessingComplete())
> - {
> - allLoaded = false;
> - break;
> - }
> - }
> - }
> - catch(NoResponseException nre)
> - {
> - // ok we still need to wait for player to read the swd in
> - allLoaded = false;
> - }
> -
> - // count the number of times we checked and it wasn't there
> - if (!allLoaded)
> - {
> - int count = propertyGet(METADATA_NOT_AVAILABLE);
> - count++;
> - propertyPut(METADATA_NOT_AVAILABLE, count);
> - }
> - else
> - {
> - // success so we reset our attempt counter
> - propertyPut(METADATA_ATTEMPTS, METADATA_RETRIES);
> - }
> - return allLoaded;
> - }
> -
> void doInfoHandle()
> {
> if (hasMoreTokens())
> @@ -1825,9 +1718,6 @@ public class DebugCLI implements Runnable, SourceLocator
> // we take an optional single arg which specifies a module
> try
> {
> - // let's wait a bit for the background load to complete
> - waitForMetaData();
> -
> if (hasMoreTokens())
> {
> arg = nextToken();
> @@ -1869,10 +1759,6 @@ public class DebugCLI implements Runnable, SourceLocator
> {
> err(ae.getMessage());
> }
> - catch(InProgressException ipe)
> - {
> - err(getLocalizationManager().getLocalizedTextString("functionListBeingPrepared")); //$NON-NLS-1$
> - }
> }
>
> void listFunctionsFor(StringBuilder sb, SourceFile m)
> @@ -2218,10 +2104,6 @@ public class DebugCLI implements Runnable, SourceLocator
> // then see if it because of a swfloaded event
> if( reason == SuspendReason.ScriptLoaded)
> {
> - // since the player takes a long time to provide swf/swd, try 80 * 250ms = ~20s
> - if (propertyGet(METADATA_ATTEMPTS) > 0)
> - try { waitForMetaData(80); } catch(InProgressException ipe) { }
> -
> m_fileInfo.setDirty();
> processEvents();
> propagateBreakpoints();
> @@ -4186,8 +4068,6 @@ public class DebugCLI implements Runnable, SourceLocator
> */
> private int[] parseFunctionName(int module, String partialFunctionName, boolean onlyThisModule) throws NoMatchException, AmbiguousException
> {
> - try { waitForMetaData(); } catch(InProgressException ipe) {} // wait a bit before we try this to give the background thread time to complete
> -
> SourceFile m = m_fileInfo.getFile(module);
> ArrayList<ModuleFunctionPair> functionNames = new ArrayList<ModuleFunctionPair>(); // each member is a ModuleFunctionPair
>
> @@ -4692,9 +4572,6 @@ public class DebugCLI implements Runnable, SourceLocator
> // pause for a while during startup, don't let exceptions ripple outwards
> try { waitTilHalted(); } catch(Exception e) {}
>
> - // pause for a while during startup, don't let exceptions ripple outwards
> - try { waitForMetaData(); } catch(Exception e) {}
> -
> setInitialSourceFile();
>
> out(getLocalizationManager().getLocalizedTextString("setBreakpointsThenResume")); //$NON-NLS-1$
> @@ -6484,9 +6361,6 @@ public class DebugCLI implements Runnable, SourceLocator
> propertyPut(LAST_FRAME_DEPTH, 0);
> propertyPut(CURRENT_FRAME_DEPTH, 0);
> propertyPut(DISPLAY_FRAME_NUMBER, 0);
> - propertyPut(METADATA_ATTEMPTS_PERIOD, 250); // 1/4s per attempt
> - propertyPut(METADATA_NOT_AVAILABLE, 0); // counter for failures
> - propertyPut(METADATA_ATTEMPTS, METADATA_RETRIES);
> propertyPut(PLAYER_FULL_SUPPORT, correctVersion ? 1 : 0);
>
> String previousURI = m_mruURI;
> @@ -6513,10 +6387,6 @@ public class DebugCLI implements Runnable, SourceLocator
> */
> void reapplyBreakpoints()
> {
> - // give us a bit of time to process the newly loaded swf
> - if (propertyGet(METADATA_ATTEMPTS) > 0)
> - try { waitForMetaData(80); } catch(InProgressException ipe) { }
> -
> int count = breakpointCount();
> for(int i=0; i<count; i++)
> {
>
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/59659f7c/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
> ----------------------------------------------------------------------
> diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java b/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
> index aeedd72..0332100 100644
> --- a/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
> +++ b/modules/debugger/src/java/flex/tools/debugger/cli/Extensions.java
> @@ -116,9 +116,6 @@ public class Extensions
> // we take an optional single arg which specifies a module
> try
> {
> - // let's wait a bit for the background load to complete
> - cli.waitForMetaData();
> -
> if (cli.hasMoreTokens())
> {
> arg = cli.nextToken();
> @@ -160,10 +157,6 @@ public class Extensions
> {
> cli.err(nme.getMessage());
> }
> - catch(InProgressException ipe)
> - {
> - cli.err(getLocalizationManager().getLocalizedTextString("key20")); //$NON-NLS-1$
> - }
> }
>
> /**
>