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_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 window_->SetParent(NULL); | 268 window_->SetParent(NULL); |
269 Show(); | 269 Show(); |
270 Focus(); | 270 Focus(); |
271 } | 271 } |
272 | 272 |
273 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 273 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
274 return host_; | 274 return host_; |
275 } | 275 } |
276 | 276 |
277 void RenderWidgetHostViewAura::WasShown() { | 277 void RenderWidgetHostViewAura::WasShown() { |
278 if (!host_->IsHidden()) | 278 if (!host_->is_hidden()) |
279 return; | 279 return; |
280 host_->WasShown(); | 280 host_->WasShown(); |
281 | 281 |
282 if (!current_surface_ && host_->is_accelerated_compositing_active() && | 282 if (!current_surface_ && host_->is_accelerated_compositing_active() && |
283 !released_front_lock_.get()) { | 283 !released_front_lock_.get()) { |
284 released_front_lock_ = window_->GetRootWindow()->GetCompositorLock(); | 284 released_front_lock_ = window_->GetRootWindow()->GetCompositorLock(); |
285 } | 285 } |
286 | 286 |
287 AdjustSurfaceProtection(); | 287 AdjustSurfaceProtection(); |
288 } | 288 } |
289 | 289 |
290 void RenderWidgetHostViewAura::WasHidden() { | 290 void RenderWidgetHostViewAura::WasHidden() { |
291 if (host_->IsHidden()) | 291 if (host_->is_hidden()) |
292 return; | 292 return; |
293 host_->WasHidden(); | 293 host_->WasHidden(); |
294 | 294 |
295 released_front_lock_ = NULL; | 295 released_front_lock_ = NULL; |
296 | 296 |
297 if (ShouldReleaseFrontSurface() && | 297 if (ShouldReleaseFrontSurface() && |
298 host_->is_accelerated_compositing_active()) { | 298 host_->is_accelerated_compositing_active()) { |
299 current_surface_ = 0; | 299 current_surface_ = 0; |
300 UpdateExternalTexture(); | 300 UpdateExternalTexture(); |
301 } | 301 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 resize_locks_.clear(); | 608 resize_locks_.clear(); |
609 } | 609 } |
610 } | 610 } |
611 | 611 |
612 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 612 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
613 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 613 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
614 int gpu_host_id) { | 614 int gpu_host_id) { |
615 surface_route_id_ = params_in_pixel.route_id; | 615 surface_route_id_ = params_in_pixel.route_id; |
616 // If protection state changed, then this swap is stale. We must still ACK but | 616 // If protection state changed, then this swap is stale. We must still ACK but |
617 // do not update current_surface_ since it may have been discarded. | 617 // do not update current_surface_ since it may have been discarded. |
618 if (host_->IsHidden() || | 618 if (host_->is_hidden() || |
619 (params_in_pixel.protection_state_id && | 619 (params_in_pixel.protection_state_id && |
620 params_in_pixel.protection_state_id != protection_state_id_)) { | 620 params_in_pixel.protection_state_id != protection_state_id_)) { |
621 DCHECK(!current_surface_); | 621 DCHECK(!current_surface_); |
622 if (!params_in_pixel.skip_ack) | 622 if (!params_in_pixel.skip_ack) |
623 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL); | 623 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL); |
624 return; | 624 return; |
625 } | 625 } |
626 current_surface_ = params_in_pixel.surface_handle; | 626 current_surface_ = params_in_pixel.surface_handle; |
627 // If we don't require an ACK that means the content is not a fresh updated | 627 // If we don't require an ACK that means the content is not a fresh updated |
628 // new frame, rather we are just resetting our handle to some old content that | 628 // new frame, rather we are just resetting our handle to some old content that |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 679 } |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
683 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( | 683 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
684 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 684 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
685 int gpu_host_id) { | 685 int gpu_host_id) { |
686 surface_route_id_ = params_in_pixel.route_id; | 686 surface_route_id_ = params_in_pixel.route_id; |
687 // If visible state changed, then this PSB is stale. We must still ACK but | 687 // If visible state changed, then this PSB is stale. We must still ACK but |
688 // do not update current_surface_. | 688 // do not update current_surface_. |
689 if (host_->IsHidden() || | 689 if (host_->is_hidden() || |
690 (params_in_pixel.protection_state_id && | 690 (params_in_pixel.protection_state_id && |
691 params_in_pixel.protection_state_id != protection_state_id_)) { | 691 params_in_pixel.protection_state_id != protection_state_id_)) { |
692 DCHECK(!current_surface_); | 692 DCHECK(!current_surface_); |
693 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL); | 693 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL); |
694 return; | 694 return; |
695 } | 695 } |
696 current_surface_ = params_in_pixel.surface_handle; | 696 current_surface_ = params_in_pixel.surface_handle; |
697 released_front_lock_ = NULL; | 697 released_front_lock_ = NULL; |
698 DCHECK(current_surface_); | 698 DCHECK(current_surface_); |
699 UpdateExternalTexture(); | 699 UpdateExternalTexture(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 DCHECK(image_transport_clients_.find(surface_handle) != | 788 DCHECK(image_transport_clients_.find(surface_handle) != |
789 image_transport_clients_.end()); | 789 image_transport_clients_.end()); |
790 if (current_surface_ == surface_handle) { | 790 if (current_surface_ == surface_handle) { |
791 current_surface_ = 0; | 791 current_surface_ = 0; |
792 UpdateExternalTexture(); | 792 UpdateExternalTexture(); |
793 } | 793 } |
794 image_transport_clients_.erase(surface_handle); | 794 image_transport_clients_.erase(surface_handle); |
795 } | 795 } |
796 | 796 |
797 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(ui::Compositor*) { | 797 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(ui::Compositor*) { |
798 if (current_surface_ || !host_->IsHidden()) | 798 if (current_surface_ || !host_->is_hidden()) |
799 return; | 799 return; |
800 current_surface_in_use_by_compositor_ = false; | 800 current_surface_in_use_by_compositor_ = false; |
801 AdjustSurfaceProtection(); | 801 AdjustSurfaceProtection(); |
802 } | 802 } |
803 | 803 |
804 void RenderWidgetHostViewAura::AdjustSurfaceProtection() { | 804 void RenderWidgetHostViewAura::AdjustSurfaceProtection() { |
805 // If the current surface is non null, it is protected. | 805 // If the current surface is non null, it is protected. |
806 // If we are visible, it is protected. | 806 // If we are visible, it is protected. |
807 // Otherwise, change to not proctected once done thumbnailing and compositing. | 807 // Otherwise, change to not proctected once done thumbnailing and compositing. |
808 bool surface_is_protected = | 808 bool surface_is_protected = |
809 current_surface_ || | 809 current_surface_ || |
810 !host_->IsHidden() || | 810 !host_->is_hidden() || |
811 (current_surface_is_protected_ && | 811 (current_surface_is_protected_ && |
812 (!pending_thumbnail_tasks_.empty() || | 812 (!pending_thumbnail_tasks_.empty() || |
813 current_surface_in_use_by_compositor_)); | 813 current_surface_in_use_by_compositor_)); |
814 if (current_surface_is_protected_ == surface_is_protected) | 814 if (current_surface_is_protected_ == surface_is_protected) |
815 return; | 815 return; |
816 current_surface_is_protected_ = surface_is_protected; | 816 current_surface_is_protected_ = surface_is_protected; |
817 ++protection_state_id_; | 817 ++protection_state_id_; |
818 | 818 |
819 if (!surface_route_id_ || !shared_surface_handle_.parent_gpu_process_id) | 819 if (!surface_route_id_ || !shared_surface_handle_.parent_gpu_process_id) |
820 return; | 820 return; |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 RenderWidgetHost* widget) { | 1654 RenderWidgetHost* widget) { |
1655 return new RenderWidgetHostViewAura(widget); | 1655 return new RenderWidgetHostViewAura(widget); |
1656 } | 1656 } |
1657 | 1657 |
1658 // static | 1658 // static |
1659 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1659 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1660 GetScreenInfoForWindow(results, NULL); | 1660 GetScreenInfoForWindow(results, NULL); |
1661 } | 1661 } |
1662 | 1662 |
1663 } // namespace content | 1663 } // namespace content |
OLD | NEW |