OLD | NEW |
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 #ifndef SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 5 #ifndef SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
6 #define SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 6 #define SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "cc/surfaces/surface_id.h" | |
15 #include "mojo/public/cpp/bindings/callback.h" | 14 #include "mojo/public/cpp/bindings/callback.h" |
16 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom.
h" | 15 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom.
h" |
17 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" | 16 #include "mojo/services/surfaces/public/interfaces/display.mojom.h" |
18 #include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h" | 17 #include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h" |
19 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
20 | 19 |
21 namespace cc { | 20 namespace cc { |
22 class SurfaceIdAllocator; | 21 class SurfaceIdAllocator; |
23 } | 22 } |
24 | 23 |
25 namespace mojo { | 24 namespace mojo { |
26 class ApplicationConnection; | 25 class ApplicationConnection; |
27 class ApplicationImpl; | 26 class ApplicationImpl; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const mojo::Callback<void()>& native_viewport_closed_callback); | 58 const mojo::Callback<void()>& native_viewport_closed_callback); |
60 ~DefaultDisplayManager() override; | 59 ~DefaultDisplayManager() override; |
61 | 60 |
62 // DisplayManager: | 61 // DisplayManager: |
63 void Init(ConnectionManager* connection_manager) override; | 62 void Init(ConnectionManager* connection_manager) override; |
64 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; | 63 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; |
65 void SetViewportSize(const gfx::Size& size) override; | 64 void SetViewportSize(const gfx::Size& size) override; |
66 const mojo::ViewportMetrics& GetViewportMetrics() override; | 65 const mojo::ViewportMetrics& GetViewportMetrics() override; |
67 | 66 |
68 private: | 67 private: |
69 void OnCreatedNativeViewport(uint64_t native_viewport_id, | 68 void WantToDraw(); |
70 mojo::ViewportMetricsPtr metrics); | |
71 void Draw(); | 69 void Draw(); |
| 70 void DidDraw(); |
72 | 71 |
73 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics); | 72 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics); |
74 | 73 |
75 void SetIdNamespace(uint32_t id_namespace); | |
76 | |
77 // ErrorHandler: | 74 // ErrorHandler: |
78 void OnConnectionError() override; | 75 void OnConnectionError() override; |
79 | 76 |
80 mojo::ApplicationImpl* app_impl_; | 77 mojo::ApplicationImpl* app_impl_; |
81 mojo::ApplicationConnection* app_connection_; | 78 mojo::ApplicationConnection* app_connection_; |
82 ConnectionManager* connection_manager_; | 79 ConnectionManager* connection_manager_; |
83 | 80 |
84 mojo::ViewportMetrics metrics_; | 81 mojo::ViewportMetrics metrics_; |
85 gfx::Rect dirty_rect_; | 82 gfx::Rect dirty_rect_; |
86 base::Timer draw_timer_; | 83 base::Timer draw_timer_; |
| 84 bool frame_pending_; |
87 | 85 |
88 mojo::SurfacePtr surface_; | 86 mojo::DisplayPtr display_; |
89 uint32_t id_namespace_; | |
90 bool surface_allocated_; | |
91 mojo::NativeViewportPtr native_viewport_; | 87 mojo::NativeViewportPtr native_viewport_; |
92 mojo::Callback<void()> native_viewport_closed_callback_; | 88 mojo::Callback<void()> native_viewport_closed_callback_; |
93 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 89 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
94 | 90 |
95 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 91 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
96 }; | 92 }; |
97 | 93 |
98 } // namespace view_manager | 94 } // namespace view_manager |
99 | 95 |
100 #endif // SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 96 #endif // SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
OLD | NEW |