OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/wayland/fake_server.h" | 5 #include "ui/ozone/platform/wayland/fake_server.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <wayland-server.h> | 8 #include <wayland-server.h> |
9 #include <xdg-shell-unstable-v5-server-protocol.h> | 9 #include <xdg-shell-unstable-v5-server-protocol.h> |
10 | 10 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return false; | 360 return false; |
361 if (!xdg_shell_.Initialize(display_.get())) | 361 if (!xdg_shell_.Initialize(display_.get())) |
362 return false; | 362 return false; |
363 | 363 |
364 client_ = wl_client_create(display_.get(), server_fd.get()); | 364 client_ = wl_client_create(display_.get(), server_fd.get()); |
365 if (!client_) | 365 if (!client_) |
366 return false; | 366 return false; |
367 (void)server_fd.release(); | 367 (void)server_fd.release(); |
368 | 368 |
369 base::Thread::Options options; | 369 base::Thread::Options options; |
370 options.message_loop_type = MessageLoop::TYPE_IO; | 370 options.message_loop_type = base::MessageLoop::TYPE_IO; |
371 if (!base::Thread::StartWithOptions(options)) | 371 if (!base::Thread::StartWithOptions(options)) |
372 return false; | 372 return false; |
373 task_runner()->PostTask(FROM_HERE, | 373 task_runner()->PostTask(FROM_HERE, |
374 base::Bind(&FakeServer::StartWatchingFileDescriptor, | 374 base::Bind(&FakeServer::StartWatchingFileDescriptor, |
375 base::Unretained(this))); | 375 base::Unretained(this))); |
376 | 376 |
377 setenv("WAYLAND_SOCKET", base::UintToString(client_fd.release()).c_str(), 1); | 377 setenv("WAYLAND_SOCKET", base::UintToString(client_fd.release()).c_str(), 1); |
378 | 378 |
379 return true; | 379 return true; |
380 } | 380 } |
(...skipping 23 matching lines...) Expand all Loading... |
404 base::Unretained(this))); | 404 base::Unretained(this))); |
405 } | 405 } |
406 | 406 |
407 void FakeServer::OnFileCanReadWithoutBlocking() { | 407 void FakeServer::OnFileCanReadWithoutBlocking() { |
408 wl_event_loop_dispatch(event_loop_, 0); | 408 wl_event_loop_dispatch(event_loop_, 0); |
409 wl_display_flush_clients(display_.get()); | 409 wl_display_flush_clients(display_.get()); |
410 } | 410 } |
411 | 411 |
412 | 412 |
413 } // namespace wl | 413 } // namespace wl |
OLD | NEW |