| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/wayland/server.h" | 5 #include "components/exo/wayland/server.h" |
| 6 | 6 |
| 7 #include <grp.h> | 7 #include <grp.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 SetImplementation(resource, &remote_shell_implementation, | 1853 SetImplementation(resource, &remote_shell_implementation, |
| 1854 base::MakeUnique<WaylandRemoteShell>( | 1854 base::MakeUnique<WaylandRemoteShell>( |
| 1855 static_cast<Display*>(data), resource)); | 1855 static_cast<Display*>(data), resource)); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 //////////////////////////////////////////////////////////////////////////////// | 1858 //////////////////////////////////////////////////////////////////////////////// |
| 1859 // vsync_timing_interface: | 1859 // vsync_timing_interface: |
| 1860 | 1860 |
| 1861 // Implements VSync timing interface by monitoring a compositor for updates | 1861 // Implements VSync timing interface by monitoring a compositor for updates |
| 1862 // to VSync parameters. | 1862 // to VSync parameters. |
| 1863 class VSyncTiming : public ui::CompositorVSyncManager::Observer { | 1863 class VSyncTiming : public cc::VSyncObserver { |
| 1864 public: | 1864 public: |
| 1865 ~VSyncTiming() { vsync_manager_->RemoveObserver(this); } | 1865 ~VSyncTiming() { vsync_manager_->RemoveObserver(this); } |
| 1866 | 1866 |
| 1867 static std::unique_ptr<VSyncTiming> Create(ui::Compositor* compositor, | 1867 static std::unique_ptr<VSyncTiming> Create(ui::Compositor* compositor, |
| 1868 wl_resource* timing_resource) { | 1868 wl_resource* timing_resource) { |
| 1869 std::unique_ptr<VSyncTiming> vsync_timing( | 1869 std::unique_ptr<VSyncTiming> vsync_timing( |
| 1870 new VSyncTiming(compositor, timing_resource)); | 1870 new VSyncTiming(compositor, timing_resource)); |
| 1871 // Note: AddObserver() will call OnUpdateVSyncParameters. | 1871 // Note: AddObserver() will call OnUpdateVSyncParameters. |
| 1872 vsync_timing->vsync_manager_->AddObserver(vsync_timing.get()); | 1872 vsync_timing->vsync_manager_->AddObserver(vsync_timing.get()); |
| 1873 return vsync_timing; | 1873 return vsync_timing; |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 // Overridden from ui::CompositorVSyncManager::Observer: | 1876 // Overridden from cc::VSyncObserver: |
| 1877 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 1877 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 1878 base::TimeDelta interval) override { | 1878 base::TimeDelta interval) override { |
| 1879 uint64_t timebase_us = timebase.ToInternalValue(); | 1879 uint64_t timebase_us = timebase.ToInternalValue(); |
| 1880 uint64_t interval_us = interval.ToInternalValue(); | 1880 uint64_t interval_us = interval.ToInternalValue(); |
| 1881 | 1881 |
| 1882 // Ignore updates with interval 0. | 1882 // Ignore updates with interval 0. |
| 1883 if (!interval_us) | 1883 if (!interval_us) |
| 1884 return; | 1884 return; |
| 1885 | 1885 |
| 1886 uint64_t offset_us = timebase_us % interval_us; | 1886 uint64_t offset_us = timebase_us % interval_us; |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 DCHECK(event_loop); | 3072 DCHECK(event_loop); |
| 3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3074 } | 3074 } |
| 3075 | 3075 |
| 3076 void Server::Flush() { | 3076 void Server::Flush() { |
| 3077 wl_display_flush_clients(wl_display_.get()); | 3077 wl_display_flush_clients(wl_display_.get()); |
| 3078 } | 3078 } |
| 3079 | 3079 |
| 3080 } // namespace wayland | 3080 } // namespace wayland |
| 3081 } // namespace exo | 3081 } // namespace exo |
| OLD | NEW |