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

Side by Side Diff: services/ui/ws/platform_display.cc

Issue 2474113002: Mus+Ash: Unified BeginFrame Skeleton (Closed)
Patch Set: Rebase Created 4 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
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/server_window.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 #include "services/ui/ws/platform_display.h" 5 #include "services/ui/ws/platform_display.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "cc/ipc/quads.mojom.h" 9 #include "cc/ipc/quads.mojom.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Don't notify the delegate from the destructor. 94 // Don't notify the delegate from the destructor.
95 delegate_ = nullptr; 95 delegate_ = nullptr;
96 96
97 frame_generator_.reset(); 97 frame_generator_.reset();
98 // Destroy the PlatformWindow early on as it may call us back during 98 // Destroy the PlatformWindow early on as it may call us back during
99 // destruction and we want to be in a known state. But destroy the surface 99 // destruction and we want to be in a known state. But destroy the surface
100 // first because it can still be using the platform window. 100 // first because it can still be using the platform window.
101 platform_window_.reset(); 101 platform_window_.reset();
102 } 102 }
103 103
104 void DefaultPlatformDisplay::SchedulePaint(const ServerWindow* window,
105 const gfx::Rect& bounds) {
106 DCHECK(window);
107 if (!window->IsDrawn())
108 return;
109 const gfx::Rect root_relative_rect =
110 ConvertRectBetweenWindows(window, delegate_->GetRootWindow(), bounds);
111 if (root_relative_rect.IsEmpty())
112 return;
113 frame_generator_->RequestRedraw(root_relative_rect);
114 }
115
116 void DefaultPlatformDisplay::SetViewportSize(const gfx::Size& size) { 104 void DefaultPlatformDisplay::SetViewportSize(const gfx::Size& size) {
117 platform_window_->SetBounds(gfx::Rect(size)); 105 platform_window_->SetBounds(gfx::Rect(size));
118 } 106 }
119 107
120 void DefaultPlatformDisplay::SetTitle(const base::string16& title) { 108 void DefaultPlatformDisplay::SetTitle(const base::string16& title) {
121 platform_window_->SetTitle(title); 109 platform_window_->SetTitle(title);
122 } 110 }
123 111
124 void DefaultPlatformDisplay::SetCapture() { 112 void DefaultPlatformDisplay::SetCapture() {
125 platform_window_->SetCapture(); 113 platform_window_->SetCapture();
(...skipping 22 matching lines...) Expand all
148 if (ime) 136 if (ime)
149 ime->UpdateTextInputState(state); 137 ime->UpdateTextInputState(state);
150 } 138 }
151 139
152 void DefaultPlatformDisplay::SetImeVisibility(bool visible) { 140 void DefaultPlatformDisplay::SetImeVisibility(bool visible) {
153 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); 141 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
154 if (ime) 142 if (ime)
155 ime->SetImeVisibility(visible); 143 ime->SetImeVisibility(visible);
156 } 144 }
157 145
158 bool DefaultPlatformDisplay::IsFramePending() const {
159 return frame_generator_->is_frame_pending();
160 }
161
162 gfx::Rect DefaultPlatformDisplay::GetBounds() const { 146 gfx::Rect DefaultPlatformDisplay::GetBounds() const {
163 return metrics_.bounds; 147 return metrics_.bounds;
164 } 148 }
165 149
166 bool DefaultPlatformDisplay::IsPrimaryDisplay() const { 150 bool DefaultPlatformDisplay::IsPrimaryDisplay() const {
167 return display::PlatformScreen::GetInstance()->GetPrimaryDisplayId() == id_; 151 return display::PlatformScreen::GetInstance()->GetPrimaryDisplayId() == id_;
168 } 152 }
169 153
170 void DefaultPlatformDisplay::OnGpuChannelEstablished( 154 void DefaultPlatformDisplay::OnGpuChannelEstablished(
171 scoped_refptr<gpu::GpuChannelHost> channel) { 155 scoped_refptr<gpu::GpuChannelHost> channel) {
(...skipping 30 matching lines...) Expand all
202 // We only care if the window size has changed. 186 // We only care if the window size has changed.
203 if (new_bounds.size() == metrics_.pixel_size) 187 if (new_bounds.size() == metrics_.pixel_size)
204 return; 188 return;
205 189
206 // TODO(kylechar): Maybe do something here. For CrOS we don't need to support 190 // TODO(kylechar): Maybe do something here. For CrOS we don't need to support
207 // PlatformWindow initiated resizes. For other platforms we need to do 191 // PlatformWindow initiated resizes. For other platforms we need to do
208 // something but that isn't fully flushed out. 192 // something but that isn't fully flushed out.
209 } 193 }
210 194
211 void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) { 195 void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
212 frame_generator_->RequestRedraw(damaged_region);
213 } 196 }
214 197
215 void DefaultPlatformDisplay::DispatchEvent(ui::Event* event) { 198 void DefaultPlatformDisplay::DispatchEvent(ui::Event* event) {
216 if (event->IsLocatedEvent()) 199 if (event->IsLocatedEvent())
217 UpdateEventRootLocation(event->AsLocatedEvent()); 200 UpdateEventRootLocation(event->AsLocatedEvent());
218 201
219 if (event->IsScrollEvent()) { 202 if (event->IsScrollEvent()) {
220 // TODO(moshayedi): crbug.com/602859. Dispatch scroll events as 203 // TODO(moshayedi): crbug.com/602859. Dispatch scroll events as
221 // they are once we have proper support for scroll events. 204 // they are once we have proper support for scroll events.
222 delegate_->OnEvent( 205 delegate_->OnEvent(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 264
282 void DefaultPlatformDisplay::OnActivationChanged(bool active) {} 265 void DefaultPlatformDisplay::OnActivationChanged(bool active) {}
283 266
284 bool DefaultPlatformDisplay::IsInHighContrastMode() { 267 bool DefaultPlatformDisplay::IsInHighContrastMode() {
285 return delegate_ ? delegate_->IsInHighContrastMode() : false; 268 return delegate_ ? delegate_->IsInHighContrastMode() : false;
286 } 269 }
287 270
288 } // namespace ws 271 } // namespace ws
289 272
290 } // namespace ui 273 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/server_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698