mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-13 15:34:01 +00:00
Backed out 3 changesets (bug 1075644) for Android build bustage on a CLOSED TREE
Backed out changeset c44f001ea6c1 (bug 1075644) Backed out changeset ca0dfff936c2 (bug 1075644) Backed out changeset 47264e561dce (bug 1075644)
This commit is contained in:
parent
184cfae5bf
commit
58a0711ba5
@ -1190,6 +1190,8 @@ public abstract class GeckoApp
|
||||
Class.forName("android.os.AsyncTask");
|
||||
} catch (ClassNotFoundException e) {}
|
||||
|
||||
MemoryMonitor.getInstance().init(getApplicationContext());
|
||||
|
||||
// GeckoAppShell is tightly coupled to us, rather than
|
||||
// the app context, because various parts of Fennec (e.g.,
|
||||
// GeckoScreenOrientation) use GAS to access the Activity in
|
||||
@ -1199,6 +1201,13 @@ public abstract class GeckoApp
|
||||
GeckoAppShell.setContextGetter(this);
|
||||
GeckoAppShell.setGeckoInterface(this);
|
||||
|
||||
Tabs.getInstance().attachToContext(this);
|
||||
try {
|
||||
Favicons.initializeWithContext(this);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Exception starting favicon cache. Corrupt resources?", e);
|
||||
}
|
||||
|
||||
// Did the OS locale change while we were backgrounded? If so,
|
||||
// we need to die so that Gecko will re-init add-ons that touch
|
||||
// the UI.
|
||||
@ -1245,20 +1254,6 @@ public abstract class GeckoApp
|
||||
}, 1000 * 5 /* 5 seconds */);
|
||||
}
|
||||
|
||||
// Heavy load on the Gecko thread can slow down the time it takes for UI to appear on
|
||||
// single-core devices. By minimizing the Gecko thread priority, we ensure that the UI
|
||||
// appears quickly. The priority is reset to normal once thumbnails are loaded.
|
||||
ThreadUtils.reduceGeckoPriority();
|
||||
|
||||
MemoryMonitor.getInstance().init(getApplicationContext());
|
||||
|
||||
Tabs.getInstance().attachToContext(this);
|
||||
try {
|
||||
Favicons.initializeWithContext(this);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Exception starting favicon cache. Corrupt resources?", e);
|
||||
}
|
||||
|
||||
Bundle stateBundle = getIntent().getBundleExtra(EXTRA_STATE_BUNDLE);
|
||||
if (stateBundle != null) {
|
||||
// Use the state bundle if it was given as an intent extra. This is
|
||||
@ -1635,10 +1630,6 @@ public abstract class GeckoApp
|
||||
} else if (NotificationHelper.HELPER_BROADCAST_ACTION.equals(action)) {
|
||||
NotificationHelper.getInstance(getApplicationContext()).handleNotificationIntent(intent);
|
||||
}
|
||||
|
||||
// Reset Gecko to normal priority. We may reduce the
|
||||
// priority again later, e.g. for loading thumbnails.
|
||||
ThreadUtils.resetGeckoPriority();
|
||||
}
|
||||
|
||||
private String restoreSessionTabs(final boolean isExternalURL) throws SessionRestoreException {
|
||||
|
@ -51,7 +51,6 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
if (isCreated())
|
||||
return false;
|
||||
sGeckoThread = new GeckoThread(sArgs, sAction, sUri);
|
||||
ThreadUtils.sGeckoThread = sGeckoThread;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -165,6 +164,7 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
@Override
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
ThreadUtils.sGeckoThread = this;
|
||||
ThreadUtils.sGeckoHandler = new Handler();
|
||||
ThreadUtils.sGeckoQueue = Looper.myQueue();
|
||||
|
||||
|
@ -98,6 +98,9 @@ public class TopSitesPanel extends HomeFragment {
|
||||
// Max number of entries shown in the grid from the cursor.
|
||||
private int mMaxGridEntries;
|
||||
|
||||
// Time in ms until the Gecko thread is reset to normal priority.
|
||||
private static final long PRIORITY_RESET_TIMEOUT = 10000;
|
||||
|
||||
public static TopSitesPanel newInstance() {
|
||||
return new TopSitesPanel();
|
||||
}
|
||||
@ -344,7 +347,7 @@ public class TopSitesPanel extends HomeFragment {
|
||||
// appear, especially during startup (bug 897162). By minimizing the
|
||||
// Gecko thread priority, we ensure that the UI appears quickly. The
|
||||
// priority is reset to normal once thumbnails are loaded.
|
||||
ThreadUtils.reduceGeckoPriority();
|
||||
ThreadUtils.reduceGeckoPriority(PRIORITY_RESET_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,8 +14,8 @@ public class testLinkContextMenu extends ContentContextMenuTest {
|
||||
|
||||
LINK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BIG_LINK_URL);
|
||||
BLANK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
|
||||
loadAndPaint(LINK_PAGE_URL);
|
||||
verifyPageTitle(LINK_PAGE_TITLE);
|
||||
inputAndLoadUrl(LINK_PAGE_URL);
|
||||
waitForText(LINK_PAGE_TITLE);
|
||||
|
||||
verifyContextMenuItems(linkMenuItems); // Verify context menu items are correct
|
||||
openTabFromContextMenu(linkMenuItems[0],2); // Test the "Open in New Tab" option - expecting 2 tabs: the original and the new one
|
||||
|
@ -12,8 +12,8 @@ public class testMailToContextMenu extends ContentContextMenuTest {
|
||||
blockForGeckoReady();
|
||||
|
||||
MAILTO_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BIG_MAILTO_URL);
|
||||
loadAndPaint(MAILTO_PAGE_URL);
|
||||
verifyPageTitle(MAILTO_PAGE_TITLE);
|
||||
inputAndLoadUrl(MAILTO_PAGE_URL);
|
||||
waitForText(MAILTO_PAGE_TITLE);
|
||||
|
||||
verifyContextMenuItems(mailtoMenuItems);
|
||||
verifyCopyOption(mailtoMenuItems[0], "foo.bar@example.com"); // Test the "Copy Email Address" option
|
||||
|
@ -17,9 +17,6 @@ import android.util.Log;
|
||||
public final class ThreadUtils {
|
||||
private static final String LOGTAG = "ThreadUtils";
|
||||
|
||||
// Time in ms until the Gecko thread is reset to normal priority.
|
||||
private static final long PRIORITY_RESET_TIMEOUT = 10000;
|
||||
|
||||
/**
|
||||
* Controls the action taken when a method like
|
||||
* {@link ThreadUtils#assertOnUiThread(AssertBehavior)} detects a problem.
|
||||
@ -212,8 +209,10 @@ public final class ThreadUtils {
|
||||
*
|
||||
* Note that there are no guards in place to prevent multiple calls
|
||||
* to this method from conflicting with each other.
|
||||
*
|
||||
* @param timeout Timeout in ms after which the priority will be reset
|
||||
*/
|
||||
public static void reduceGeckoPriority() {
|
||||
public static void reduceGeckoPriority(long timeout) {
|
||||
if (Runtime.getRuntime().availableProcessors() > 1) {
|
||||
// Don't reduce priority for multicore devices. We use availableProcessors()
|
||||
// for its fast performance. It may give false negatives (i.e. multicore
|
||||
@ -223,7 +222,7 @@ public final class ThreadUtils {
|
||||
if (!sIsGeckoPriorityReduced && sGeckoThread != null) {
|
||||
sIsGeckoPriorityReduced = true;
|
||||
sGeckoThread.setPriority(Thread.MIN_PRIORITY);
|
||||
getUiHandler().postDelayed(sPriorityResetRunnable, PRIORITY_RESET_TIMEOUT);
|
||||
getUiHandler().postDelayed(sPriorityResetRunnable, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user