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

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

Issue 2755673003: Allow parallel creation of windows
Patch Set: nits 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
« no previous file with comments | « services/ui/demo/mus_demo_internal.cc ('k') | services/ui/demo/window_tree_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ 5 #ifndef SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ 6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 10
11 namespace aura { 11 namespace aura {
12 class Window; 12 class Window;
13 class WindowTreeHostMus; 13 class WindowTreeHostMus;
14 } // namespace aura 14 } // namespace aura
15 15
16 namespace aura_extra { 16 namespace aura_extra {
17 class ImageWindowDelegate; 17 class ImageWindowDelegate;
18 } // namespace aura_extra 18 } // namespace aura_extra
19 19
20 namespace ui { 20 namespace ui {
21 namespace demo { 21 namespace demo {
22 22
23 class WindowTreeData { 23 class WindowTreeData {
24 public: 24 public:
25 explicit WindowTreeData(int square_size); 25 explicit WindowTreeData(int square_size);
26 ~WindowTreeData(); 26 ~WindowTreeData();
27 27
28 // Initializes the window tree host and start drawing frames. 28 // Initializes a window for bitmap and starts drawing frames.
29 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); 29 void Init();
30 bool IsInitialized() const { return window_delegate_; }
31 30
32 const aura::WindowTreeHostMus* WindowTreeHost() const { 31 const aura::WindowTreeHostMus* WindowTreeHost() const {
33 return window_tree_host_.get(); 32 return window_tree_host_.get();
34 } 33 }
35 34
36 protected: 35 protected:
37 void SetWindowTreeHost( 36 void SetWindowTreeHost(
38 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { 37 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
39 window_tree_host_ = std::move(window_tree_host); 38 window_tree_host_ = std::move(window_tree_host);
40 } 39 }
41 40
42 private: 41 private:
42 bool IsInitialized() const { return window_delegate_; }
43
43 // Draws one frame, incrementing the rotation angle. 44 // Draws one frame, incrementing the rotation angle.
44 void DrawFrame(); 45 void DrawFrame();
45 46
46 // Helper function to retrieve the window to which we draw the bitmap. 47 // Helper function to retrieve the window to which we draw the bitmap.
47 aura::Window* bitmap_window(); 48 aura::Window* bitmap_window();
48 49
49 // The Window tree host corresponding to this data. 50 // The Window tree host corresponding to this data.
50 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; 51 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
51 52
52 // Destroys itself when the window gets destroyed. 53 // Destroys itself when the window gets destroyed.
53 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; 54 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
54 55
55 // Timer for calling DrawFrame(). 56 // Timer for calling DrawFrame().
56 base::RepeatingTimer timer_; 57 base::RepeatingTimer timer_;
57 58
58 // Current rotation angle for drawing. 59 // Current rotation angle for drawing.
59 double angle_ = 0.0; 60 double angle_ = 0.0;
60 61
61 // Size in pixels of the square to draw. 62 // Size in pixels of the square to draw.
62 const int square_size_; 63 const int square_size_;
63 64
64 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); 65 DISALLOW_COPY_AND_ASSIGN(WindowTreeData);
65 }; 66 };
66 67
67 } // namespace demo 68 } // namespace demo
68 } // namespace ui 69 } // namespace ui
69 70
70 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ 71 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
OLDNEW
« no previous file with comments | « services/ui/demo/mus_demo_internal.cc ('k') | services/ui/demo/window_tree_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698