Closed Bug 1743365 Opened 4 years ago Closed 4 years ago

[Linux] Redundant nsClipboard::HasDataMatchingFlavors() calls

Categories

(Core :: Widget: Gtk, defect, P3)

defect

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

For simple text paste we perform eight calls of nsClipboard::HasDataMatchingFlavors(). We need to optimize that as HasDataMatchingFlavors() is expensive call on Linux as we spin internal event loop.

nsClipboard::HasDataMatchingFlavors() calls nsRetrievalContext::GetTargets() which obtains clipboard targets. We need to call Gtk code for that and spin evetn loop to get the targets.
In this patch we store clipboard tragets internally to speed up nsClipboard::HasDataMatchingFlavors() calls. We also listen at owner-change signal to clear target cache when clipboard content changes.

Assignee: nobody → stransky
Status: NEW → ASSIGNED
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/743f82451af4 [Linux] Cache clipboard targets r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch

The failure mentioned in comment 6 appeared after the test manifests (similar to folders) got automatically reorganized but adding the failing combination to previous pushes ("backfilling") showed the issue started with the change from this bug.

Okay, let's wait to 97 cycle with it.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:stransky, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(stransky)
Flags: needinfo?(emilio)

Yes, I need to fix test failures.

Flags: needinfo?(stransky)
Flags: needinfo?(emilio)
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/d641e4ee14e4 [Linux] Cache clipboard targets r=emilio

Backed out for causing mochitest failures in test_pasteImgTextarea

Backout link: https://hg.mozilla.org/integration/autoland/rev/c543d1128430790627cb6fc9848e9f66c25daa67

Push with failures

Failure log

INFO - TEST-UNEXPECTED-FAIL | editor/libeditor/tests/test_pasteImgTextarea.xhtml | paste should not be enabled in xul textareas when an image is on the clipboard - got true, expected false
[task 2021-12-22T22:46:38.330Z] 22:46:38     INFO - SimpleTest.is@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:500:14
[task 2021-12-22T22:46:38.330Z] 22:46:38     INFO - @chrome://mochitests/content/chrome/editor/libeditor/tests/test_pasteImgTextarea.xhtml:22:11
[task 2021-12-22T22:46:38.330Z] 22:46:38     INFO - add_task | Leaving test 
[task 2021-12-22T22:46:38.330Z] 22:46:38     INFO - GECKO(2994) | MEMORY STAT | vsize 27687MB | residentFast 480MB | heapAllocated 207MB
[task 2021-12-22T22:46:38.330Z] 22:46:38     INFO - TEST-OK | editor/libeditor/tests/test_pasteImgTextarea.xhtml | took 152ms
Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Attachment #9252851 - Attachment is obsolete: true

nsClipboard::HasDataMatchingFlavors() calls nsRetrievalContext::GetTargets() which obtains clipboard targets. We need to call Gtk code for that and spin evetn loop to get the targets.
In this patch we store clipboard tragets internally to speed up nsClipboard::HasDataMatchingFlavors() calls. We also listen at owner-change signal to clear target cache when clipboard content changes.

Hm, the try doesn't look good but I don't see any connections to the clipboard code there.

Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/6428c9f9de09 [Linux] Cache clipboard targets r=emilio
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: