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

Unified Diff: services/ui/ws/server_window.cc

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. Created 3 years, 11 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
Index: services/ui/ws/server_window.cc
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc
index ea3cbfc65d3ef467d8015b8bd4cb71cc40639f30..c1cedd7e89bee9490e5d0b77eed42ff11844c5de 100644
--- a/services/ui/ws/server_window.cc
+++ b/services/ui/ws/server_window.cc
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <stddef.h>
+#include "base/debug/stack_trace.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "services/ui/common/transient_window_utils.h"
@@ -19,13 +20,15 @@ namespace ui {
namespace ws {
ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id)
- : ServerWindow(delegate, id, Properties()) {}
+ : ServerWindow(delegate, id, Properties(), cc::LocalFrameId()) {}
ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
const WindowId& id,
- const Properties& properties)
+ const Properties& properties,
+ const cc::LocalFrameId& local_frame_id)
: delegate_(delegate),
id_(id),
+ local_frame_id_(local_frame_id),
parent_(nullptr),
stacking_target_(nullptr),
transient_parent_(nullptr),
@@ -43,9 +46,13 @@ ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
observers_(
base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) {
DCHECK(delegate); // Must provide a delegate.
+ fprintf(stderr, ">>>ServerWindow creation: %d\n", WindowIdToTransportId(id));
+ // if (WindowIdToTransportId(id) == 65566)
+ // base::debug::StackTrace().Print();
}
ServerWindow::~ServerWindow() {
+ fprintf(stderr, ">>>~ServerWindow %s\n", GetDebugWindowInfo().c_str());
for (auto& observer : observers_)
observer.OnWindowDestroying(this);
@@ -175,16 +182,22 @@ void ServerWindow::StackChildAtTop(ServerWindow* child) {
child->Reorder(children_.back(), mojom::OrderDirection::ABOVE);
}
-void ServerWindow::SetBounds(const gfx::Rect& bounds) {
- if (bounds_ == bounds)
- return;
-
- // TODO(fsamuel): figure out how will this work with CompositorFrames.
+void ServerWindow::SetBounds(const gfx::Rect& bounds,
+ const cc::LocalFrameId& local_frame_id) {
+ // if (bounds_ == bounds)
+ // return;
const gfx::Rect old_bounds = bounds_;
bounds_ = bounds;
+ local_frame_id_ = local_frame_id;
+ fprintf(stderr, ">>>ServerWindow::SetBounds(Rect(%d, %d, %d, %d), %s\n",
+ bounds.x(), bounds.y(), bounds.width(), bounds.height(),
+ cc::SurfaceId(cc::FrameSinkId(WindowIdToTransportId(id()), 0),
+ local_frame_id)
+ .ToString()
+ .c_str());
for (auto& observer : observers_)
- observer.OnWindowBoundsChanged(this, old_bounds, bounds);
+ observer.OnWindowBoundsChanged(this, old_bounds, bounds, local_frame_id);
}
void ServerWindow::SetClientArea(
@@ -407,7 +420,8 @@ std::string ServerWindow::GetDebugWindowHierarchy() const {
std::string ServerWindow::GetDebugWindowInfo() const {
std::string name = GetName();
return base::StringPrintf(
- "id=%s visible=%s bounds=%d,%d %dx%d %s", id_.ToString().c_str(),
+ "server_id: %d id=%s visible=%s bounds=%d,%d %dx%d %s",
+ WindowIdToTransportId(id_), id_.ToString().c_str(),
visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(),
bounds_.height(), !name.empty() ? name.c_str() : "(no name)");
}

Powered by Google App Engine
This is Rietveld 408576698