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

Issue 1881253002: mus: Implement ScreenMus::GetCursorScreenPoint(). (Closed)

Created:
4 years, 8 months ago by Elliot Glaysher
Modified:
4 years, 7 months ago
Reviewers:
Nico, sky, piman
CC:
chromium-reviews, rjkroege, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, tfarina, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

mus: Implement ScreenMus::GetCursorScreenPoint(). ScreenMus (and by extension, much of our views code) assumes that it can know the position of the cursor on screen. If we broadcast the position to every client on mouse move, we'll wake up every client on every mouse move. If we add a sync ipc call from the client to the window server, what's a fairly common operation now performs a sync ipc. Instead, have the window server own a piece of shared memory, share a read only handle to it with anyone who asks, and then write the cursor position to it on each mouse event. This lets clients read the cursor position without costly broadcasting or sync ipcs. BUG=602727 Committed: https://crrev.com/78af65676b7db5aa44335792d6336a6c58847d5d Cr-Commit-Position: refs/heads/master@{#390539}

Patch Set 1 #

Patch Set 2 : Redo the patch per-user and roll that into UserDisplayManager, which ScreenMus already talks to. #

Patch Set 3 : Fix tests #

Patch Set 4 : Fix the other test. #

Patch Set 5 : Header #

Patch Set 6 : Use sync method. #

Patch Set 7 : Rebase to ToT #

Patch Set 8 : And fix chromeos. #

Total comments: 2

Patch Set 9 : Move onto the WindowTree pipe. #

Patch Set 10 : Patch cleanup. #

Patch Set 11 : test mocks too #

Total comments: 2

Patch Set 12 : Read the value form the EventDispatcher via WindowManagerState. #

Patch Set 13 : Don't crash on empty roots. #

Total comments: 2

Patch Set 14 : Rebuild everything so that we just reuse location on the client side. #

Patch Set 15 : Remove stray mark. #

Patch Set 16 : Rebuild the patch on top of shared memory. #

Patch Set 17 : Fix tests? #

Patch Set 18 : Fix win compile? #

Patch Set 19 : Weak ptrs for bind. #

Patch Set 20 : Fix windows more. #

Total comments: 6

Patch Set 21 : sky nits #

Patch Set 22 : Merge with ToT #

Patch Set 23 : Use Atomic32s instead of Atomic64 and don't crash when we don't have a delegate. #

Patch Set 24 : Actually apply the 32bit patch now that the delegate crash was fixed. #

Total comments: 7

Patch Set 25 : Did that integer break a bone? It has a cast on it\! #

Patch Set 26 : General patch cleanup. #

Patch Set 27 : Add another comment #

Total comments: 4

Patch Set 28 : Unit tests. #

Patch Set 29 : Merge with tot #

