| 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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( | 937 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( |
| 938 uint32_t output_surface_id) { | 938 uint32_t output_surface_id) { |
| 939 DCHECK(host_); | 939 DCHECK(host_); |
| 940 cc::CompositorFrameAck ack; | 940 cc::CompositorFrameAck ack; |
| 941 if (!surface_returned_resources_.empty()) | 941 if (!surface_returned_resources_.empty()) |
| 942 ack.resources.swap(surface_returned_resources_); | 942 ack.resources.swap(surface_returned_resources_); |
| 943 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), | 943 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), |
| 944 output_surface_id, ack)); | 944 output_surface_id, ack)); |
| 945 } | 945 } |
| 946 | 946 |
| 947 void RenderWidgetHostViewAndroid::SendReturnedDelegatedResources( | |
| 948 uint32_t output_surface_id) { | |
| 949 DCHECK(host_); | |
| 950 cc::CompositorFrameAck ack; | |
| 951 DCHECK(!surface_returned_resources_.empty()); | |
| 952 ack.resources.swap(surface_returned_resources_); | |
| 953 | |
| 954 host_->Send(new ViewMsg_ReclaimCompositorResources(host_->GetRoutingID(), | |
| 955 output_surface_id, ack)); | |
| 956 } | |
| 957 | |
| 958 void RenderWidgetHostViewAndroid::ReturnResources( | 947 void RenderWidgetHostViewAndroid::ReturnResources( |
| 959 const cc::ReturnedResourceArray& resources) { | 948 const cc::ReturnedResourceArray& resources) { |
| 960 if (resources.empty()) | 949 if (resources.empty()) |
| 961 return; | 950 return; |
| 962 std::copy(resources.begin(), resources.end(), | 951 std::copy(resources.begin(), resources.end(), |
| 963 std::back_inserter(surface_returned_resources_)); | 952 std::back_inserter(surface_returned_resources_)); |
| 964 if (ack_callbacks_.empty()) | 953 if (ack_callbacks_.empty()) |
| 965 SendReturnedDelegatedResources(last_output_surface_id_); | 954 SendDelegatedFrameAck(last_output_surface_id_); |
| 966 } | 955 } |
| 967 | 956 |
| 968 void RenderWidgetHostViewAndroid::SetBeginFrameSource( | 957 void RenderWidgetHostViewAndroid::SetBeginFrameSource( |
| 969 cc::BeginFrameSource* begin_frame_source) { | 958 cc::BeginFrameSource* begin_frame_source) { |
| 970 // TODO(tansell): Hook this up. | 959 // TODO(tansell): Hook this up. |
| 971 } | 960 } |
| 972 | 961 |
| 973 void RenderWidgetHostViewAndroid::DestroyDelegatedContent() { | 962 void RenderWidgetHostViewAndroid::DestroyDelegatedContent() { |
| 974 RemoveLayers(); | 963 RemoveLayers(); |
| 975 if (!surface_id_.is_null()) { | 964 if (!surface_id_.is_null()) { |
| 976 DCHECK(surface_factory_.get()); | 965 DCHECK(surface_factory_.get()); |
| 977 surface_factory_->Destroy(surface_id_); | 966 surface_factory_->Destroy(surface_id_); |
| 978 surface_id_ = cc::SurfaceId(); | 967 surface_id_ = cc::SurfaceId(); |
| 979 } | 968 } |
| 980 view_.SetLayer(nullptr); | 969 view_.SetLayer(nullptr); |
| 981 } | 970 } |
| 982 | 971 |
| 983 void RenderWidgetHostViewAndroid::CheckOutputSurfaceChanged( | 972 void RenderWidgetHostViewAndroid::CheckOutputSurfaceChanged( |
| 984 uint32_t output_surface_id) { | 973 uint32_t output_surface_id) { |
| 985 if (output_surface_id == last_output_surface_id_) | 974 if (output_surface_id == last_output_surface_id_) |
| 986 return; | 975 return; |
| 987 DestroyDelegatedContent(); | 976 DestroyDelegatedContent(); |
| 988 surface_factory_.reset(); | 977 surface_factory_.reset(); |
| 989 if (!surface_returned_resources_.empty()) | 978 if (!surface_returned_resources_.empty()) |
| 990 SendReturnedDelegatedResources(last_output_surface_id_); | 979 SendDelegatedFrameAck(last_output_surface_id_); |
| 991 | 980 |
| 992 last_output_surface_id_ = output_surface_id; | 981 last_output_surface_id_ = output_surface_id; |
| 993 } | 982 } |
| 994 | 983 |
| 995 void RenderWidgetHostViewAndroid::SubmitCompositorFrame( | 984 void RenderWidgetHostViewAndroid::SubmitCompositorFrame( |
| 996 cc::CompositorFrame frame) { | 985 cc::CompositorFrame frame) { |
| 997 cc::SurfaceManager* manager = CompositorImpl::GetSurfaceManager(); | 986 cc::SurfaceManager* manager = CompositorImpl::GetSurfaceManager(); |
| 998 if (!surface_factory_) { | 987 if (!surface_factory_) { |
| 999 surface_factory_ = base::WrapUnique(new cc::SurfaceFactory(manager, this)); | 988 surface_factory_ = base::WrapUnique(new cc::SurfaceFactory(manager, this)); |
| 1000 } | 989 } |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 case ui::MotionEvent::ACTION_UP: | 1982 case ui::MotionEvent::ACTION_UP: |
| 1994 case ui::MotionEvent::ACTION_POINTER_UP: | 1983 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1995 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1984 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1996 delta.InMicroseconds(), 1, 1000000, 50); | 1985 delta.InMicroseconds(), 1, 1000000, 50); |
| 1997 default: | 1986 default: |
| 1998 return; | 1987 return; |
| 1999 } | 1988 } |
| 2000 } | 1989 } |
| 2001 | 1990 |
| 2002 } // namespace content | 1991 } // namespace content |
| OLD | NEW |