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

Side by Side Diff: remoting/host/video_frame_recorder.cc

Issue 609923004: Cleanup usage of scoped_ptr<> in remoting for C++11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "remoting/host/video_frame_recorder.h" 5 #include "remoting/host/video_frame_recorder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 DCHECK(!encoder_task_runner_.get()); 132 DCHECK(!encoder_task_runner_.get());
133 DCHECK(!caller_task_runner_.get()); 133 DCHECK(!caller_task_runner_.get());
134 caller_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 134 caller_task_runner_ = base::ThreadTaskRunnerHandle::Get();
135 135
136 scoped_ptr<RecordingVideoEncoder> recording_encoder( 136 scoped_ptr<RecordingVideoEncoder> recording_encoder(
137 new RecordingVideoEncoder(encoder.Pass(), 137 new RecordingVideoEncoder(encoder.Pass(),
138 caller_task_runner_, 138 caller_task_runner_,
139 weak_factory_.GetWeakPtr())); 139 weak_factory_.GetWeakPtr()));
140 recording_encoder_ = recording_encoder->AsWeakPtr(); 140 recording_encoder_ = recording_encoder->AsWeakPtr();
141 141
142 return recording_encoder.PassAs<VideoEncoder>(); 142 return recording_encoder.Pass();
143 } 143 }
144 144
145 void VideoFrameRecorder::DetachVideoEncoderWrapper() { 145 void VideoFrameRecorder::DetachVideoEncoderWrapper() {
146 DCHECK(!caller_task_runner_.get() || 146 DCHECK(!caller_task_runner_.get() ||
147 caller_task_runner_->BelongsToCurrentThread()); 147 caller_task_runner_->BelongsToCurrentThread());
148 148
149 // Immediately detach the wrapper from this recorder. 149 // Immediately detach the wrapper from this recorder.
150 weak_factory_.InvalidateWeakPtrs(); 150 weak_factory_.InvalidateWeakPtrs();
151 151
152 // Clean up any pending recorded frames. 152 // Clean up any pending recorded frames.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (content_bytes_ + frame_bytes > max_content_bytes_) { 240 if (content_bytes_ + frame_bytes > max_content_bytes_) {
241 return; 241 return;
242 } 242 }
243 243
244 // Store the frame and update the content byte count. 244 // Store the frame and update the content byte count.
245 recorded_frames_.push_back(frame.release()); 245 recorded_frames_.push_back(frame.release());
246 content_bytes_ += frame_bytes; 246 content_bytes_ += frame_bytes;
247 } 247 }
248 248
249 } // namespace remoting 249 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698