Unified diffs Side-by-side diffs Delta from patch set Stats (+228 lines, -7 lines) Patch
M components/mus/public/cpp/lib/window_tree_client_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 4 chunks +15 lines, -0 lines 0 comments Download
M components/mus/public/cpp/lib/window_tree_client_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 4 chunks +33 lines, -1 line 0 comments Download
M components/mus/public/cpp/tests/test_window_tree.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +2 lines, -0 lines 0 comments Download
M components/mus/public/cpp/tests/test_window_tree.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +5 lines, -0 lines 0 comments Download
M components/mus/public/cpp/window_tree_connection.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +8 lines, -0 lines 0 comments Download
M components/mus/public/interfaces/window_tree.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +5 lines, -0 lines 0 comments Download
M components/mus/ws/event_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +7 lines, -1 line 0 comments Download
M components/mus/ws/event_dispatcher_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +2 lines, -0 lines 0 comments Download
M components/mus/ws/event_dispatcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +1 line, -0 lines 0 comments Download
M components/mus/ws/user_display_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +27 lines, -0 lines 0 comments Download
M components/mus/ws/user_display_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +52 lines, -1 line 0 comments Download
M components/mus/ws/user_display_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +33 lines, -0 lines 0 comments Download
M components/mus/ws/window_manager_state.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +1 line, -0 lines 0 comments Download
M components/mus/ws/window_manager_state.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +5 lines, -0 lines 0 comments Download
M components/mus/ws/window_tree.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +2 lines, -0 lines 0 comments Download
M components/mus/ws/window_tree.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +8 lines, -0 lines 0 comments Download
M ui/views/mus/screen_mus.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +10 lines, -3 lines 0 comments Download
M ui/views/mus/screen_mus_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +7 lines, -1 line 0 comments Download
M ui/views/mus/window_manager_connection.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/mus/window_manager_connection.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 41 (10 generated)
Elliot Glaysher
4 years, 8 months ago (2016-04-13 21:50:56 UTC) #2
Elliot Glaysher
(views_mus_unittests is also failing locally on ToT.)
4 years, 8 months ago (2016-04-13 22:01:56 UTC) #3
sky
It seems unfortunate that we would broadcast to every app the location of the mouse ...
4 years, 8 months ago (2016-04-13 22:58:33 UTC) #4
Elliot Glaysher
On 2016/04/13 22:58:33, sky wrote: > It seems unfortunate that we would broadcast to every ...
4 years, 8 months ago (2016-04-13 23:18:44 UTC) #5
Elliot Glaysher
Moved to using sync for getting the cursor position. (I did some about:tracing and saw ...
4 years, 8 months ago (2016-04-15 19:11:17 UTC) #6
sky
https://codereview.chromium.org/1881253002/diff/140001/components/mus/public/interfaces/display.mojom File components/mus/public/interfaces/display.mojom (right): https://codereview.chromium.org/1881253002/diff/140001/components/mus/public/interfaces/display.mojom#newcode29 components/mus/public/interfaces/display.mojom:29: GetCursorScreenPoint() => (mojo.Point location); If you keep this on ...
4 years, 8 months ago (2016-04-15 20:38:57 UTC) #7
Elliot Glaysher
https://codereview.chromium.org/1881253002/diff/140001/components/mus/public/interfaces/display.mojom File components/mus/public/interfaces/display.mojom (right): https://codereview.chromium.org/1881253002/diff/140001/components/mus/public/interfaces/display.mojom#newcode29 components/mus/public/interfaces/display.mojom:29: GetCursorScreenPoint() => (mojo.Point location); On 2016/04/15 20:38:57, sky wrote: ...
4 years, 8 months ago (2016-04-15 23:56:52 UTC) #8
sky
https://codereview.chromium.org/1881253002/diff/200001/components/mus/public/cpp/lib/window_tree_client_impl.cc File components/mus/public/cpp/lib/window_tree_client_impl.cc (right): https://codereview.chromium.org/1881253002/diff/200001/components/mus/public/cpp/lib/window_tree_client_impl.cc#newcode819 components/mus/public/cpp/lib/window_tree_client_impl.cc:819: base::ThreadRestrictions::ScopedAllowWait allow_wait; Add a TODO that this code should ...
4 years, 8 months ago (2016-04-18 15:09:12 UTC) #9
Elliot Glaysher
ptal I feel a bit iffy about committing this now since I can't test it ...
4 years, 8 months ago (2016-04-18 20:21:37 UTC) #10
sky
https://codereview.chromium.org/1881253002/diff/240001/components/mus/ws/window_tree.cc File components/mus/ws/window_tree.cc (right): https://codereview.chromium.org/1881253002/diff/240001/components/mus/ws/window_tree.cc#newcode675 components/mus/ws/window_tree.cc:675: if (roots_.empty()) { On 2016/04/18 20:21:37, Elliot Glaysher wrote: ...
4 years, 8 months ago (2016-04-18 20:53:05 UTC) #11
Elliot Glaysher
Rebuilds the patch so that it passes data using a piece of shared memory, accessed ...
4 years, 8 months ago (2016-04-20 22:29:38 UTC) #12
sky
I'm not an expert with the atomics either, can you find someone knowledge of atomics ...
4 years, 8 months ago (2016-04-20 23:46:36 UTC) #13
Elliot Glaysher
+thakis Hi Nico, it looks like you have experience with atomic operations. I've never written ...
4 years, 8 months ago (2016-04-21 18:08:00 UTC) #16
Nico
can't you use a lock instead?
4 years, 8 months ago (2016-04-21 18:21:35 UTC) #17
Elliot Glaysher
On 2016/04/21 18:21:35, Nico wrote: > can't you use a lock instead? Do we have ...
4 years, 8 months ago (2016-04-21 18:23:45 UTC) #18
sky
multi-process lock seems more expensive than using atomics. -Scott On Thu, Apr 21, 2016 at ...
4 years, 8 months ago (2016-04-21 20:19:49 UTC) #19
Nico
Sure, but in return you have at least a chance of understanding them. In general, ...
4 years, 8 months ago (2016-04-21 20:25:54 UTC) #20
sky
Shared memory also has its uses in chrome as well. We're trying to avoid sending ...
4 years, 8 months ago (2016-04-21 20:28:41 UTC) #21
Elliot Glaysher
Looking at locks, we'd need write access in the reader to acquire the lock and ...
4 years, 7 months ago (2016-04-27 17:48:48 UTC) #22
sky
https://codereview.chromium.org/1881253002/diff/460001/components/mus/public/cpp/lib/window_tree_client_impl.cc File components/mus/public/cpp/lib/window_tree_client_impl.cc (right): https://codereview.chromium.org/1881253002/diff/460001/components/mus/public/cpp/lib/window_tree_client_impl.cc#newcode573 components/mus/public/cpp/lib/window_tree_client_impl.cc:573: called_initialize_cursor_location_ = true; DCHECK(!called...? https://codereview.chromium.org/1881253002/diff/460001/components/mus/public/cpp/lib/window_tree_client_impl.cc#newcode588 components/mus/public/cpp/lib/window_tree_client_impl.cc:588: return gfx::Point(location >> ...
4 years, 7 months ago (2016-04-27 20:10:28 UTC) #23
Elliot Glaysher
ptal - The memory is now owned by UserDisplayManager. - We now always initialize on ...
4 years, 7 months ago (2016-04-27 22:40:45 UTC) #24
sky
https://codereview.chromium.org/1881253002/diff/520001/components/mus/public/cpp/lib/window_tree_client_impl.cc File components/mus/public/cpp/lib/window_tree_client_impl.cc (right): https://codereview.chromium.org/1881253002/diff/520001/components/mus/public/cpp/lib/window_tree_client_impl.cc#newcode582 components/mus/public/cpp/lib/window_tree_client_impl.cc:582: return gfx::Point(location >> 16, Is the sign bit preserved ...
4 years, 7 months ago (2016-04-27 23:55:57 UTC) #25
Elliot Glaysher
https://codereview.chromium.org/1881253002/diff/520001/components/mus/public/cpp/lib/window_tree_client_impl.cc File components/mus/public/cpp/lib/window_tree_client_impl.cc (right): https://codereview.chromium.org/1881253002/diff/520001/components/mus/public/cpp/lib/window_tree_client_impl.cc#newcode582 components/mus/public/cpp/lib/window_tree_client_impl.cc:582: return gfx::Point(location >> 16, On 2016/04/27 23:55:57, sky wrote: ...
4 years, 7 months ago (2016-04-28 00:14:01 UTC) #26
sky
LGTM
4 years, 7 months ago (2016-04-28 03:36:00 UTC) #27
Elliot Glaysher
Hi Antoine, After talking about locking with Scott, a hostile process being able to acquire ...
4 years, 7 months ago (2016-04-28 17:18:27 UTC) #29
piman
lgtm
4 years, 7 months ago (2016-04-28 20:56:42 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1881253002/540001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1881253002/540001
4 years, 7 months ago (2016-04-28 21:01:35 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/174862)
4 years, 7 months ago (2016-04-28 21:15:24 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1881253002/560001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1881253002/560001
4 years, 7 months ago (2016-04-28 21:55:59 UTC) #37
commit-bot: I haz the power
Committed patchset #29 (id:560001)
4 years, 7 months ago (2016-04-28 23:57:00 UTC) #39
commit-bot: I haz the power
4 years, 7 months ago (2016-04-30 17:22:51 UTC) #40
Message was sent while issue was closed.
Patchset 29 (id:??) landed as
https://crrev.com/78af65676b7db5aa44335792d6336a6c58847d5d
Cr-Commit-Position: refs/heads/master@{#390539}

Powered by Google App Engine
This is Rietveld 408576698