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

Side by Side Diff: services/ui/demo/window_tree_data.cc

Issue 2755673003: Allow parallel creation of windows
Patch Set: fix comments Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/demo/window_tree_data.h" 5 #include "services/ui/demo/window_tree_data.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 WindowTreeData::WindowTreeData(int square_size) : square_size_(square_size) {} 60 WindowTreeData::WindowTreeData(int square_size) : square_size_(square_size) {}
61 61
62 WindowTreeData::~WindowTreeData() {} 62 WindowTreeData::~WindowTreeData() {}
63 63
64 aura::Window* WindowTreeData::bitmap_window() { 64 aura::Window* WindowTreeData::bitmap_window() {
65 DCHECK(!window_tree_host_->window()->children().empty()); 65 DCHECK(!window_tree_host_->window()->children().empty());
66 return window_tree_host_->window()->children()[0]; 66 return window_tree_host_->window()->children()[0];
67 } 67 }
68 68
69 void WindowTreeData::Init( 69 void WindowTreeData::Init(
70 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { 70 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
fwang 2017/03/16 08:59:49 So I think you can remove the parameter and assume
msisov(use msisov igalia.com) 2017/03/16 09:21:32 If window_tree_host->InitHost(); and window_tree_h
71 DCHECK(!IsInitialized());
71 if (window_tree_host) { 72 if (window_tree_host) {
72 window_tree_host->InitHost(); 73 window_tree_host->InitHost();
73 window_tree_host->Show(); 74 window_tree_host->Show();
74 SetWindowTreeHost(std::move(window_tree_host)); 75 SetWindowTreeHost(std::move(window_tree_host));
75 } 76 }
76 77
77 // Initialize the window for the bitmap. 78 // Initialize the window for the bitmap.
78 window_delegate_ = new aura_extra::ImageWindowDelegate(); 79 window_delegate_ = new aura_extra::ImageWindowDelegate();
79 aura::Window* root_window = window_tree_host_->window(); 80 aura::Window* root_window = window_tree_host_->window();
80 aura::Window* bitmap_window = new aura::Window(window_delegate_); 81 aura::Window* bitmap_window = new aura::Window(window_delegate_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); 114 gfx::ImageSkiaRep image_skia_rep(bitmap, 1);
114 gfx::ImageSkia image_skia(image_skia_rep); 115 gfx::ImageSkia image_skia(image_skia_rep);
115 gfx::Image image(image_skia); 116 gfx::Image image(image_skia);
116 117
117 window_delegate_->SetImage(image); 118 window_delegate_->SetImage(image);
118 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); 119 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size()));
119 } 120 }
120 121
121 } // namespace demo 122 } // namespace demo
122 } // namespace ui 123 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698