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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 uint64 surface_handle) { | 940 uint64 surface_handle) { |
941 DCHECK(image_transport_clients_.find(surface_handle) != | 941 DCHECK(image_transport_clients_.find(surface_handle) != |
942 image_transport_clients_.end()); | 942 image_transport_clients_.end()); |
943 if (current_surface_ == surface_handle) { | 943 if (current_surface_ == surface_handle) { |
944 current_surface_ = 0; | 944 current_surface_ = 0; |
945 UpdateExternalTexture(); | 945 UpdateExternalTexture(); |
946 } | 946 } |
947 image_transport_clients_.erase(surface_handle); | 947 image_transport_clients_.erase(surface_handle); |
948 } | 948 } |
949 | 949 |
| 950 void RenderWidgetHostViewAura::SwapCompositorFrame( |
| 951 const cc::CompositorFrame& frame) { |
| 952 ui::Compositor* compositor = GetCompositor(); |
| 953 if (!compositor) { |
| 954 SwapCompositorFrameAck(frame.resources, NULL); |
| 955 } else { |
| 956 released_front_lock_ = NULL; |
| 957 gfx::Size surface_size = ConvertSizeToDIP(this, frame.size); |
| 958 |
| 959 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
| 960 resize_locks_.clear(); // XXX |
| 961 window_->layer()->SetCompositorFrame(frame); |
| 962 |
| 963 on_compositing_did_commit_callbacks_.push_back( |
| 964 base::Bind(&RenderWidgetHostViewAura::SendSwapCompositorFrameAck, |
| 965 base::Unretained(this))); |
| 966 if (!compositor->HasObserver(this)) |
| 967 compositor->AddObserver(this); |
| 968 } |
| 969 } |
| 970 |
| 971 void RenderWidgetHostViewAura::SendSwapCompositorFrameAck(ui::Compositor*) { |
| 972 cc::TransferableResourceList resources; |
| 973 resources.sync_point = 0; |
| 974 window_->layer()->GetRecycledResources(&resources); |
| 975 SwapCompositorFrameAck(resources, NULL); |
| 976 } |
| 977 |
| 978 void RenderWidgetHostViewAura::SwapCompositorFrameAck(const cc::TransferableReso
urceList& resources, ui::Compositor*) { |
| 979 cc::CompositorFrameAck ack; |
| 980 ack.resources = resources; |
| 981 host_->SwapCompositorFrameAck(ack); |
| 982 } |
| 983 |
950 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(ui::Compositor*) { | 984 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(ui::Compositor*) { |
951 if (current_surface_ || !host_->is_hidden()) | 985 if (current_surface_ || !host_->is_hidden()) |
952 return; | 986 return; |
953 current_surface_in_use_by_compositor_ = false; | 987 current_surface_in_use_by_compositor_ = false; |
954 AdjustSurfaceProtection(); | 988 AdjustSurfaceProtection(); |
955 } | 989 } |
956 | 990 |
957 void RenderWidgetHostViewAura::AdjustSurfaceProtection() { | 991 void RenderWidgetHostViewAura::AdjustSurfaceProtection() { |
958 // If the current surface is non null, it is protected. | 992 // If the current surface is non null, it is protected. |
959 // If we are visible, it is protected. | 993 // If we are visible, it is protected. |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 RenderWidgetHost* widget) { | 1908 RenderWidgetHost* widget) { |
1875 return new RenderWidgetHostViewAura(widget); | 1909 return new RenderWidgetHostViewAura(widget); |
1876 } | 1910 } |
1877 | 1911 |
1878 // static | 1912 // static |
1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1913 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1880 GetScreenInfoForWindow(results, NULL); | 1914 GetScreenInfoForWindow(results, NULL); |
1881 } | 1915 } |
1882 | 1916 |
1883 } // namespace content | 1917 } // namespace content |
OLD | NEW |