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

Side by Side Diff: remoting/client/plugin/pepper_video_renderer_2d.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/client/plugin/pepper_video_renderer_2d.h" 5 #include "remoting/client/plugin/pepper_video_renderer_2d.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
15 #include "ppapi/cpp/completion_callback.h" 16 #include "ppapi/cpp/completion_callback.h"
16 #include "ppapi/cpp/image_data.h" 17 #include "ppapi/cpp/image_data.h"
17 #include "ppapi/cpp/instance.h" 18 #include "ppapi/cpp/instance.h"
18 #include "ppapi/cpp/point.h" 19 #include "ppapi/cpp/point.h"
19 #include "ppapi/cpp/rect.h" 20 #include "ppapi/cpp/rect.h"
20 #include "ppapi/cpp/size.h" 21 #include "ppapi/cpp/size.h"
21 #include "remoting/base/util.h" 22 #include "remoting/base/util.h"
22 #include "remoting/client/client_context.h" 23 #include "remoting/client/client_context.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 114
114 return software_video_renderer_->GetVideoStub(); 115 return software_video_renderer_->GetVideoStub();
115 } 116 }
116 117
117 protocol::FrameConsumer* PepperVideoRenderer2D::GetFrameConsumer() { 118 protocol::FrameConsumer* PepperVideoRenderer2D::GetFrameConsumer() {
118 DCHECK(thread_checker_.CalledOnValidThread()); 119 DCHECK(thread_checker_.CalledOnValidThread());
119 120
120 return software_video_renderer_->GetFrameConsumer(); 121 return software_video_renderer_->GetFrameConsumer();
121 } 122 }
122 123
123 scoped_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame( 124 std::unique_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame(
124 const webrtc::DesktopSize& size) { 125 const webrtc::DesktopSize& size) {
125 DCHECK(thread_checker_.CalledOnValidThread()); 126 DCHECK(thread_checker_.CalledOnValidThread());
126 127
127 pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL, 128 pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
128 pp::Size(size.width(), size.height()), false); 129 pp::Size(size.width(), size.height()), false);
129 return make_scoped_ptr(new PepperDesktopFrame(buffer_data)); 130 return base::WrapUnique(new PepperDesktopFrame(buffer_data));
130 } 131 }
131 132
132 void PepperVideoRenderer2D::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame, 133 void PepperVideoRenderer2D::DrawFrame(
133 const base::Closure& done) { 134 std::unique_ptr<webrtc::DesktopFrame> frame,
135 const base::Closure& done) {
134 DCHECK(thread_checker_.CalledOnValidThread()); 136 DCHECK(thread_checker_.CalledOnValidThread());
135 137
136 if (!frame_received_) { 138 if (!frame_received_) {
137 event_handler_->OnVideoFirstFrameReceived(); 139 event_handler_->OnVideoFirstFrameReceived();
138 frame_received_ = true; 140 frame_received_ = true;
139 } 141 }
140 142
141 bool size_changed = !source_size_.equals(frame->size()); 143 bool size_changed = !source_size_.equals(frame->size());
142 if (size_changed) { 144 if (size_changed) {
143 source_size_ = frame->size(); 145 source_size_ = frame->size();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 flush_pending_ = false; 208 flush_pending_ = false;
207 209
208 // Call all callbacks for the frames we've just flushed. 210 // Call all callbacks for the frames we've just flushed.
209 flushing_frames_done_callbacks_.clear(); 211 flushing_frames_done_callbacks_.clear();
210 212
211 // Flush again if necessary. 213 // Flush again if necessary.
212 Flush(); 214 Flush();
213 } 215 }
214 216
215 } // namespace remoting 217 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_video_renderer_2d.h ('k') | remoting/client/plugin/pepper_video_renderer_3d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698