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

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

Issue 1909263002: Replace safe-bool idiom with explicit WeakPtr::operator bool() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit-test for comparison operators Created 4 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/pepper_to_video_track_adapter.h" 5 #include "content/renderer/media/pepper_to_video_track_adapter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 delegate_->DeliverFrame(new_frame); 202 delegate_->DeliverFrame(new_frame);
203 } 203 }
204 204
205 // PpFrameWriterProxy is a helper class to make sure the user won't use 205 // PpFrameWriterProxy is a helper class to make sure the user won't use
206 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource - 206 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource -
207 // is released). 207 // is released).
208 class PpFrameWriterProxy : public FrameWriterInterface { 208 class PpFrameWriterProxy : public FrameWriterInterface {
209 public: 209 public:
210 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer) 210 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer)
211 : writer_(writer) { 211 : writer_(writer) {
212 DCHECK(writer_ != NULL); 212 DCHECK(writer_);
213 } 213 }
214 214
215 ~PpFrameWriterProxy() override {} 215 ~PpFrameWriterProxy() override {}
216 216
217 void PutFrame(PPB_ImageData_Impl* image_data, 217 void PutFrame(PPB_ImageData_Impl* image_data,
218 int64_t time_stamp_ns) override { 218 int64_t time_stamp_ns) override {
219 writer_->PutFrame(image_data, time_stamp_ns); 219 writer_->PutFrame(image_data, time_stamp_ns);
220 } 220 }
221 221
222 private: 222 private:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( 268 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack(
269 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), 269 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(),
270 track_enabled)); 270 track_enabled));
271 271
272 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); 272 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr());
273 return true; 273 return true;
274 } 274 }
275 275
276 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_provider_host.cc ('k') | device/bluetooth/bluetooth_adapter_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698