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

Side by Side Diff: services/ui/ws/server_window.cc

Issue 2257503002: Improve some debug tools for mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_mash
Patch Set: . Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/ws/server_window.h" 5 #include "services/ui/ws/server_window.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { 376 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) {
377 if (offset == underlay_offset_) 377 if (offset == underlay_offset_)
378 return; 378 return;
379 379
380 underlay_offset_ = offset; 380 underlay_offset_ = offset;
381 delegate_->OnScheduleWindowPaint(this); 381 delegate_->OnScheduleWindowPaint(this);
382 } 382 }
383 383
384 #if !defined(NDEBUG) 384 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
385 std::string ServerWindow::GetDebugWindowHierarchy() const { 385 std::string ServerWindow::GetDebugWindowHierarchy() const {
386 std::string result; 386 std::string result;
387 BuildDebugInfo(std::string(), &result); 387 BuildDebugInfo(std::string(), &result);
388 return result; 388 return result;
389 } 389 }
390 390
391 std::string ServerWindow::GetDebugWindowInfo() const {
392 std::string name = GetName();
393 return base::StringPrintf(
394 "id=%u:%u visible=%s bounds=%d,%d %dx%d %s", id_.client_id, id_.window_id,
sky 2016/08/17 19:01:05 id_.ToString() ?
kylechar 2016/08/17 19:10:12 Done.
395 visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(),
396 bounds_.height(), !name.empty() ? name.c_str() : "(no name)");
397 }
398
391 void ServerWindow::BuildDebugInfo(const std::string& depth, 399 void ServerWindow::BuildDebugInfo(const std::string& depth,
392 std::string* result) const { 400 std::string* result) const {
393 std::string name = GetName(); 401 *result +=
394 *result += base::StringPrintf( 402 base::StringPrintf("%s%s\n", depth.c_str(), GetDebugWindowInfo().c_str());
395 "%sid=%d,%d visible=%s bounds=%d,%d %dx%d %s\n", depth.c_str(),
396 static_cast<int>(id_.client_id), static_cast<int>(id_.window_id),
397 visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(),
398 bounds_.height(), !name.empty() ? name.c_str() : "(no name)");
399 for (const ServerWindow* child : children_) 403 for (const ServerWindow* child : children_)
400 child->BuildDebugInfo(depth + " ", result); 404 child->BuildDebugInfo(depth + " ", result);
401 } 405 }
402 #endif 406 #endif
403 407
404 void ServerWindow::RemoveImpl(ServerWindow* window) { 408 void ServerWindow::RemoveImpl(ServerWindow* window) {
405 window->parent_ = nullptr; 409 window->parent_ = nullptr;
406 children_.erase(std::find(children_.begin(), children_.end(), window)); 410 children_.erase(std::find(children_.begin(), children_.end(), window));
407 } 411 }
408 412
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 453 }
450 454
451 // static 455 // static
452 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { 456 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) {
453 return &window->stacking_target_; 457 return &window->stacking_target_;
454 } 458 }
455 459
456 } // namespace ws 460 } // namespace ws
457 461
458 } // namespace ui 462 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698