[snackr] r132 committed - Added code in various places to dispose XML objects as soon as we're d...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jun 6, 2010, 2:15:06 AM6/6/10
to snackr-...@googlegroups.com
Revision: 132
Author: nopqrs
Date: Sat Jun 5 23:14:47 2010
Log: Added code in various places to dispose XML objects as soon as we're
done with them (using an API added in AIR 1.5.3--this required bumping the
app.xml namespace version again). Hoping this will fix the intermittent
reports we've gotten of Snackr using huge amounts of memory when Google
Reader integration is turned on.

Made it so we accept feed:// URLs.

Fixed the font in the detail popup so it's not huge (this seems to have
been introduced with the Flex 3.5 upgrade, or perhaps is due to newer AIR
runtimes with different WebKit versions).
http://code.google.com/p/snackr/source/detail?r=132

Modified:
/trunk/Snackr/src/QueryGoogleReader.mxml
/trunk/Snackr/src/Snackr-app.xml
/trunk/Snackr/src/model/feeds/Feed.as
/trunk/Snackr/src/model/feeds/FeedModel.as
/trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as
/trunk/Snackr/src/ui/popups/DetailPopup.mxml

=======================================
--- /trunk/Snackr/src/QueryGoogleReader.mxml Fri Jul 4 12:31:20 2008
+++ /trunk/Snackr/src/QueryGoogleReader.mxml Sat Jun 5 23:14:47 2010
@@ -107,6 +107,7 @@
if(newContinuationToken != null && newContinuationToken != "") {
getItemsHelper(feedURL, newContinuationToken, iteration + 1);
}
+ System.disposeXML(resultXML);
});
getFeedItemsConnection.addEventListener(IOErrorEvent.IO_ERROR,
function handleGetFeedsFault(event:IOErrorEvent):void {
Logger.instance.log("Fetch failed: " + event);
=======================================
--- /trunk/Snackr/src/Snackr-app.xml Sat Jun 5 11:57:49 2010
+++ /trunk/Snackr/src/Snackr-app.xml Sat Jun 5 23:14:47 2010
@@ -28,7 +28,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

-<application xmlns="http://ns.adobe.com/air/application/1.5">
+<application xmlns="http://ns.adobe.com/air/application/1.5.3">

<!-- Adobe AIR Application Descriptor File Template.

=======================================
--- /trunk/Snackr/src/model/feeds/Feed.as Mon Aug 18 23:53:53 2008
+++ /trunk/Snackr/src/model/feeds/Feed.as Sat Jun 5 23:14:47 2010
@@ -42,6 +42,7 @@
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
+ import flash.system.System;
import flash.utils.ByteArray;

import model.logger.Logger;
@@ -530,6 +531,8 @@
// Commit all the batched changes into the database.
_sqlConnection.commit();
dispatchEvent(new FeedEvent(FeedEvent.FETCHED, this));
+
+ System.disposeXML(result);
}
}

=======================================
--- /trunk/Snackr/src/model/feeds/FeedModel.as Sat Jun 5 14:20:58 2010
+++ /trunk/Snackr/src/model/feeds/FeedModel.as Sat Jun 5 23:14:47 2010
@@ -419,6 +419,7 @@
* @param url The feed or website URL to add.
*/
public function addOrDiscoverNewFeed(url: String): void {
+ url = url.replace("feed://", "http://");
var service: HTTPService = new HTTPService();
service.url = url;
service.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
=======================================
--- /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Fri
Jun 4 16:40:24 2010
+++ /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Sat
Jun 5 23:14:47 2010
@@ -36,6 +36,7 @@
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLVariables;
+ import flash.system.System;

import model.feeds.FeedItemDescriptor;
import model.feeds.FeedModel;
@@ -183,7 +184,9 @@
getFeedsRequest.requestHeaders = getAuthenticationHeaders();
var getFeedsConnection:URLLoader = new URLLoader();
getFeedsConnection.addEventListener(Event.COMPLETE, function
handleGetFeedsResult(event:Event):void {
- callback(processGetFeedsResult(XML(event.target.data)));
+ var resultXML: XML = XML(event.target.data);
+ callback(processGetFeedsResult(resultXML));
+ System.disposeXML(resultXML);
});
getFeedsConnection.addEventListener(IOErrorEvent.IO_ERROR, function
handleGetFeedsFault(event:IOErrorEvent):void {
Logger.instance.log("GoogleReaderSynchronizer: getFeeds() failed: " +
event.text, Logger.SEVERITY_NORMAL);
@@ -319,6 +322,7 @@
itemList[i].feedURL = feedURL.replace(/^feed\//, "");
i++;
}
+ System.disposeXML(resultXML);
return new ArrayCollection(itemList);
}

=======================================
--- /trunk/Snackr/src/ui/popups/DetailPopup.mxml Sun Sep 7 11:59:16 2008
+++ /trunk/Snackr/src/ui/popups/DetailPopup.mxml Sat Jun 5 23:14:47 2010
@@ -137,7 +137,7 @@
}
}
else {
- html.htmlText = '<html><head><meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"/><body>' + _data.description
+ '</body></html>';
+ html.htmlText = '<html><head><meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"/><style type="text/css">body {
font-size: small; }</style><body>' + _data.description + '</body></html>';
}
}

Reply all
Reply to author
Forward
0 new messages