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

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: rebase 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
Index: components/exo/display.cc
diff --git a/components/exo/display.cc b/components/exo/display.cc
index bb6a017bdbe294bc8a97f380a1dfa9ffbb76b26a..c6f51cd94ddd81ebb3b9778ccf516c8284f5eaf2 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()) {
+ LOG(ERROR) << "Surface has already been assigned a role";
piman 2015/11/19 21:59:10 nit: DLOG here and below
reveman 2015/11/20 05:19:48 Done.
+ 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 == parent) {
piman 2015/11/19 21:59:10 Is there a possibility that indirect cycles might
reveman 2015/11/20 05:19:48 Yes, that would cause bad behavior. I changed this
+ LOG(ERROR) << "Surface cannot be its own parent";
+ return nullptr;
+ }
+
+ if (surface->HasSurfaceDelegate()) {
+ LOG(ERROR) << "Surface has already been assigned a role";
+ return nullptr;
+ }
+
+ return make_scoped_ptr(new SubSurface(surface, parent));
+}
+
} // namespace exo

Powered by Google App Engine
This is Rietveld 408576698