OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int routing_id) | 113 int routing_id) |
114 : view_(NULL), | 114 : view_(NULL), |
115 renderer_initialized_(false), | 115 renderer_initialized_(false), |
116 hung_renderer_delay_ms_(kHungRendererDelayMs), | 116 hung_renderer_delay_ms_(kHungRendererDelayMs), |
117 process_(process), | 117 process_(process), |
118 routing_id_(routing_id), | 118 routing_id_(routing_id), |
119 renderer_accessible_(false), | 119 renderer_accessible_(false), |
120 surface_id_(0), | 120 surface_id_(0), |
121 is_loading_(false), | 121 is_loading_(false), |
122 is_hidden_(false), | 122 is_hidden_(false), |
| 123 is_fullscreen_(false), |
123 is_accelerated_compositing_active_(false), | 124 is_accelerated_compositing_active_(false), |
124 repaint_ack_pending_(false), | 125 repaint_ack_pending_(false), |
125 resize_ack_pending_(false), | 126 resize_ack_pending_(false), |
126 should_auto_resize_(false), | 127 should_auto_resize_(false), |
127 mouse_move_pending_(false), | 128 mouse_move_pending_(false), |
128 mouse_wheel_pending_(false), | 129 mouse_wheel_pending_(false), |
129 needs_repainting_on_restore_(false), | 130 needs_repainting_on_restore_(false), |
130 is_unresponsive_(false), | 131 is_unresponsive_(false), |
131 in_flight_event_count_(0), | 132 in_flight_event_count_(0), |
132 in_get_backing_store_(false), | 133 in_get_backing_store_(false), |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 gfx::Rect view_bounds = view_->GetViewBounds(); | 419 gfx::Rect view_bounds = view_->GetViewBounds(); |
419 #else | 420 #else |
420 // When UI scaling is enabled on OS X, allocate a smaller bitmap and | 421 // When UI scaling is enabled on OS X, allocate a smaller bitmap and |
421 // pixel-scale it up. | 422 // pixel-scale it up. |
422 // TODO(thakis): Use pixel size on mac and set UI scale in renderer. | 423 // TODO(thakis): Use pixel size on mac and set UI scale in renderer. |
423 // http://crbug.com/31960 | 424 // http://crbug.com/31960 |
424 gfx::Rect view_bounds(view_->GetViewCocoaBounds().size()); | 425 gfx::Rect view_bounds(view_->GetViewCocoaBounds().size()); |
425 #endif | 426 #endif |
426 gfx::Size new_size(view_bounds.size()); | 427 gfx::Size new_size(view_bounds.size()); |
427 | 428 |
| 429 bool was_fullscreen = is_fullscreen_; |
| 430 is_fullscreen_ = IsFullscreen(); |
| 431 bool fullscreen_changed = was_fullscreen != is_fullscreen_; |
| 432 bool size_changed = new_size != current_size_; |
| 433 |
428 // Avoid asking the RenderWidget to resize to its current size, since it | 434 // Avoid asking the RenderWidget to resize to its current size, since it |
429 // won't send us a PaintRect message in that case. | 435 // won't send us a PaintRect message in that case. |
430 if (new_size == current_size_) | 436 if (!size_changed && !fullscreen_changed) |
431 return; | 437 return; |
432 | 438 |
433 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_) { | 439 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && |
| 440 !fullscreen_changed) |
434 return; | 441 return; |
435 } | |
436 | 442 |
437 // We don't expect to receive an ACK when the requested size is empty. | 443 // We don't expect to receive an ACK when the requested size is empty. |
438 if (!new_size.IsEmpty()) | 444 if (!new_size.IsEmpty() && size_changed) |
439 resize_ack_pending_ = true; | 445 resize_ack_pending_ = true; |
440 | 446 |
441 if (!Send(new ViewMsg_Resize(routing_id_, new_size, | 447 if (!Send(new ViewMsg_Resize(routing_id_, new_size, |
442 GetRootWindowResizerRect(), IsFullscreen()))) { | 448 GetRootWindowResizerRect(), is_fullscreen_))) { |
443 resize_ack_pending_ = false; | 449 resize_ack_pending_ = false; |
444 } else { | 450 } else { |
445 in_flight_size_ = new_size; | 451 in_flight_size_ = new_size; |
446 } | 452 } |
447 } | 453 } |
448 | 454 |
449 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { | 455 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { |
450 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); | 456 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); |
451 } | 457 } |
452 | 458 |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 | 1676 |
1671 // static | 1677 // static |
1672 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1678 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
1673 int gpu_host_id) { | 1679 int gpu_host_id) { |
1674 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1680 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1675 if (ui_shim) | 1681 if (ui_shim) |
1676 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1682 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1677 } | 1683 } |
1678 | 1684 |
1679 } // namespace content | 1685 } // namespace content |
OLD | NEW |