Bug 1018980 - Kill some dead code in Fennec from the pre-OMTC days. r=snorp

This commit is contained in:
Kartikaya Gupta 2014-06-02 11:13:09 -04:00
parent 0e8a8273de
commit 856aab1218
7 changed files with 2 additions and 144 deletions

View File

@ -82,7 +82,6 @@ public class GeckoEvent {
SENSOR_EVENT(3),
LOCATION_EVENT(5),
IME_EVENT(6),
DRAW(7),
SIZE_CHANGED(8),
APP_BACKGROUNDING(9),
APP_FOREGROUNDING(10),
@ -659,12 +658,6 @@ public class GeckoEvent {
return event;
}
public static GeckoEvent createDrawEvent(Rect rect) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.DRAW);
event.mRect = rect;
return event;
}
public static GeckoEvent createSizeChangedEvent(int w, int h, int screenw, int screenh) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.SIZE_CHANGED);
event.mPoints = new Point[2];

View File

@ -489,10 +489,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
}
break;
case DRAW:
ReadRectField(jenv);
break;
case SENSOR_EVENT:
mX = jenv->GetDoubleField(jobj, jXField);
mY = jenv->GetDoubleField(jobj, jYField);

View File

@ -453,13 +453,6 @@ public:
return event;
}
static AndroidGeckoEvent* MakeDrawEvent(const nsIntRect& aRect) {
AndroidGeckoEvent *event = new AndroidGeckoEvent();
event->Init(DRAW);
event->mRect = aRect;
return event;
}
static AndroidGeckoEvent* MakeFromJavaObject(JNIEnv *jenv, jobject jobj) {
AndroidGeckoEvent *event = new AndroidGeckoEvent();
event->Init(jenv, jobj);
@ -682,7 +675,6 @@ public:
SENSOR_EVENT = 3,
LOCATION_EVENT = 5,
IME_EVENT = 6,
DRAW = 7,
SIZE_CHANGED = 8,
APP_BACKGROUNDING = 9,
APP_FOREGROUNDING = 10,

View File

@ -127,9 +127,7 @@ nsAppShell::nsAppShell()
: mQueueLock("nsAppShell.mQueueLock"),
mCondLock("nsAppShell.mCondLock"),
mQueueCond(mCondLock, "nsAppShell.mQueueCond"),
mQueuedDrawEvent(nullptr),
mQueuedViewportEvent(nullptr),
mAllowCoalescingNextDraw(false)
mQueuedViewportEvent(nullptr)
{
gAppShell = this;
@ -673,9 +671,7 @@ nsAppShell::PopNextEvent()
if (mEventQueue.Length()) {
ae = mEventQueue[0];
mEventQueue.RemoveElementAt(0);
if (mQueuedDrawEvent == ae) {
mQueuedDrawEvent = nullptr;
} else if (mQueuedViewportEvent == ae) {
if (mQueuedViewportEvent == ae) {
mQueuedViewportEvent = nullptr;
}
}
@ -724,50 +720,6 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
}
break;
case AndroidGeckoEvent::DRAW:
if (mQueuedDrawEvent) {
#if defined(DEBUG) || defined(FORCE_ALOG)
// coalesce this new draw event with the one already in the queue
const nsIntRect& oldRect = mQueuedDrawEvent->Rect();
const nsIntRect& newRect = ae->Rect();
nsIntRect combinedRect = oldRect.Union(newRect);
// XXX We may want to consider using regions instead of rectangles.
// Print an error if we're upload a lot more than we would
// if we handled this as two separate events.
int combinedArea = (oldRect.width * oldRect.height) +
(newRect.width * newRect.height);
int boundsArea = combinedRect.width * combinedRect.height;
if (boundsArea > combinedArea * 8)
ALOG("nsAppShell: Area of bounds greatly exceeds combined area: %d > %d",
boundsArea, combinedArea);
#endif
// coalesce into the new draw event rather than the queued one because
// it is not always safe to move draws earlier in the queue; there may
// be events between the two draws that affect scroll position or something.
ae->UnionRect(mQueuedDrawEvent->Rect());
EVLOG("nsAppShell: Coalescing previous DRAW event at %p into new DRAW event %p", mQueuedDrawEvent, ae);
mEventQueue.RemoveElement(mQueuedDrawEvent);
delete mQueuedDrawEvent;
}
if (!mAllowCoalescingNextDraw) {
// if we're not allowing coalescing of this draw event, then
// don't set mQueuedDrawEvent to point to this; that way the
// next draw event that comes in won't kill this one.
mAllowCoalescingNextDraw = true;
mQueuedDrawEvent = nullptr;
} else {
mQueuedDrawEvent = ae;
}
allowCoalescingNextViewport = true;
mEventQueue.AppendElement(ae);
break;
case AndroidGeckoEvent::VIEWPORT:
if (mQueuedViewportEvent) {
// drop the previous viewport event now that we have a new one
@ -776,9 +728,6 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
delete mQueuedViewportEvent;
}
mQueuedViewportEvent = ae;
// temporarily turn off draw-coalescing, so that we process a draw
// event as soon as possible after a viewport change
mAllowCoalescingNextDraw = false;
allowCoalescingNextViewport = true;
mEventQueue.AppendElement(ae);

View File

@ -64,9 +64,7 @@ protected:
Mutex mQueueLock;
Mutex mCondLock;
CondVar mQueueCond;
mozilla::AndroidGeckoEvent *mQueuedDrawEvent;
mozilla::AndroidGeckoEvent *mQueuedViewportEvent;
bool mAllowCoalescingNextDraw;
bool mAllowCoalescingTouches;
nsTArray<mozilla::AndroidGeckoEvent *> mEventQueue;
nsInterfaceHashtable<nsStringHashKey, nsIObserver> mObserversHash;

View File

@ -539,8 +539,6 @@ nsWindow::IsEnabled() const
NS_IMETHODIMP
nsWindow::Invalidate(const nsIntRect &aRect)
{
AndroidGeckoEvent *event = AndroidGeckoEvent::MakeDrawEvent(aRect);
nsAppShell::gAppShell->PostEvent(event);
return NS_OK;
}
@ -882,12 +880,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
win->mFocus->OnKeyEvent(ae);
break;
case AndroidGeckoEvent::DRAW:
layers::renderTraceEventStart("Global draw start", "414141");
win->OnDraw(ae);
layers::renderTraceEventEnd("414141");
break;
case AndroidGeckoEvent::IME_EVENT:
win->UserActivity();
if (win->mFocus) {
@ -937,20 +929,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
}
void
nsWindow::OnAndroidEvent(AndroidGeckoEvent *ae)
{
switch (ae->Type()) {
case AndroidGeckoEvent::DRAW:
OnDraw(ae);
break;
default:
ALOG("Window got targetted android event type %d, but didn't handle!", ae->Type());
break;
}
}
bool
nsWindow::DrawTo(gfxASurface *targetSurface)
{
@ -1044,52 +1022,6 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
return true;
}
void
nsWindow::OnDraw(AndroidGeckoEvent *ae)
{
if (!IsTopLevel()) {
ALOG("##### redraw for window %p, which is not a toplevel window -- sending to toplevel!", (void*) this);
DumpWindows();
return;
}
if (!mIsVisible) {
ALOG("##### redraw for window %p, which is not visible -- ignoring!", (void*) this);
DumpWindows();
return;
}
nsRefPtr<nsWindow> kungFuDeathGrip(this);
AutoLocalJNIFrame jniFrame;
// We're paused, or we haven't been given a window-size yet, so do nothing
if (sCompositorPaused || gAndroidBounds.width <= 0 || gAndroidBounds.height <= 0) {
return;
}
int bytesPerPixel = 2;
gfxImageFormat format = gfxImageFormat::RGB16_565;
if (AndroidBridge::Bridge()->GetScreenDepth() == 24) {
bytesPerPixel = 4;
format = gfxImageFormat::RGB24;
}
layers::renderTraceEventStart("Get surface", "424545");
static unsigned char bits2[32 * 32 * 4];
nsRefPtr<gfxImageSurface> targetSurface =
new gfxImageSurface(bits2, gfxIntSize(32, 32), 32 * bytesPerPixel, format);
layers::renderTraceEventEnd("Get surface", "424545");
layers::renderTraceEventStart("Widget draw to", "434646");
if (targetSurface->CairoStatus()) {
ALOG("### Failed to create a valid surface from the bitmap");
} else {
DrawTo(targetSurface, ae->Rect());
}
layers::renderTraceEventEnd("Widget draw to", "434646");
}
void
nsWindow::OnSizeChanged(const gfxIntSize& aSize)
{

View File

@ -48,8 +48,6 @@ public:
nsWindow* FindWindowForPoint(const nsIntPoint& pt);
void OnAndroidEvent(mozilla::AndroidGeckoEvent *ae);
void OnDraw(mozilla::AndroidGeckoEvent *ae);
bool OnMultitouchEvent(mozilla::AndroidGeckoEvent *ae);
void OnNativeGestureEvent(mozilla::AndroidGeckoEvent *ae);
void OnMouseEvent(mozilla::AndroidGeckoEvent *ae);