Backed out 5 changesets (bug 1726360) for causing build bustages on nsClipboardWayland.cpp. CLOSED TREE

Backed out changeset 8dbac57c6d97 (bug 1726360)
Backed out changeset f6a2a6120840 (bug 1726360)
Backed out changeset f1a23246cda9 (bug 1726360)
Backed out changeset 8b0f13706131 (bug 1726360)
Backed out changeset 252a8a030a49 (bug 1726360)
This commit is contained in:
Iulian Moraru 2021-08-27 21:29:18 +03:00
Родитель 507b8cb850
Коммит cd31ddf343
7 изменённых файлов: 19 добавлений и 53 удалений

Просмотреть файл

@ -11921,12 +11921,6 @@
value: false
mirror: once
# Use async data getter on Wayland Clipboard
- name: widget.wayland.async-data-transfer.enabled
type: bool
value: false
mirror: once
# Force fractional scaling using wp_viewporter. Valid values: 0.5 - 8
- name: widget.wayland.fractional_buffer_scale
type: float

Просмотреть файл

@ -40,13 +40,7 @@
using namespace mozilla;
// Idle timeout for receiving selection and property notify events (microsec)
// Right now it's set to 1 sec.
const int kClipboardTimeout = 1000000;
// Defines how many event loop iterations will be done without sleep.
// We ususally get data in first 2-3 iterations unless some large object
// (an image for instance) is transferred through clipboard.
const int kClipboardFastIterationNum = 3;
const int kClipboardTimeout = 500000;
// We add this prefix to HTML markup, so that GetHTMLCharset can correctly
// detect the HTML as UTF-8 encoded.

Просмотреть файл

@ -90,7 +90,6 @@ class nsClipboard : public nsIClipboard, public nsIObserver {
};
extern const int kClipboardTimeout;
extern const int kClipboardFastIterationNum;
GdkAtom GetSelectionAtom(int32_t aWhichClipboard);
int GetGeckoClipboardType(GtkClipboard* aGtkClipboard);

Просмотреть файл

