зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703057 - Put DrawToFile on another thread. r=blassey
--HG-- extra : rebase_source : f90ae83248da6b270baf8abbb873bdb89977d8fc
This commit is contained in:
Родитель
d08ef8f92c
Коммит
11ddf4e262
|
@ -510,6 +510,14 @@ abstract public class GeckoApp
|
|||
String uri = lastHistoryEntry.mUri;
|
||||
String title = lastHistoryEntry.mTitle;
|
||||
|
||||
String lastUri = prefs.getString("last-uri", "");
|
||||
String lastTitle = prefs.getString("last-title", uri);
|
||||
|
||||
|
||||
// see if we can bail.
|
||||
if (uri.equals(lastUri) && title.equals(lastTitle))
|
||||
return;
|
||||
|
||||
editor.putString("last-uri", uri);
|
||||
editor.putString("last-title", title);
|
||||
|
||||
|
@ -1273,7 +1281,13 @@ abstract public class GeckoApp
|
|||
public void onPause()
|
||||
{
|
||||
Log.i(LOG_NAME, "pause");
|
||||
rememberLastScreen(false);
|
||||
|
||||
// Remember the last screen.
|
||||
mMainHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
rememberLastScreen(false);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
|
||||
// The user is navigating away from this activity, but nothing
|
||||
|
|
|
@ -796,6 +796,22 @@ nsWindow::GetThebesSurface()
|
|||
return new gfxImageSurface(gfxIntSize(5,5), gfxImageSurface::ImageFormatRGB24);
|
||||
}
|
||||
|
||||
|
||||
class DrawToFileRunnable : public nsRunnable {
|
||||
public:
|
||||
DrawToFileRunnable(nsWindow* win, const nsAString &path) {
|
||||
mPath = path;
|
||||
mWindow = win;
|
||||
}
|
||||
NS_IMETHOD Run() {
|
||||
mWindow->DrawToFile(mPath);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
nsString mPath;
|
||||
nsRefPtr<nsWindow> mWindow;
|
||||
};
|
||||
|
||||
bool
|
||||
nsWindow::DrawToFile(const nsAString &path)
|
||||
{
|
||||
|
@ -1009,7 +1025,11 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
break;
|
||||
|
||||
case AndroidGeckoEvent::SAVE_STATE:
|
||||
win->DrawToFile(ae->Characters());
|
||||
{
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsRefPtr<DrawToFileRunnable> runnable = new DrawToFileRunnable(win, ae->Characters());
|
||||
NS_NewThread(getter_AddRefs(thread), runnable);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -176,12 +176,13 @@ public:
|
|||
static bool sAccessibilityEnabled;
|
||||
#endif
|
||||
|
||||
bool DrawToFile(const nsAString &path);
|
||||
|
||||
protected:
|
||||
void BringToFront();
|
||||
nsWindow *FindTopLevel();
|
||||
bool DrawTo(gfxASurface *targetSurface);
|
||||
bool DrawTo(gfxASurface *targetSurface, const nsIntRect &aRect);
|
||||
bool DrawToFile(const nsAString &path);
|
||||
bool IsTopLevel();
|
||||
void OnIMEAddRange(mozilla::AndroidGeckoEvent *ae);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче