| OLD | NEW |
| 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 "content/browser/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); | 221 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); |
| 222 gfx::Transform target_transform; | 222 gfx::Transform target_transform; |
| 223 cc::SurfaceId target_local_frame_id = | 223 cc::SurfaceId target_local_frame_id = |
| 224 hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform); | 224 hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform); |
| 225 *transformed_point = point; | 225 *transformed_point = point; |
| 226 if (!target_local_frame_id.is_null()) | 226 if (!target_local_frame_id.is_null()) |
| 227 target_transform.TransformPoint(transformed_point); | 227 target_transform.TransformPoint(transformed_point); |
| 228 return target_local_frame_id; | 228 return target_local_frame_id; |
| 229 } | 229 } |
| 230 | 230 |
| 231 gfx::Point DelegatedFrameHost::TransformPointToLocalCoordSpace( | 231 bool DelegatedFrameHost::TransformPointToLocalCoordSpace( |
| 232 const gfx::Point& point, | 232 const gfx::Point& point, |
| 233 const cc::SurfaceId& original_surface) { | 233 const cc::SurfaceId& original_surface, |
| 234 gfx::Point* transformed_point) { |
| 234 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 235 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
| 235 if (surface_id.is_null() || original_surface == surface_id) | 236 if (surface_id.is_null()) |
| 236 return point; | 237 return false; |
| 238 *transformed_point = point; |
| 239 if (original_surface == surface_id) |
| 240 return true; |
| 237 | 241 |
| 238 gfx::Point transformed_point = point; | |
| 239 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); | 242 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); |
| 240 hittest.TransformPointToTargetSurface(original_surface, surface_id, | 243 return hittest.TransformPointToTargetSurface(original_surface, surface_id, |
| 241 &transformed_point); | 244 transformed_point); |
| 242 return transformed_point; | |
| 243 } | 245 } |
| 244 | 246 |
| 245 gfx::Point DelegatedFrameHost::TransformPointToCoordSpaceForView( | 247 bool DelegatedFrameHost::TransformPointToCoordSpaceForView( |
| 246 const gfx::Point& point, | 248 const gfx::Point& point, |
| 247 RenderWidgetHostViewBase* target_view) { | 249 RenderWidgetHostViewBase* target_view, |
| 250 gfx::Point* transformed_point) { |
| 248 if (local_frame_id_.is_null()) | 251 if (local_frame_id_.is_null()) |
| 249 return point; | 252 return false; |
| 250 | 253 |
| 251 return target_view->TransformPointToLocalCoordSpace( | 254 return target_view->TransformPointToLocalCoordSpace( |
| 252 point, cc::SurfaceId(frame_sink_id_, local_frame_id_)); | 255 point, cc::SurfaceId(frame_sink_id_, local_frame_id_), transformed_point); |
| 253 } | 256 } |
| 254 | 257 |
| 255 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { | 258 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { |
| 256 // Should skip a frame only when another frame from the renderer is guaranteed | 259 // Should skip a frame only when another frame from the renderer is guaranteed |
| 257 // to replace it. Otherwise may cause hangs when the renderer is waiting for | 260 // to replace it. Otherwise may cause hangs when the renderer is waiting for |
| 258 // the completion of latency infos (such as when taking a Snapshot.) | 261 // the completion of latency infos (such as when taking a Snapshot.) |
| 259 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 262 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
| 260 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) | 263 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) |
| 261 return false; | 264 return false; |
| 262 | 265 |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 new_layer->SetShowSurface( | 910 new_layer->SetShowSurface( |
| 908 cc::SurfaceId(frame_sink_id_, local_frame_id_), | 911 cc::SurfaceId(frame_sink_id_, local_frame_id_), |
| 909 base::Bind(&SatisfyCallback, base::Unretained(manager)), | 912 base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 910 base::Bind(&RequireCallback, base::Unretained(manager)), | 913 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 911 current_surface_size_, current_scale_factor_, | 914 current_surface_size_, current_scale_factor_, |
| 912 current_frame_size_in_dip_); | 915 current_frame_size_in_dip_); |
| 913 } | 916 } |
| 914 } | 917 } |
| 915 | 918 |
| 916 } // namespace content | 919 } // namespace content |
| OLD | NEW |