Commit cb2ac1ed authored by Elliot Glaysher's avatar Elliot Glaysher Committed by Commit Bot

Fix cursor lifetime and turn on mus browser tests on the bots.

Previous attempts at trying to fix the cursor lifetime issue assumed
that it was related to ownership while passing refcounted objects across
thread boundaries. This patch, instead, frees the passed cursor
depending on how it was created.

Bug: 800219
Change-Id: Iaee3748716b155dfd180923712838870cfb21c47
Reviewed-on: https://chromium-review.googlesource.com/864833Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Elliot Glaysher <erg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531711}
parent 36a93578
......@@ -98,9 +98,10 @@ void SetCustomCursorOnResourceThread(
// |platform_window| is owned by the UI Service thread, so setting the
// cursor on it also needs to happen on that thread.
ui_service_task_runner_->PostTask(
FROM_HERE, base::Bind(&ThreadedImageCursors::SetCursorOnPlatformWindow,
threaded_image_cursors_weak_ptr, platform_cursor,
platform_window));
FROM_HERE,
base::Bind(&ThreadedImageCursors::SetCursorOnPlatformWindowAndUnref,
threaded_image_cursors_weak_ptr, platform_cursor,
platform_window));
}
}
#endif // defined(USE_OZONE)
......@@ -207,5 +208,25 @@ void ThreadedImageCursors::SetCursorOnPlatformWindow(
platform_window->SetCursor(platform_cursor);
}
#if defined(USE_OZONE)
void ThreadedImageCursors::SetCursorOnPlatformWindowAndUnref(
ui::PlatformCursor platform_cursor,
ui::PlatformWindow* platform_window) {
SetCursorOnPlatformWindow(platform_cursor, platform_window);
// The PlatformCursor returned by CreateAnimatedCursor() has a single
// refcount which is owned by the caller. If we were returned a valid
// |platform_cursor|, we must unref it here. All implementations of
// PlatformWindow::SetCursor() which need to keep the PlatformCursor have
// increased the refcount for their self.
//
// Note: Cursors returned by SetPlatformCursor() do not return custom bitmap
// cursors. The refcount of such a cursor is owned by the caller and
// shouldn't be refed/unrefed by the caller.
if (platform_cursor)
ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor);
}
#endif
} // namespace ws
} // namespace ui
......@@ -66,6 +66,10 @@ class ThreadedImageCursors {
// Helper method. Sets |platform_cursor| on the |platform_window|.
void SetCursorOnPlatformWindow(ui::PlatformCursor platform_cursor,
ui::PlatformWindow* platform_window);
#if defined(USE_OZONE)
void SetCursorOnPlatformWindowAndUnref(ui::PlatformCursor platform_cursor,
ui::PlatformWindow* platform_window);
#endif
private:
// The object used for performing the actual cursor operations.
......
......@@ -946,6 +946,19 @@
},
"test": "browser_tests"
},
{
"args": [
"--mus",
"--ozone-platform=headless",
"--override-use-software-gl-for-tests"
],
"name": "mus_browser_tests",
"swarming": {
"can_use_on_swarming_builders": true,
"shards": 10
},
"test": "browser_tests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......
......@@ -2537,12 +2537,6 @@
},
},
},
'mus_browser_tests': {
'remove_from': [
# chromium.memory
'Linux Chromium OS ASan LSan Tests (1)',
]
},
'nacl_helper_nonsfi_unittests': {
'remove_from': [
# chromium.clang
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment