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

Side by Side Diff: content/renderer/media_capture_from_element/canvas_capture_handler.cc

Issue 2850593002: Revert of [blink] Unique pointers in Platform.h (Closed)
Patch Set: Created 3 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 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_capture_from_element/canvas_capture_handler.h" 5 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 AddVideoCapturerSourceToVideoTrack(std::move(video_source), track); 134 AddVideoCapturerSourceToVideoTrack(std::move(video_source), track);
135 } 135 }
136 136
137 CanvasCaptureHandler::~CanvasCaptureHandler() { 137 CanvasCaptureHandler::~CanvasCaptureHandler() {
138 DVLOG(3) << __func__; 138 DVLOG(3) << __func__;
139 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 139 DCHECK(main_render_thread_checker_.CalledOnValidThread());
140 io_task_runner_->DeleteSoon(FROM_HERE, delegate_.release()); 140 io_task_runner_->DeleteSoon(FROM_HERE, delegate_.release());
141 } 141 }
142 142
143 // static 143 // static
144 std::unique_ptr<CanvasCaptureHandler> 144 CanvasCaptureHandler* CanvasCaptureHandler::CreateCanvasCaptureHandler(
145 CanvasCaptureHandler::CreateCanvasCaptureHandler(
146 const blink::WebSize& size, 145 const blink::WebSize& size,
147 double frame_rate, 146 double frame_rate,
148 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 147 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
149 blink::WebMediaStreamTrack* track) { 148 blink::WebMediaStreamTrack* track) {
150 // Save histogram data so we can see how much CanvasCapture is used. 149 // Save histogram data so we can see how much CanvasCapture is used.
151 // The histogram counts the number of calls to the JS API. 150 // The histogram counts the number of calls to the JS API.
152 UpdateWebRTCMethodCount(WEBKIT_CANVAS_CAPTURE_STREAM); 151 UpdateWebRTCMethodCount(WEBKIT_CANVAS_CAPTURE_STREAM);
153 152
154 return std::unique_ptr<CanvasCaptureHandler>( 153 return new CanvasCaptureHandler(size, frame_rate, io_task_runner, track);
155 new CanvasCaptureHandler(size, frame_rate, io_task_runner, track));
156 } 154 }
157 155
158 void CanvasCaptureHandler::SendNewFrame(const SkImage* image) { 156 void CanvasCaptureHandler::SendNewFrame(const SkImage* image) {
159 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 157 DCHECK(main_render_thread_checker_.CalledOnValidThread());
160 CreateNewFrame(image); 158 CreateNewFrame(image);
161 } 159 }
162 160
163 bool CanvasCaptureHandler::NeedsNewFrame() const { 161 bool CanvasCaptureHandler::NeedsNewFrame() const {
164 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 162 DCHECK(main_render_thread_checker_.CalledOnValidThread());
165 return ask_for_new_frame_; 163 return ask_for_new_frame_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 track_id, false); 264 track_id, false);
267 webkit_source.SetExtraData(media_stream_source.get()); 265 webkit_source.SetExtraData(media_stream_source.get());
268 266
269 web_track->Initialize(webkit_source); 267 web_track->Initialize(webkit_source);
270 web_track->SetTrackData(new MediaStreamVideoTrack( 268 web_track->SetTrackData(new MediaStreamVideoTrack(
271 media_stream_source.release(), 269 media_stream_source.release(),
272 MediaStreamVideoSource::ConstraintsCallback(), true)); 270 MediaStreamVideoSource::ConstraintsCallback(), true));
273 } 271 }
274 272
275 } // namespace content 273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698