Closed
Bug 779366
Opened 12 years ago
Closed 12 years ago
Create org.mozilla.gecko.gfx package
Categories
(Firefox for Android Graveyard :: General, defect, P2)
Tracking
(firefox16 wontfix)
RESOLVED
FIXED
Firefox 17
Tracking | Status | |
---|---|---|
firefox16 | --- | wontfix |
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(4 files, 1 obsolete file)
14.08 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
22.18 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
6.35 KB,
patch
|
sriram
:
review+
|
Details | Diff | Splinter Review |
7.35 KB,
patch
|
sriram
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•12 years ago
|
||
Part 1: Move FloatUtils to new org.mozilla.gecko.util package.
Attachment #647781 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 2•12 years ago
|
||
Part 2: Move DisplayMetrics to new org.mozilla.gecko.util.ConfigurationUtils class.
Attachment #647783 -
Flags: review?(sriram)
Assignee | ||
Comment 3•12 years ago
|
||
Part 3: Move direct buffer allocation to new org.mozilla.gecko.util.DirectBufferAllocator class.
Attachment #647785 -
Flags: review?(bugmail.mozilla)
Comment 4•12 years ago
|
||
Comment on attachment 647781 [details] [diff] [review] part-1-FloatUtils.patch Review of attachment 647781 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/base/Makefile.in @@ +16,5 @@ > > include $(topsrcdir)/mobile/android/base/android-sync-files.mk > > +UTIL_JAVA_FILES := \ > + FloatUtils.java The makefiles I've looked at have a convention of ending a list of files with $(NULL), maybe want to do that here too? @@ +25,5 @@ > CustomEditText.java \ > INIParser.java \ > INISection.java \ > + JarUtils.java \ > + $(UTIL_JAVA_FILES) Ditto.
Attachment #647781 -
Flags: review?(bugmail.mozilla) → review+
Comment 5•12 years ago
|
||
Comment on attachment 647785 [details] [diff] [review] create-DirectBufferAllocator.patch Review of attachment 647785 [details] [diff] [review]: ----------------------------------------------------------------- Awesome! ::: mobile/android/base/DirectBufferAllocator.java @@ +13,5 @@ > +// https://code.google.com/p/android/issues/detail?id=16941 > +// > + > +public final class DirectBufferAllocator { > + DirectBufferAllocator() {} Make this private? ::: mobile/android/base/Tab.java @@ +142,5 @@ > synchronized public ByteBuffer getThumbnailBuffer() { > int capacity = getThumbnailWidth() * getThumbnailHeight() * 2 /* 16 bpp */; > if (mThumbnailBuffer != null && mThumbnailBuffer.capacity() == capacity) > return mThumbnailBuffer; > + // not calling this.freeBuffer() because it would deadlock This should not actually deadlock, so if you want to rearrange this code to call freeBuffer go ahead. I made a note that the comment was incorrect when I reviewed that code originally (https://bugzilla.mozilla.org/show_bug.cgi?id=755070#c31) but I guess brad didn't update it. @@ +164,1 @@ > mThumbnailBuffer = null; One thing I like to do with my "free" functions is have it return null. That way you can do "mThumbnailBuffer = DirectBufferAllocator.free(mThumbnailBuffer)" and avoid accidentally leaving a dangling pointer to a freed buffer. Some people don't like that idiom but I'd putting it here for consideration. ::: mobile/android/base/gfx/CheckerboardImage.java @@ +113,5 @@ > @Override > protected void finalize() throws Throwable { > try { > + DirectBufferAllocator.free(mBuffer); > + mBuffer = null; Just FYI, I filed bug 779511 to move this code out of finalize()
Attachment #647785 -
Flags: review?(bugmail.mozilla) → review+
Comment 6•12 years ago
|
||
I had made a bunch of edits that doesn't need GeckoApp.mAppContext to get the displaymetrics. Is this applying on top of it?
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Sriram Ramasubramanian [:sriram] from comment #6) > I had made a bunch of edits that doesn't need GeckoApp.mAppContext to get > the displaymetrics. Is this applying on top of it? Sriram, 1. Which bug or changeset was that? My patches apply cleanly on mozilla-central. The primary motivation is to remove references from gfx classes to GeckoAppShell. 2. Is the name `ConfigurationUtils` OK? I considered `DisplayUtils` because this class is only used for DisplayMetrics, at the moment. But I thought ConfigurationUtils might be a good home for other utility functions.
Assignee | ||
Comment 8•12 years ago
|
||
kats, I have implemented your suggestions in my local patches: 1. Added $(NULL) to Makefile. 2. Made DirectBufferAllocator ctor private. 3. Removed incorrect comment about deadlock and call freeBuffer(). 4. Returned null from DirectBufferAllocator.free(). I think this is a little too clever/indirect and makes for longer lines of code, but there is no harm in allowing other people to use this idiom. :)
Assignee | ||
Comment 9•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/fdd559da59cf https://hg.mozilla.org/integration/mozilla-inbound/rev/bcb8b2b5a310 https://hg.mozilla.org/integration/mozilla-inbound/rev/4888b8395089
Whiteboard: [leave open]
Comment 10•12 years ago
|
||
Comment on attachment 647783 [details] [diff] [review] part-2-create-ConfigurationUtils.patch Review of attachment 647783 [details] [diff] [review]: ----------------------------------------------------------------- I feel that context.getResources().getDisplayMetrics() can do the job. Resources is closed to tied to the display and it always has an updated copy of DisplayMetrics. Sorry :(
Attachment #647783 -
Flags: review?(sriram) → review-
Assignee | ||
Comment 11•12 years ago
|
||
I accidentally landed Part 2 before Sriram r+'d the patch. Backing out: https://hg.mozilla.org/integration/mozilla-inbound/rev/aa61e5ec5612
Assignee | ||
Comment 12•12 years ago
|
||
Part 2b: Remove ViewportMetrics' dependency on GeckoApp by passing DisplayMetrics parameter.
Attachment #647783 -
Attachment is obsolete: true
Attachment #648106 -
Flags: review?(sriram)
Assignee | ||
Comment 13•12 years ago
|
||
Part 2c: Query Resources for DisplayMetrics, not the WindowManager.
Attachment #648107 -
Flags: review?(sriram)
Comment 14•12 years ago
|
||
Comment on attachment 648106 [details] [diff] [review] part-2b-pass-DisplayMetrics.patch Review of attachment 648106 [details] [diff] [review]: ----------------------------------------------------------------- I like this change of killing one more GeckoApp.mAppContext! yaaay!! How about passing a context to ViewportMetrics() and let it deal with it, instead of spoon feeding it with DisplayMetrics?
Attachment #648106 -
Flags: review?(sriram) → review+
Comment 15•12 years ago
|
||
Comment on attachment 648107 [details] [diff] [review] part-2c-getResources-getDisplayMetrics.patch Review of attachment 648107 [details] [diff] [review]: ----------------------------------------------------------------- This looks better. When GeckoApp.mAppContext is replaced with mActivity later, we are already ready :)
Attachment #648107 -
Flags: review?(sriram) → review+
Assignee | ||
Comment 16•12 years ago
|
||
(In reply to Sriram Ramasubramanian [:sriram] from comment #14) > How about passing a context to ViewportMetrics() and let it deal with it, > instead of spoon feeding it with DisplayMetrics? Since ViewportMetrics only needs DisplayMetrics, I didn't want to add a dependency on the entire Context. I'm giving ViewportMetrics just one cookie, not the whole cookie jar. :)
Comment 17•12 years ago
|
||
Makes sense :) Already r+ ed.
Assignee | ||
Comment 18•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f0ac9e6acaa5 https://hg.mozilla.org/integration/mozilla-inbound/rev/9dc8f2dc324a
Comment 19•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fdd559da59cf https://hg.mozilla.org/mozilla-central/rev/4888b8395089
Comment 20•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f0ac9e6acaa5 https://hg.mozilla.org/mozilla-central/rev/9dc8f2dc324a
Comment on attachment 647785 [details] [diff] [review] create-DirectBufferAllocator.patch >+ public static ByteBuffer allocate(int size) { >+ if (size <= 0 || (size % 4) != 0) { >+ throw new IllegalArgumentException("Invalid size " + size); >+ } Er, what -- why this assertion? It's perfectly valid to allocate byte buffers that are not multiples of 4 in size! We trigger this all over the place in today's Nightly, for some reason especially on the Nexus 7. See https://bugzilla.mozilla.org/show_bug.cgi?id=776906#c7
Fixed that in http://hg.mozilla.org/mozilla-central/rev/e62747d22841 (bug 779826)
Assignee | ||
Comment 23•12 years ago
|
||
These changes have landed in m-c.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [leave open]
Updated•12 years ago
|
status-firefox17:
affected → ---
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•