Commit 427485ab authored by kalyan.kondapally's avatar kalyan.kondapally Committed by Commit bot

Fix crash in ResetCursor.

During the GPU Channel set up, we queue Cursor related IPC calls and
calls related to Widget delegate creation is done only after the channel
is established. This has a effect that the cursor related IPC calls are
handled first and then calls related to Widget delegate creation. However
ResetCursor expects WindowDelegate for the widget to be already
present. Now, we force the creation of WidgetDelegate in OnCursorSet.

This was causing a crash during startup.

Review URL: https://codereview.chromium.org/698793002

Cr-Commit-Position: refs/heads/master@{#302622}
parent 67e2ec66
......@@ -34,7 +34,6 @@ void DriCursor::SetCursor(gfx::AcceleratedWidget widget,
return;
cursor_ = cursor;
ShowCursor();
}
void DriCursor::ShowCursor() {
......
......@@ -28,6 +28,9 @@ class DriCursor : public CursorDelegateEvdev {
DriWindowManager* window_manager);
virtual ~DriCursor();
// Set's platform_cursor for widget. SetCursor is not responsible for showing
// the cursor. ShowCursor needs to be explicitly called to make the cursor
// visible.
void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor);
void ShowCursor();
void HideCursor();
......
......@@ -87,7 +87,13 @@ void DriWindow::Minimize() {}
void DriWindow::Restore() {}
void DriWindow::SetCursor(PlatformCursor cursor) {
window_manager_->cursor()->SetCursor(widget_, cursor);
DriCursor* dri_cursor = window_manager_->cursor();
dri_cursor->SetCursor(widget_, cursor);
// ShowCursor results in a IPC call to GPU. So, we make sure the channel
// is connected. OnChannelEstablished guarantees that ShowCursor is called
// eventually.
if (sender_->IsConnected() && dri_cursor->GetCursorWindow() == widget_)
dri_cursor->ShowCursor();
}
void DriWindow::MoveCursorTo(const gfx::Point& location) {
......@@ -114,6 +120,10 @@ uint32_t DriWindow::DispatchEvent(const PlatformEvent& native_event) {
void DriWindow::OnChannelEstablished() {
sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_));
sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_));
DriCursor* dri_cursor = window_manager_->cursor();
if (dri_cursor->GetCursorWindow() == widget_)
dri_cursor->ShowCursor();
}
void DriWindow::OnChannelDestroyed() {
......
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