Closed Bug 773667 Opened 12 years ago Closed 12 years ago

Code clean up in ScreenshotLayer

Categories

(Firefox for Android Graveyard :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 17

People

(Reporter: gbrown, Assigned: gbrown)

Details

Attachments

(1 file, 2 obsolete files)

There is some suspected-dead-code in ScreenshotLayer referencing createBitmap -- we should remove that if possible.
One call to createBitmap remains -- it is definitely called.

This passes try: https://tbpl.mozilla.org/?tree=Try&rev=362ee3458cfc
Attachment #642562 - Flags: review?(blassey.bugs)
Comment on attachment 642562 [details] [diff] [review]
remove unused code in ScreenshotLayer

Review of attachment 642562 [details] [diff] [review]:
-----------------------------------------------------------------

clearing the review for these questions. Please re-request when you answer.

::: mobile/android/base/gfx/ScreenshotLayer.java
@@ +52,5 @@
>              mBufferSize = mImageSize;
>              mHasImage = true;
>              mImage.setBitmap(data, width, height, CairoImage.FORMAT_RGB16_565, rect);
>          } else {
> +            throw new RuntimeException("unexpected size in setBitmap: w="+width+" h="+height);

where is this caught? I don't want to crash due to this.

@@ +148,5 @@
>              mFormat = format;
>              if (width == bitmap.getWidth() && height == bitmap.getHeight()) {
>                  tmp = bitmap;
>              } else {
> +                throw new RuntimeException("unexpected size in setBitmap: w="+width+" h="+height);

same question here
Attachment #642562 - Flags: review?(blassey.bugs)
The exceptions in the previous patch were uncaught; in this patch, we log an error instead.
Attachment #642562 - Attachment is obsolete: true
Attachment #644813 - Flags: review?(blassey.bugs)
Comment on attachment 644813 [details] [diff] [review]
remove unused code in ScreenshotLayer

Review of attachment 644813 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/base/gfx/ScreenshotLayer.java
@@ +42,5 @@
>              mBufferSize = mImageSize;
>              mHasImage = true;
>              mImage.setBitmap(data, width, height, CairoImage.FORMAT_RGB16_565, rect);
>          } else {
> +            Log.e(LOGTAG, "### unexpected size in setBitmap: w="+width+" h="+height);

I'd still like to throw here, I'd just like it to be declared and caught so we get a stack and still don't crash.

@@ +142,2 @@
>              } else {
> +                Log.e(LOGTAG, "### unexpected size in setBitmap: w="+width+" h="+height);

same. Sorry if this wasn't clear before.
Attachment #644813 - Flags: review?(blassey.bugs) → review-
Like this? I've gone back to throwing exceptions and added try/catch/Log to handle them.
Attachment #644813 - Attachment is obsolete: true
Attachment #644963 - Flags: review?(blassey.bugs)
Attachment #644963 - Flags: review?(blassey.bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/4fb440488598
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: