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

Unified Diff: components/exo/display.cc

Issue 1419373013: exo: Add support for subcompositor interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exosphere-xdg-shell
Patch Set: address review feedback Created 5 years, 1 month 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 | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display.cc
diff --git a/components/exo/display.cc b/components/exo/display.cc
index bb6a017bdbe294bc8a97f380a1dfa9ffbb76b26a..b13c7fe828224065966c2dc9e8bd5422c79a5567 100644
--- a/components/exo/display.cc
+++ b/components/exo/display.cc
@@ -8,6 +8,7 @@
#include "base/trace_event/trace_event_argument.h"
#include "components/exo/shared_memory.h"
#include "components/exo/shell_surface.h"
+#include "components/exo/sub_surface.h"
#include "components/exo/surface.h"
namespace exo {
@@ -40,7 +41,30 @@ scoped_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface",
surface->AsTracedValue());
+ if (surface->HasSurfaceDelegate()) {
+ DLOG(ERROR) << "Surface has already been assigned a role";
+ return nullptr;
+ }
+
return make_scoped_ptr(new ShellSurface(surface));
}
+scoped_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,
+ Surface* parent) {
+ TRACE_EVENT2("exo", "Display::CreateSubSurface", "surface",
+ surface->AsTracedValue(), "parent", parent->AsTracedValue());
+
+ if (surface->Contains(parent)) {
+ DLOG(ERROR) << "Parent is contained within surface's hierarchy";
+ return nullptr;
+ }
+
+ if (surface->HasSurfaceDelegate()) {
+ DLOG(ERROR) << "Surface has already been assigned a role";
+ return nullptr;
+ }
+
+ return make_scoped_ptr(new SubSurface(surface, parent));
+}
+
} // namespace exo
« no previous file with comments | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698