Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1143433005: Remove gfx::FrameTime for a single clock source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 28
29 #include "ui/gfx/geometry/dip_util.h" 29 #include "ui/gfx/geometry/dip_util.h"
30 30
31 namespace content { 31 namespace content {
32 32
33 namespace { 33 namespace {
34 34
35 void SatisfyCallback(cc::SurfaceManager* manager, 35 void SatisfyCallback(cc::SurfaceManager* manager,
36 cc::SurfaceSequence sequence) { 36 cc::SurfaceSequence sequence) {
37 std::vector<uint32_t> sequences; 37 std::vector<uint32_t> sequences;
38 sequences.push_back(sequence.sequence); 38 sequences.push_back(sequence.sequence);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // the release of the lock until we've kicked a frame with the new texture, to 238 // 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. 239 // avoid resizing the UI before we have a chance to draw a "good" frame.
240 resize_lock_->UnlockCompositor(); 240 resize_lock_->UnlockCompositor();
241 } 241 }
242 242
243 void DelegatedFrameHost::DidReceiveFrameFromRenderer( 243 void DelegatedFrameHost::DidReceiveFrameFromRenderer(
244 const gfx::Rect& damage_rect) { 244 const gfx::Rect& damage_rect) {
245 if (!frame_subscriber() || !CanCopyToVideoFrame()) 245 if (!frame_subscriber() || !CanCopyToVideoFrame())
246 return; 246 return;
247 247
248 const base::TimeTicks now = gfx::FrameTime::Now(); 248 const base::TimeTicks now = base::TimeTicks::Now();
249 base::TimeTicks present_time; 249 base::TimeTicks present_time;
250 if (vsync_timebase_.is_null() || vsync_interval_ <= base::TimeDelta()) { 250 if (vsync_timebase_.is_null() || vsync_interval_ <= base::TimeDelta()) {
251 present_time = now; 251 present_time = now;
252 } else { 252 } else {
253 const int64 intervals_elapsed = (now - vsync_timebase_) / vsync_interval_; 253 const int64 intervals_elapsed = (now - vsync_timebase_) / vsync_interval_;
254 present_time = vsync_timebase_ + (intervals_elapsed + 1) * vsync_interval_; 254 present_time = vsync_timebase_ + (intervals_elapsed + 1) * vsync_interval_;
255 } 255 }
256 256
257 scoped_refptr<media::VideoFrame> frame; 257 scoped_refptr<media::VideoFrame> frame;
258 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; 258 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback;
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1012 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1013 new_layer->SetShowSurface( 1013 new_layer->SetShowSurface(
1014 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 1014 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
1015 base::Bind(&RequireCallback, base::Unretained(manager)), 1015 base::Bind(&RequireCallback, base::Unretained(manager)),
1016 current_surface_size_, current_scale_factor_, 1016 current_surface_size_, current_scale_factor_,
1017 current_frame_size_in_dip_); 1017 current_frame_size_in_dip_);
1018 } 1018 }
1019 } 1019 }
1020 1020
1021 } // namespace content 1021 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698