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/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
11 #include "cc/output/compositor_frame_ack.h" | 11 #include "cc/output/compositor_frame_ack.h" |
12 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
13 #include "cc/resources/single_release_callback.h" | 13 #include "cc/resources/single_release_callback.h" |
14 #include "cc/resources/texture_mailbox.h" | 14 #include "cc/resources/texture_mailbox.h" |
15 #include "cc/surfaces/surface.h" | 15 #include "cc/surfaces/surface.h" |
16 #include "cc/surfaces/surface_factory.h" | 16 #include "cc/surfaces/surface_factory.h" |
| 17 #include "cc/surfaces/surface_hittest.h" |
17 #include "cc/surfaces/surface_manager.h" | 18 #include "cc/surfaces/surface_manager.h" |
18 #include "content/browser/compositor/resize_lock.h" | 19 #include "content/browser/compositor/resize_lock.h" |
| 20 #include "content/browser/compositor/surface_utils.h" |
19 #include "content/browser/gpu/compositor_util.h" | 21 #include "content/browser/gpu/compositor_util.h" |
20 #include "content/common/gpu/client/gl_helper.h" | 22 #include "content/common/gpu/client/gl_helper.h" |
21 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 23 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
22 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
23 #include "media/base/video_frame.h" | 25 #include "media/base/video_frame.h" |
24 #include "media/base/video_util.h" | 26 #include "media/base/video_util.h" |
25 #include "skia/ext/image_operations.h" | 27 #include "skia/ext/image_operations.h" |
26 #include "third_party/skia/include/core/SkCanvas.h" | 28 #include "third_party/skia/include/core/SkCanvas.h" |
27 #include "third_party/skia/include/core/SkPaint.h" | 29 #include "third_party/skia/include/core/SkPaint.h" |
28 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 30 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 frame_subscriber_.reset(); | 198 frame_subscriber_.reset(); |
197 } | 199 } |
198 | 200 |
199 uint32_t DelegatedFrameHost::GetSurfaceIdNamespace() { | 201 uint32_t DelegatedFrameHost::GetSurfaceIdNamespace() { |
200 if (!use_surfaces_) | 202 if (!use_surfaces_) |
201 return 0; | 203 return 0; |
202 | 204 |
203 return id_allocator_->id_namespace(); | 205 return id_allocator_->id_namespace(); |
204 } | 206 } |
205 | 207 |
| 208 cc::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint( |
| 209 const gfx::Point& point, |
| 210 gfx::Point* transformed_point) { |
| 211 cc::SurfaceHittest hittest(GetSurfaceManager()); |
| 212 return hittest.Hittest(surface_id_, point, transformed_point); |
| 213 } |
| 214 |
206 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { | 215 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { |
207 // Should skip a frame only when another frame from the renderer is guaranteed | 216 // Should skip a frame only when another frame from the renderer is guaranteed |
208 // to replace it. Otherwise may cause hangs when the renderer is waiting for | 217 // to replace it. Otherwise may cause hangs when the renderer is waiting for |
209 // the completion of latency infos (such as when taking a Snapshot.) | 218 // the completion of latency infos (such as when taking a Snapshot.) |
210 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 219 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
211 can_lock_compositor_ == NO_PENDING_COMMIT || | 220 can_lock_compositor_ == NO_PENDING_COMMIT || |
212 !resize_lock_.get()) | 221 !resize_lock_.get()) |
213 return false; | 222 return false; |
214 | 223 |
215 return size_in_dip != resize_lock_->expected_size(); | 224 return size_in_dip != resize_lock_->expected_size(); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1029 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
1021 new_layer->SetShowSurface( | 1030 new_layer->SetShowSurface( |
1022 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 1031 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
1023 base::Bind(&RequireCallback, base::Unretained(manager)), | 1032 base::Bind(&RequireCallback, base::Unretained(manager)), |
1024 current_surface_size_, current_scale_factor_, | 1033 current_surface_size_, current_scale_factor_, |
1025 current_frame_size_in_dip_); | 1034 current_frame_size_in_dip_); |
1026 } | 1035 } |
1027 } | 1036 } |
1028 | 1037 |
1029 } // namespace content | 1038 } // namespace content |
OLD | NEW |