Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Issue 13979012: Fix deadlock between UI thread and drag and drop thread on Windows. (Closed)

Created:
7 years, 8 months ago by dcheng
Modified:
7 years, 7 months ago
Reviewers:
sky, jianli
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam
Visibility:
Public.

Description

Fix deadlock between UI thread and drag and drop thread on Windows. During a drag and drop operation, drop targets may call IDataObject::GetData() even though the drop is not yet complete. This is problematic for DownloadURL since calling GetData() on the stored CF_HDROP will actually trigger the download to start. In order to prevent this, it called GetKeyState() to check if the left mouse button was still down. Chrome depends on the fact that this check is reliable, as it calls GetData(CF_HDROP) to extract filenames when something is dragged over a WebDropTargetWin. However, this is not a reliable heuristic since the drag and drop loop doesn't run in the UI thread when there is a DownloadURL in the drag. If the heuristic fails, this results in a deadlock; the UI thread blocks in its call to GetData(CF_HDROP) while the drag and drop thread is blocked on the UI thread waiting for the download to complete. In order to fix this, DataObjectImpl now has a bool member to track whether the drag and drop operation is still in progress. On a successful drop, WebDragSourceWin indicates that the drag operation is complete prior to returning DRAGDROP_S_DROP. BUG=163387 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=196925

Patch Set 1 #

Patch Set 2 : Test fixes and cleanup #

Patch Set 3 : Trim unused struct member #

Patch Set 4 : Add a TODO #

Patch Set 5 : Stage cleanups into a separate patch #

Total comments: 4

Patch Set 6 : Add initializer #

Total comments: 4

Patch Set 7 : Comment change #

Patch Set 8 : Retain #

Unified diffs Side-by-side diffs Delta from patch set Stats (+52 lines, -34 lines) Patch
M content/browser/web_contents/web_contents_drag_win.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M content/browser/web_contents/web_drag_source_win.h View 1 2 3 4 5 6 3 chunks +10 lines, -0 lines 0 comments Download
M content/browser/web_contents/web_drag_source_win.cc View 3 chunks +5 lines, -1 line 0 comments Download
M ui/base/dragdrop/os_exchange_data.h View 1 2 chunks +3 lines, -0 lines 0 comments Download
M ui/base/dragdrop/os_exchange_data.cc View 1 chunk +5 lines, -1 line 0 comments Download
M ui/base/dragdrop/os_exchange_data_provider_win.h View 1 2 3 4 5 chunks +5 lines, -5 lines 0 comments Download
M ui/base/dragdrop/os_exchange_data_provider_win.cc View 1 2 3 4 5 5 chunks +20 lines, -26 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
dcheng
Also, what applications did you originally test with? I've tested with Shell but I want ...
7 years, 7 months ago (2013-04-25 17:02:39 UTC) #1
jianli
On 2013/04/25 17:02:39, dcheng wrote: > Also, what applications did you originally test with? I've ...
7 years, 7 months ago (2013-04-25 22:15:06 UTC) #2
dcheng
On 2013/04/25 22:15:06, jianli wrote: > On 2013/04/25 17:02:39, dcheng wrote: > > Also, what ...
7 years, 7 months ago (2013-04-25 22:42:42 UTC) #3
jianli
https://codereview.chromium.org/13979012/diff/15001/ui/base/dragdrop/os_exchange_data_provider_win.cc File ui/base/dragdrop/os_exchange_data_provider_win.cc (left): https://codereview.chromium.org/13979012/diff/15001/ui/base/dragdrop/os_exchange_data_provider_win.cc#oldcode698 ui/base/dragdrop/os_exchange_data_provider_win.cc:698: if (is_left_button_down) { I am a bit concerned about ...
7 years, 7 months ago (2013-04-26 01:07:18 UTC) #4
dcheng
https://codereview.chromium.org/13979012/diff/15001/ui/base/dragdrop/os_exchange_data_provider_win.cc File ui/base/dragdrop/os_exchange_data_provider_win.cc (left): https://codereview.chromium.org/13979012/diff/15001/ui/base/dragdrop/os_exchange_data_provider_win.cc#oldcode698 ui/base/dragdrop/os_exchange_data_provider_win.cc:698: if (is_left_button_down) { On 2013/04/26 01:07:18, jianli wrote: > ...
7 years, 7 months ago (2013-04-26 18:05:44 UTC) #5
jianli
lgtm
7 years, 7 months ago (2013-04-26 21:24:38 UTC) #6
dcheng
+sky for OWNERS approval.
7 years, 7 months ago (2013-04-26 21:39:29 UTC) #7
sky
https://codereview.chromium.org/13979012/diff/11/content/browser/web_contents/web_contents_drag_win.cc File content/browser/web_contents/web_contents_drag_win.cc (right): https://codereview.chromium.org/13979012/diff/11/content/browser/web_contents/web_contents_drag_win.cc#newcode372 content/browser/web_contents/web_contents_drag_win.cc:372: drag_source_->set_data(NULL); How do we know 'this' has been destroyed ...
7 years, 7 months ago (2013-04-26 22:10:22 UTC) #8
dcheng
https://codereview.chromium.org/13979012/diff/11/content/browser/web_contents/web_contents_drag_win.cc File content/browser/web_contents/web_contents_drag_win.cc (right): https://codereview.chromium.org/13979012/diff/11/content/browser/web_contents/web_contents_drag_win.cc#newcode372 content/browser/web_contents/web_contents_drag_win.cc:372: drag_source_->set_data(NULL); On 2013/04/26 22:10:22, sky wrote: > How do ...
7 years, 7 months ago (2013-04-26 22:20:10 UTC) #9
sky
LGTM
7 years, 7 months ago (2013-04-26 23:10:54 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dcheng@chromium.org/13979012/25002
7 years, 7 months ago (2013-04-26 23:11:39 UTC) #11
commit-bot: I haz the power
Retried try job too often on linux_aura for step(s) aura_unittests, browser_tests, compositor_unittests, content_browsertests, content_unittests, interactive_ui_tests, ...
7 years, 7 months ago (2013-04-26 23:20:44 UTC) #12
dcheng
7 years, 7 months ago (2013-04-27 02:31:56 UTC) #13
Message was sent while issue was closed.
Committed patchset #8 manually as r196925 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698