@ -340,18 +340,14 @@ char* DataOffer::GetDataAsync(const char* aMimeType, uint32_t* aContentLength) {
}),
nsIEventTarget::NS_DISPATCH_NORMAL);
int iteration = 1;
PRTime entryTime = PR_Now();
while (!mGetterFinished) {
if (iteration++ > kClipboardFastIterationNum) {
PR_Sleep(PR_MillisecondsToInterval(10)); /* sleep for 10 ms/iteration */
if (PR_Now() - entryTime > kClipboardTimeout) {
LOGCLIP((" hit time limit\n"));
break;
}
// check the number of iterations
LOGCLIP(("doing iteration...\n"));
PR_Sleep(20 * PR_TicksPerSecond() / 1000); /* sleep for 20 ms/iteration */
if (PR_Now() - entryTime > kClipboardTimeout) {
break;
}
LOGCLIP(("doing iteration %d msec %ld ...\n", (iteration - 1),
(PR_Now() - entryTime) / 1000));
gtk_main_iteration();
}
@ -870,9 +866,7 @@ nsRetrievalContextWayland::nsRetrievalContextWayland(void)
: mDisplay(WaylandDisplayGet()),
mClipboardRequestNumber(0),
mClipboardData(nullptr),
mClipboardDataLength(0),
mAsyncDataGetter(
StaticPrefs::widget_wayland_async_data_transfer_enabled_AtStartup()) {
mClipboardDataLength(0) {
wl_data_device* dataDevice = wl_data_device_manager_get_data_device(
mDisplay->GetDataDeviceManager(), mDisplay->GetSeat());
wl_data_device_add_listener(dataDevice, &data_device_listener, this);
@ -927,7 +921,7 @@ void nsRetrievalContextWayland::TransferFastTrackClipboard(
if (mClipboardRequestNumber != aClipboardRequestNumber) {
LOGCLIP((" request number does not match!\n"));
return;
NS_WARNING("Received obsoleted clipboard data!");
}
LOGCLIP((" request number matches\n"));
@ -1046,10 +1040,7 @@ const char* nsRetrievalContextWayland::GetClipboardData(
} else {
LOGCLIP(
(" Getting clipboard data from compositor, MIME %s\n", aMimeType));
mClipboardData =
mAsyncDataGetter
? dataOffer->GetDataAsync(aMimeType, &mClipboardDataLength)
: dataOffer->GetData(aMimeType, &mClipboardDataLength);
mClipboardData = dataOffer->GetData(aMimeType, &mClipboardDataLength);
LOGCLIP((" Got %d bytes of data, mClipboardData = %p\n",
mClipboardDataLength, mClipboardData));
}

Просмотреть файл

@ -149,7 +149,7 @@ class nsRetrievalContextWayland : public nsRetrievalContext {
mozilla::Atomic<int> mClipboardRequestNumber;
char* mClipboardData;
uint32_t mClipboardDataLength;
bool mAsyncDataGetter;
// Mime types used for text data at Gtk+, see request_text_received_func()
// at gtkclipboard.c.
#define TEXT_MIME_TYPES_NUM 3

Просмотреть файл

@ -78,7 +78,6 @@ void nsRetrievalContextWaylandAsync::TransferAsyncClipboardData(
if (mClipboardRequestNumber != aClipboardRequestNumber) {
LOGCLIP((" request number does not match!\n"));
return;
}
LOGCLIP((" request number matches\n"));
@ -239,23 +238,17 @@ const char* nsRetrievalContextWaylandAsync::GetClipboardText(
}
bool nsRetrievalContextWaylandAsync::WaitForClipboardContent() {
int iteration = 1;
PRTime entryTime = PR_Now();
while (!mClipboardDataReceived) {
if (iteration++ > kClipboardFastIterationNum) {
/* sleep for 10 ms/iteration */
PR_Sleep(PR_MillisecondsToInterval(10));
if (PR_Now() - entryTime > kClipboardTimeout) {
LOGCLIP((" failed to get async clipboard data in time limit\n"));
break;
}
// check the number of iterations
LOGCLIP(("doing iteration...\n"));
PR_Sleep(20 * PR_TicksPerSecond() / 1000); /* sleep for 20 ms/iteration */
if (PR_Now() - entryTime > kClipboardTimeout) {
LOGCLIP((" failed to get async clipboard data in time limit\n"));
break;
}
LOGCLIP(("doing iteration %d msec %ld ...\n", (iteration - 1),
(PR_Now() - entryTime) / 1000));
gtk_main_iteration();
}
return mClipboardDataReceived && mClipboardData != nullptr;
}

Просмотреть файл

@ -1092,7 +1092,7 @@ bool nsDragService::IsTargetContextList(void) {
}
// Maximum time to wait for a "drag_received" arrived, in microseconds
#define NS_DND_TIMEOUT 1000000
#define NS_DND_TIMEOUT 500000
void nsDragService::GetTargetDragData(GdkAtom aFlavor) {
LOGDRAGSERVICE(("getting data flavor %s\n", gdk_atom_name(aFlavor)));
@ -1127,17 +1127,12 @@ void nsDragService::GetTargetDragData(GdkAtom aFlavor) {
gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
LOGDRAGSERVICE(("about to start inner iteration."));
gtk_main_iteration();
PRTime entryTime = PR_Now();
while (!mTargetDragDataReceived && mDoingDrag) {
// check the number of iterations
LOGDRAGSERVICE(("doing iteration...\n"));
PR_Sleep(PR_MillisecondsToInterval(10)); /* sleep for 10 ms/iteration */
if (PR_Now() - entryTime > NS_DND_TIMEOUT) {
LOGDRAGSERVICE(("failed to get D&D data in time!\n"));
break;
}
PR_Sleep(20 * PR_TicksPerSecond() / 1000); /* sleep for 20 ms/iteration */
if (PR_Now() - entryTime > NS_DND_TIMEOUT) break;
gtk_main_iteration();
}
}