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

Side by Side Diff: ui/aura/window.cc

Issue 8508009: Debugging code to print layer tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/compositor/compositor.gyp » ('j') | ui/gfx/compositor/debug_utils.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/string_util.h"
11 #include "ui/aura/desktop.h" 12 #include "ui/aura/desktop.h"
12 #include "ui/aura/desktop_delegate.h" 13 #include "ui/aura/desktop_delegate.h"
13 #include "ui/aura/event.h" 14 #include "ui/aura/event.h"
14 #include "ui/aura/event_filter.h" 15 #include "ui/aura/event_filter.h"
15 #include "ui/aura/layout_manager.h" 16 #include "ui/aura/layout_manager.h"
16 #include "ui/aura/window_delegate.h" 17 #include "ui/aura/window_delegate.h"
17 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
18 #include "ui/aura/window_types.h" 19 #include "ui/aura/window_types.h"
19 #include "ui/base/animation/multi_animation.h" 20 #include "ui/base/animation/multi_animation.h"
20 #include "ui/gfx/canvas_skia.h" 21 #include "ui/gfx/canvas_skia.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (parent_) 68 if (parent_)
68 parent_->RemoveChild(this); 69 parent_->RemoveChild(this);
69 70
70 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); 71 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
71 } 72 }
72 73
73 void Window::Init(ui::Layer::LayerType layer_type) { 74 void Window::Init(ui::Layer::LayerType layer_type) {
74 layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), layer_type)); 75 layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), layer_type));
75 layer_->SetVisible(false); 76 layer_->SetVisible(false);
76 layer_->set_delegate(this); 77 layer_->set_delegate(this);
78 #if !defined(NDEBUG)
tfarina 2011/11/09 14:30:50 #ifndef NDEBUG ? one or the other for consistency?
79 std::string layer_name(name());
80 if (layer_name.size() == 0)
tfarina 2011/11/09 14:30:50 size() == 0 -> empty()
81 layer_name.append("Unnamed Window");
82
83 if (id() != -1) {
84 char id_buf[10];
85 base::snprintf(id_buf, sizeof(id_buf), " %d", id());
Ben Goodger (Google) 2011/11/09 17:03:52 Can you do all of this in the debug util rather th
pkotwicz 2011/11/09 18:56:02 I could do this. But I would be assuming that the
86 layer_name.append(id_buf);
87 }
88 layer_->set_name(layer_name);
89 #endif
77 } 90 }
78 91
79 void Window::SetType(WindowType type) { 92 void Window::SetType(WindowType type) {
80 // Cannot change type after the window is initialized. 93 // Cannot change type after the window is initialized.
81 DCHECK(!layer()); 94 DCHECK(!layer());
82 type_ = type; 95 type_ = type;
83 } 96 }
84 97
85 void Window::Show() { 98 void Window::Show() {
86 SetVisible(true); 99 SetVisible(true);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 505 }
493 506
494 return delegate_ ? this : NULL; 507 return delegate_ ? this : NULL;
495 } 508 }
496 509
497 void Window::OnPaintLayer(gfx::Canvas* canvas) { 510 void Window::OnPaintLayer(gfx::Canvas* canvas) {
498 delegate_->OnPaint(canvas); 511 delegate_->OnPaint(canvas);
499 } 512 }
500 513
501 } // namespace aura 514 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/compositor/compositor.gyp » ('j') | ui/gfx/compositor/debug_utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698