Chromium Code Reviews| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); | 216 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); |
| 217 gfx::Transform target_transform; | 217 gfx::Transform target_transform; |
| 218 cc::SurfaceId target_surface_id = | 218 cc::SurfaceId target_surface_id = |
| 219 hittest.GetTargetSurfaceAtPoint(surface_id_, point, &target_transform); | 219 hittest.GetTargetSurfaceAtPoint(surface_id_, point, &target_transform); |
| 220 *transformed_point = point; | 220 *transformed_point = point; |
| 221 if (!target_surface_id.is_null()) | 221 if (!target_surface_id.is_null()) |
| 222 target_transform.TransformPoint(transformed_point); | 222 target_transform.TransformPoint(transformed_point); |
| 223 return target_surface_id; | 223 return target_surface_id; |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DelegatedFrameHost::TransformPointToLocalCoordSpace( | 226 gfx::Point DelegatedFrameHost::TransformPointToLocalCoordSpace( |
| 227 const gfx::Point& point, | 227 const gfx::Point& point, |
| 228 const cc::SurfaceId& original_surface, | 228 const cc::SurfaceId& original_surface) { |
| 229 gfx::Point* transformed_point) { | |
| 230 *transformed_point = point; | |
| 231 if (surface_id_.is_null() || original_surface == surface_id_) | 229 if (surface_id_.is_null() || original_surface == surface_id_) |
| 232 return; | 230 return point; |
| 233 | 231 |
| 234 gfx::Transform transform; | 232 gfx::Point transformed_point = point; |
| 235 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); | 233 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); |
| 236 if (hittest.GetTransformToTargetSurface(surface_id_, original_surface, | 234 if (!hittest.TransformPointToTargetSurface(original_surface, surface_id_, |
| 237 &transform) && | 235 &transformed_point)) |
| 238 transform.GetInverse(&transform)) { | 236 DCHECK(false); |
|
nasko
2016/07/29 14:19:46
This DCHECK is hitting in an OOPIF fullscreen test
kenrb
2016/07/29 16:20:22
This is annoying, but I think the best thing is to
| |
| 239 transform.TransformPoint(transformed_point); | 237 return transformed_point; |
| 240 } | 238 } |
| 239 | |
| 240 gfx::Point DelegatedFrameHost::TransformPointToCoordSpaceForView( | |
| 241 const gfx::Point& point, | |
| 242 RenderWidgetHostViewBase* target_view) { | |
| 243 if (surface_id_.is_null()) | |
| 244 return point; | |
| 245 | |
| 246 return target_view->TransformPointToLocalCoordSpace(point, surface_id_); | |
| 241 } | 247 } |
| 242 | 248 |
| 243 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { | 249 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { |
| 244 // Should skip a frame only when another frame from the renderer is guaranteed | 250 // Should skip a frame only when another frame from the renderer is guaranteed |
| 245 // to replace it. Otherwise may cause hangs when the renderer is waiting for | 251 // to replace it. Otherwise may cause hangs when the renderer is waiting for |
| 246 // the completion of latency infos (such as when taking a Snapshot.) | 252 // the completion of latency infos (such as when taking a Snapshot.) |
| 247 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 253 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
| 248 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) | 254 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) |
| 249 return false; | 255 return false; |
| 250 | 256 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 900 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 906 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 901 new_layer->SetShowSurface( | 907 new_layer->SetShowSurface( |
| 902 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 908 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 903 base::Bind(&RequireCallback, base::Unretained(manager)), | 909 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 904 current_surface_size_, current_scale_factor_, | 910 current_surface_size_, current_scale_factor_, |
| 905 current_frame_size_in_dip_); | 911 current_frame_size_in_dip_); |
| 906 } | 912 } |
| 907 } | 913 } |
| 908 | 914 |
| 909 } // namespace content | 915 } // namespace content |
| OLD | NEW |