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

Unified Diff: ui/ozone/platform/wayland/wayland_display.cc

Issue 1698043005: ozone/platform/wayland: Ensure that globals are bound with supported versions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/wayland/fake_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/wayland_display.cc
diff --git a/ui/ozone/platform/wayland/wayland_display.cc b/ui/ozone/platform/wayland/wayland_display.cc
index 488754a480fbff807923f5741126b69ec3f2e3b7..3ad93f8b94fcd1768ba68b7a532204493e059a47 100644
--- a/ui/ozone/platform/wayland/wayland_display.cc
+++ b/ui/ozone/platform/wayland/wayland_display.cc
@@ -12,6 +12,11 @@
static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version");
namespace ui {
+namespace {
+const uint32_t kMaxCompositorVersion = 4;
+const uint32_t kMaxShmVersion = 1;
+const uint32_t kMaxXdgShellVersion = 1;
+} // namespace
WaylandDisplay::WaylandDisplay() {}
@@ -103,15 +108,18 @@ void WaylandDisplay::Global(void* data,
WaylandDisplay* display = static_cast<WaylandDisplay*>(data);
if (!display->compositor_ && strcmp(interface, "wl_compositor") == 0) {
- display->compositor_ = wl::Bind<wl_compositor>(registry, name, version);
+ display->compositor_ = wl::Bind<wl_compositor>(
+ registry, name, std::min(version, kMaxCompositorVersion));
spang 2016/02/17 23:25:03 Should version < 4 be an error? Or is the code a
if (!display->compositor_)
LOG(ERROR) << "Failed to bind to wl_compositor global";
} else if (!display->shm_ && strcmp(interface, "wl_shm") == 0) {
- display->shm_ = wl::Bind<wl_shm>(registry, name, version);
+ display->shm_ =
+ wl::Bind<wl_shm>(registry, name, std::min(version, kMaxShmVersion));
if (!display->shm_)
LOG(ERROR) << "Failed to bind to wl_shm global";
} else if (!display->shell_ && strcmp(interface, "xdg_shell") == 0) {
- display->shell_ = wl::Bind<xdg_shell>(registry, name, version);
+ display->shell_ = wl::Bind<xdg_shell>(
+ registry, name, std::min(version, kMaxXdgShellVersion));
if (!display->shell_) {
LOG(ERROR) << "Failed to bind to xdg_shell global";
return;
« no previous file with comments | « ui/ozone/platform/wayland/fake_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698