Closed
Bug 1023557
Opened 10 years ago
Closed 10 years ago
At 20 chars, FrameMetrics::mContentDescription is often too short to be useful
Categories
(Core :: Panning and Zooming, defect)
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: botond, Assigned: botond)
References
Details
Attachments
(1 file, 2 obsolete files)
16.56 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
Bug 1015278 limited the length of FrameMetrics::mContentDescription to 20. Unfortunately, 20 characters is often not enough to give us the information we need. For example, the content description div@b2167040 class="scrollable" gets truncated to div@b205d040 class= The key piece of information - the class name of the div which allows one to identify which of the many divs in the DOM we are talking about - is missing. Unfortunately, bumping the length a bit, say to 30, doesn't help too much, either. Consider another example: html@afa48200 sizemode="fullscreen" windowtype="navigator:browser" id="shell" xmlns="http://www.w3.org/1999/xhtml " chromehidden="menubar toolbar location directories status " gets truncated to html@afa48200 sizem Here, the key piece of information is id="shell" but that's fairly far in the string, so bumping the limit a bit won't result in keeping it. It seems we either need to build the content description string more cleverly (i.e. put the key information at the front), or return to using dynamically-sized strings and somehow make them work with shared memory.
Comment 1•10 years ago
|
||
It looks like various ns*String classes are IPC-friendly. At least they have read/write functions in ipc/glue/IPCMessageUtils.h. So maybe we can replace the const char with one of those string classes and that would solve this problem as well as keeping it IPC-safe.
Comment 2•10 years ago
|
||
If I'm reading https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings right then nsCString is probably the most appropriate thing to use.
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #1) > It looks like various ns*String classes are IPC-friendly. At least they have > read/write functions in ipc/glue/IPCMessageUtils.h. So maybe we can replace > the const char with one of those string classes and that would solve this > problem as well as keeping it IPC-safe. If by "IPC-safe" you just mean "have read/write functions for sending over IPDL", then std::string - the thing we used initially - was IPC-safe as well. The reason we had to abandon std::string was that it was not safe to copy the raw bytes into shared memory. Is that safe to do for nsCString?
Comment 4•10 years ago
|
||
D'oh! You're right, I confused myself. It's probably unsafe to simply copy nsCString into shared memory as well, for the same reason that std::string is unsafe.
Assignee | ||
Comment 5•10 years ago
|
||
As dicussed with Kats on IRC, a simple solution is to move mContentDescription from FrameMetrics to ContainerLayer, and change its type back to std::string. (Unlike FrameMetrics, ContainerLayer does not have to be shmem-safe.)
Assignee: nobody → botond
Assignee | ||
Comment 6•10 years ago
|
||
Less manual string manipulation. More useful information APZC tree logs. Win-win from where I'm standing.
Attachment #8465715 -
Flags: review?(bugmail.mozilla)
Attachment #8465715 -
Flags: review?(bgirard)
Comment 7•10 years ago
|
||
Comment on attachment 8465715 [details] [diff] [review] Move content description from FrameMetrics to ContainerLayer Review of attachment 8465715 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/layers/FrameMetrics.h @@ +400,5 @@ > { > return mScrollGeneration; > } > > + void SetContentDescription(const std::string& aContentDescription); Remove this?
Attachment #8465715 -
Flags: review?(bugmail.mozilla) → review+
Comment 8•10 years ago
|
||
Comment on attachment 8465715 [details] [diff] [review] Move content description from FrameMetrics to ContainerLayer Review of attachment 8465715 [details] [diff] [review]: ----------------------------------------------------------------- Cool. Maybe this field would be even better suited in the Layer base class. ::: gfx/layers/Layers.h @@ +1771,5 @@ > } > > + void SetContentDescription(const std::string& aContentDescription) > + { > + if (mContentDescription == aContentDescription) { Keep in mind that you're not doing string equality here so you might risk sending the same string.
Attachment #8465715 -
Flags: review?(bgirard) → review+
Assignee | ||
Comment 9•10 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #7) > > + void SetContentDescription(const std::string& aContentDescription); > > Remove this? Fixed. Thanks for catching it!
Attachment #8465715 -
Attachment is obsolete: true
Attachment #8465733 -
Flags: review+
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Benoit Girard (:BenWa) from comment #8) > Maybe this field would be even better suited in the Layer base class. I will move it, along with mBackgroundColor, to Layer as part of the multi-layer-apz work. > ::: gfx/layers/Layers.h > > + void SetContentDescription(const std::string& aContentDescription) > > + { > > + if (mContentDescription == aContentDescription) { > > Keep in mind that you're not doing string equality here so you might risk > sending the same string. I am doing string equality. std::string has an overloaded operator== which compares the contents.
Assignee | ||
Comment 11•10 years ago
|
||
try |
Try push: https://tbpl.mozilla.org/?tree=Try&rev=bd91dc90bc9a
Assignee | ||
Comment 12•10 years ago
|
||
green try |
I forgot to remove the field FrameMetrics::mContentDescription itself, leading to Werrors. Fixed, carrying r+. ReTrying: https://tbpl.mozilla.org/?tree=Try&rev=fb712b871d90
Attachment #8465733 -
Attachment is obsolete: true
Attachment #8465752 -
Flags: review+
Assignee | ||
Comment 13•10 years ago
|
||
landing |
https://hg.mozilla.org/integration/mozilla-inbound/rev/71b50829a272
Comment 14•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/71b50829a272
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Unless there's some hidden reason why we can't use Gecko strings here, we should be.
Assignee | ||
Comment 16•10 years ago
|
||
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #15) > Unless there's some hidden reason why we can't use Gecko strings here, we > should be. The logging framework in gfx/2d/Logging.h uses std::string and std::stringstream. (I extended this framework in bug 958596, but what was there before already used std::string and std::stringstream.) The content description is printed by the APZC tree log, which uses this logging code. Logging code in Layers.cpp and LayersLogging.cpp also uses std::string and std::stringstream, so we are being consistent with that. Does it matter much which string class we use?
Assignee | ||
Comment 17•10 years ago
|
||
Bug 967844 regressed this again; reopening. Kats had an idea for how to fix this in https://bugzilla.mozilla.org/show_bug.cgi?id=967844#c70; let's track any progress on that, or any alternative ideas, here.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 18•10 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #17) > Bug 967844 regressed this again; reopening. > > Kats had an idea for how to fix this in > https://bugzilla.mozilla.org/show_bug.cgi?id=967844#c70; let's track any > progress on that, or any alternative ideas, here. On second thought, let's track this in a different bug, as this landed in mozilla34 and a new fix would land in mozilla35. I filed bug 1062411.
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•