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

Side by Side Diff: components/mus/ws/platform_display.h

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « components/mus/ws/focus_controller_unittest.cc ('k') | components/mus/ws/platform_display.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 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 COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ 5 #ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
6 #define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ 6 #define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "components/mus/public/interfaces/window_manager.mojom.h" 18 #include "components/mus/public/interfaces/window_manager.mojom.h"
19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" 19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
20 #include "components/mus/public/interfaces/window_tree.mojom.h" 20 #include "components/mus/public/interfaces/window_tree.mojom.h"
21 #include "components/mus/ws/platform_display_delegate.h" 21 #include "components/mus/ws/platform_display_delegate.h"
22 #include "components/mus/ws/platform_display_init_params.h" 22 #include "components/mus/ws/platform_display_init_params.h"
23 #include "mojo/public/cpp/bindings/callback.h" 23 #include "mojo/public/cpp/bindings/callback.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0; 85 virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0;
86 86
87 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; 87 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0;
88 virtual void SetImeVisibility(bool visible) = 0; 88 virtual void SetImeVisibility(bool visible) = 0;
89 89
90 // Returns true if a compositor frame has been submitted but not drawn yet. 90 // Returns true if a compositor frame has been submitted but not drawn yet.
91 virtual bool IsFramePending() const = 0; 91 virtual bool IsFramePending() const = 0;
92 92
93 virtual void RequestCopyOfOutput( 93 virtual void RequestCopyOfOutput(
94 scoped_ptr<cc::CopyOutputRequest> output_request) = 0; 94 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0;
95 95
96 // Overrides factory for testing. Default (NULL) value indicates regular 96 // Overrides factory for testing. Default (NULL) value indicates regular
97 // (non-test) environment. 97 // (non-test) environment.
98 static void set_factory_for_testing(PlatformDisplayFactory* factory) { 98 static void set_factory_for_testing(PlatformDisplayFactory* factory) {
99 PlatformDisplay::factory_ = factory; 99 PlatformDisplay::factory_ = factory;
100 } 100 }
101 101
102 private: 102 private:
103 // Static factory instance (always NULL for non-test). 103 // Static factory instance (always NULL for non-test).
104 static PlatformDisplayFactory* factory_; 104 static PlatformDisplayFactory* factory_;
(...skipping 15 matching lines...) Expand all
120 void SetTitle(const base::string16& title) override; 120 void SetTitle(const base::string16& title) override;
121 void SetCapture() override; 121 void SetCapture() override;
122 void ReleaseCapture() override; 122 void ReleaseCapture() override;
123 void SetCursorById(int32_t cursor) override; 123 void SetCursorById(int32_t cursor) override;
124 const mojom::ViewportMetrics& GetViewportMetrics() override; 124 const mojom::ViewportMetrics& GetViewportMetrics() override;
125 mojom::Rotation GetRotation() override; 125 mojom::Rotation GetRotation() override;
126 void UpdateTextInputState(const ui::TextInputState& state) override; 126 void UpdateTextInputState(const ui::TextInputState& state) override;
127 void SetImeVisibility(bool visible) override; 127 void SetImeVisibility(bool visible) override;
128 bool IsFramePending() const override; 128 bool IsFramePending() const override;
129 void RequestCopyOfOutput( 129 void RequestCopyOfOutput(
130 scoped_ptr<cc::CopyOutputRequest> output_request) override; 130 std::unique_ptr<cc::CopyOutputRequest> output_request) override;
131 131
132 private: 132 private:
133 void WantToDraw(); 133 void WantToDraw();
134 134
135 // This method initiates a top level redraw of the display. 135 // This method initiates a top level redraw of the display.
136 // TODO(fsamuel): This should use vblank as a signal rather than a timer 136 // TODO(fsamuel): This should use vblank as a signal rather than a timer
137 // http://crbug.com/533042 137 // http://crbug.com/533042
138 void Draw(); 138 void Draw();
139 139
140 // This is called after cc::Display has completed generating a new frame 140 // This is called after cc::Display has completed generating a new frame
141 // for the display. TODO(fsamuel): Idle time processing should happen here 141 // for the display. TODO(fsamuel): Idle time processing should happen here
142 // if there is budget for it. 142 // if there is budget for it.
143 void DidDraw(); 143 void DidDraw();
144 void UpdateMetrics(const gfx::Size& size, float device_pixel_ratio); 144 void UpdateMetrics(const gfx::Size& size, float device_pixel_ratio);
145 scoped_ptr<cc::CompositorFrame> GenerateCompositorFrame(); 145 std::unique_ptr<cc::CompositorFrame> GenerateCompositorFrame();
146 146
147 // ui::PlatformWindowDelegate: 147 // ui::PlatformWindowDelegate:
148 void OnBoundsChanged(const gfx::Rect& new_bounds) override; 148 void OnBoundsChanged(const gfx::Rect& new_bounds) override;
149 void OnDamageRect(const gfx::Rect& damaged_region) override; 149 void OnDamageRect(const gfx::Rect& damaged_region) override;
150 void DispatchEvent(ui::Event* event) override; 150 void DispatchEvent(ui::Event* event) override;
151 void OnCloseRequest() override; 151 void OnCloseRequest() override;
152 void OnClosed() override; 152 void OnClosed() override;
153 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; 153 void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
154 void OnLostCapture() override; 154 void OnLostCapture() override;
155 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, 155 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
156 float device_pixel_ratio) override; 156 float device_pixel_ratio) override;
157 void OnAcceleratedWidgetDestroyed() override; 157 void OnAcceleratedWidgetDestroyed() override;
158 void OnActivationChanged(bool active) override; 158 void OnActivationChanged(bool active) override;
159 159
160 shell::Connector* connector_; 160 shell::Connector* connector_;
161 scoped_refptr<GpuState> gpu_state_; 161 scoped_refptr<GpuState> gpu_state_;
162 scoped_refptr<SurfacesState> surfaces_state_; 162 scoped_refptr<SurfacesState> surfaces_state_;
163 PlatformDisplayDelegate* delegate_; 163 PlatformDisplayDelegate* delegate_;
164 164
165 mojom::ViewportMetrics metrics_; 165 mojom::ViewportMetrics metrics_;
166 gfx::Rect dirty_rect_; 166 gfx::Rect dirty_rect_;
167 base::Timer draw_timer_; 167 base::Timer draw_timer_;
168 bool frame_pending_; 168 bool frame_pending_;
169 169
170 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; 170 std::unique_ptr<TopLevelDisplayClient> top_level_display_client_;
171 scoped_ptr<ui::PlatformWindow> platform_window_; 171 std::unique_ptr<ui::PlatformWindow> platform_window_;
172 172
173 #if !defined(OS_ANDROID) 173 #if !defined(OS_ANDROID)
174 scoped_ptr<ui::CursorLoader> cursor_loader_; 174 std::unique_ptr<ui::CursorLoader> cursor_loader_;
175 #endif 175 #endif
176 176
177 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; 177 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_;
178 178
179 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); 179 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay);
180 }; 180 };
181 181
182 } // namespace ws 182 } // namespace ws
183 183
184 } // namespace mus 184 } // namespace mus
185 185
186 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ 186 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
OLDNEW
« no previous file with comments | « components/mus/ws/focus_controller_unittest.cc ('k') | components/mus/ws/platform_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698