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

Side by Side Diff: content/renderer/media/html_video_element_capturer_source.cc

Issue 1862693002: Replace skia::RefPtr with sk_sp<> in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unget Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/media/html_video_element_capturer_source.h" 5 #include "content/renderer/media/html_video_element_capturer_source.h"
6 6
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
10 #include "content/renderer/media/media_stream_video_source.h" 10 #include "content/renderer/media/media_stream_video_source.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 << media::VideoCaptureFormat::ToString(params.requested_format); 83 << media::VideoCaptureFormat::ToString(params.requested_format);
84 DCHECK(params.requested_format.IsValid()); 84 DCHECK(params.requested_format.IsValid());
85 DCHECK(thread_checker_.CalledOnValidThread()); 85 DCHECK(thread_checker_.CalledOnValidThread());
86 86
87 running_callback_ = running_callback; 87 running_callback_ = running_callback;
88 if (!web_media_player_ || !web_media_player_->hasVideo()) { 88 if (!web_media_player_ || !web_media_player_->hasVideo()) {
89 running_callback_.Run(false); 89 running_callback_.Run(false);
90 return; 90 return;
91 } 91 }
92 const blink::WebSize resolution = web_media_player_->naturalSize(); 92 const blink::WebSize resolution = web_media_player_->naturalSize();
93 canvas_ = skia::AdoptRef(skia::CreatePlatformCanvas(resolution.width, 93 canvas_ = sk_sp<SkCanvas>(skia::CreatePlatformCanvas(resolution.width,
94 resolution.height, 94 resolution.height,
95 true /* is_opaque */)); 95 true /* is_opaque */));
96 96
97 new_frame_callback_ = new_frame_callback; 97 new_frame_callback_ = new_frame_callback;
98 // Force |capture_frame_rate_| to be in between k{Min,Max}FramesPerSecond. 98 // Force |capture_frame_rate_| to be in between k{Min,Max}FramesPerSecond.
99 capture_frame_rate_ = 99 capture_frame_rate_ =
100 std::max(kMinFramesPerSecond, 100 std::max(kMinFramesPerSecond,
101 std::min(static_cast<float>(media::limits::kMaxFramesPerSecond), 101 std::min(static_cast<float>(media::limits::kMaxFramesPerSecond),
102 params.requested_format.frame_rate)); 102 params.requested_format.frame_rate));
103 103
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 next_capture_time_ = current_time; 181 next_capture_time_ = current_time;
182 } 182 }
183 // Schedule next capture. 183 // Schedule next capture.
184 base::MessageLoop::current()->PostDelayedTask( 184 base::MessageLoop::current()->PostDelayedTask(
185 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame, 185 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame,
186 weak_factory_.GetWeakPtr()), 186 weak_factory_.GetWeakPtr()),
187 next_capture_time_ - current_time); 187 next_capture_time_ - current_time);
188 } 188 }
189 189
190 } // namespace content 190 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/html_video_element_capturer_source.h ('k') | content/renderer/pepper/pepper_plugin_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698