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 "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
11 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.h" |
12 #include "cc/resources/single_release_callback.h" | 12 #include "cc/resources/single_release_callback.h" |
13 #include "cc/resources/texture_mailbox.h" | 13 #include "cc/resources/texture_mailbox.h" |
14 #include "cc/surfaces/surface.h" | 14 #include "cc/surfaces/surface.h" |
15 #include "cc/surfaces/surface_factory.h" | 15 #include "cc/surfaces/surface_factory.h" |
16 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
17 #include "content/browser/compositor/resize_lock.h" | 17 #include "content/browser/compositor/resize_lock.h" |
18 #include "content/browser/gpu/compositor_util.h" | 18 #include "content/browser/gpu/compositor_util.h" |
19 #include "content/common/gpu/client/gl_helper.h" | 19 #include "content/common/gpu/client/gl_helper.h" |
20 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 20 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
23 #include "media/base/video_util.h" | 23 #include "media/base/video_util.h" |
24 #include "skia/ext/image_operations.h" | 24 #include "skia/ext/image_operations.h" |
25 #include "third_party/skia/include/core/SkCanvas.h" | 25 #include "third_party/skia/include/core/SkCanvas.h" |
26 #include "third_party/skia/include/core/SkPaint.h" | 26 #include "third_party/skia/include/core/SkPaint.h" |
27 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 27 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
28 #include "ui/gfx/frame_time.h" | |
29 #include "ui/gfx/geometry/dip_util.h" | 28 #include "ui/gfx/geometry/dip_util.h" |
30 | 29 |
31 namespace content { | 30 namespace content { |
32 | 31 |
33 namespace { | 32 namespace { |
34 | 33 |
35 void SatisfyCallback(cc::SurfaceManager* manager, | 34 void SatisfyCallback(cc::SurfaceManager* manager, |
36 cc::SurfaceSequence sequence) { | 35 cc::SurfaceSequence sequence) { |
37 std::vector<uint32_t> sequences; | 36 std::vector<uint32_t> sequences; |
38 sequences.push_back(sequence.sequence); | 37 sequences.push_back(sequence.sequence); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // the release of the lock until we've kicked a frame with the new texture, to | 237 // the release of the lock until we've kicked a frame with the new texture, to |
239 // avoid resizing the UI before we have a chance to draw a "good" frame. | 238 // avoid resizing the UI before we have a chance to draw a "good" frame. |
240 resize_lock_->UnlockCompositor(); | 239 resize_lock_->UnlockCompositor(); |
241 } | 240 } |
242 | 241 |
243 void DelegatedFrameHost::DidReceiveFrameFromRenderer( | 242 void DelegatedFrameHost::DidReceiveFrameFromRenderer( |
244 const gfx::Rect& damage_rect) { | 243 const gfx::Rect& damage_rect) { |
245 if (!frame_subscriber() || !CanCopyToVideoFrame()) | 244 if (!frame_subscriber() || !CanCopyToVideoFrame()) |
246 return; | 245 return; |
247 | 246 |
248 const base::TimeTicks now = gfx::FrameTime::Now(); | 247 const base::TimeTicks now = base::TimeTicks::Now(); |
249 base::TimeTicks present_time; | 248 base::TimeTicks present_time; |
250 if (vsync_timebase_.is_null() || vsync_interval_ <= base::TimeDelta()) { | 249 if (vsync_timebase_.is_null() || vsync_interval_ <= base::TimeDelta()) { |
251 present_time = now; | 250 present_time = now; |
252 } else { | 251 } else { |
253 const int64 intervals_elapsed = (now - vsync_timebase_) / vsync_interval_; | 252 const int64 intervals_elapsed = (now - vsync_timebase_) / vsync_interval_; |
254 present_time = vsync_timebase_ + (intervals_elapsed + 1) * vsync_interval_; | 253 present_time = vsync_timebase_ + (intervals_elapsed + 1) * vsync_interval_; |
255 } | 254 } |
256 | 255 |
257 scoped_refptr<media::VideoFrame> frame; | 256 scoped_refptr<media::VideoFrame> frame; |
258 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; | 257 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1016 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
1018 new_layer->SetShowSurface( | 1017 new_layer->SetShowSurface( |
1019 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 1018 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
1020 base::Bind(&RequireCallback, base::Unretained(manager)), | 1019 base::Bind(&RequireCallback, base::Unretained(manager)), |
1021 current_surface_size_, current_scale_factor_, | 1020 current_surface_size_, current_scale_factor_, |
1022 current_frame_size_in_dip_); | 1021 current_frame_size_in_dip_); |
1023 } | 1022 } |
1024 } | 1023 } |
1025 | 1024 |
1026 } // namespace content | 1025 } // namespace content |
OLD | NEW |