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

Side by Side Diff: remoting/protocol/session_config.cc

Issue 9240033: Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 | Annotate | Revision Log
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/protocol/session_config.h" 5 #include "remoting/protocol/session_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace remoting { 9 namespace remoting {
10 namespace protocol { 10 namespace protocol {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return false; 119 return false;
120 } 120 }
121 121
122 // static 122 // static
123 bool CandidateSessionConfig::IsChannelConfigSupported( 123 bool CandidateSessionConfig::IsChannelConfigSupported(
124 const std::vector<ChannelConfig>& vector, 124 const std::vector<ChannelConfig>& vector,
125 const ChannelConfig& value) { 125 const ChannelConfig& value) {
126 return std::find(vector.begin(), vector.end(), value) != vector.end(); 126 return std::find(vector.begin(), vector.end(), value) != vector.end();
127 } 127 }
128 128
129 CandidateSessionConfig* CandidateSessionConfig::Clone() const { 129 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::Clone() const {
130 return new CandidateSessionConfig(*this); 130 return scoped_ptr<CandidateSessionConfig>(new CandidateSessionConfig(*this));
131 } 131 }
132 132
133 // static 133 // static
134 CandidateSessionConfig* CandidateSessionConfig::CreateEmpty() { 134 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateEmpty() {
135 return new CandidateSessionConfig(); 135 return scoped_ptr<CandidateSessionConfig>(new CandidateSessionConfig());
136 } 136 }
137 137
138 // static 138 // static
139 CandidateSessionConfig* CandidateSessionConfig::CreateFrom( 139 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateFrom(
140 const SessionConfig& config) { 140 const SessionConfig& config) {
141 CandidateSessionConfig* result = CreateEmpty(); 141 scoped_ptr<CandidateSessionConfig> result = CreateEmpty();
142 result->mutable_control_configs()->push_back(config.control_config()); 142 result->mutable_control_configs()->push_back(config.control_config());
143 result->mutable_event_configs()->push_back(config.event_config()); 143 result->mutable_event_configs()->push_back(config.event_config());
144 result->mutable_video_configs()->push_back(config.video_config()); 144 result->mutable_video_configs()->push_back(config.video_config());
145 return result; 145 return result.Pass();
146 } 146 }
147 147
148 // static 148 // static
149 CandidateSessionConfig* CandidateSessionConfig::CreateDefault() { 149 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() {
150 CandidateSessionConfig* result = CreateEmpty(); 150 scoped_ptr<CandidateSessionConfig> result = CreateEmpty();
151 result->mutable_control_configs()->push_back( 151 result->mutable_control_configs()->push_back(
152 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 152 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
153 kDefaultStreamVersion, 153 kDefaultStreamVersion,
154 ChannelConfig::CODEC_UNDEFINED)); 154 ChannelConfig::CODEC_UNDEFINED));
155 result->mutable_event_configs()->push_back( 155 result->mutable_event_configs()->push_back(
156 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 156 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
157 kDefaultStreamVersion, 157 kDefaultStreamVersion,
158 ChannelConfig::CODEC_UNDEFINED)); 158 ChannelConfig::CODEC_UNDEFINED));
159 result->mutable_video_configs()->push_back( 159 result->mutable_video_configs()->push_back(
160 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 160 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
161 kDefaultStreamVersion, 161 kDefaultStreamVersion,
162 ChannelConfig::CODEC_VP8)); 162 ChannelConfig::CODEC_VP8));
163 return result; 163 return result.Pass();
164 } 164 }
165 165
166 } // namespace protocol 166 } // namespace protocol
167 } // namespace remoting 167 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698