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

Side by Side Diff: remoting/jingle_glue/iq_sender.cc

Issue 16964002: Rewrite scoped_ptr<T>(NULL) to use the default ctor in remoting/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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/jingle_glue/iq_sender.h" 5 #include "remoting/jingle_glue/iq_sender.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/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 28 matching lines...) Expand all
39 IqSender::~IqSender() { 39 IqSender::~IqSender() {
40 signal_strategy_->RemoveListener(this); 40 signal_strategy_->RemoveListener(this);
41 } 41 }
42 42
43 scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza, 43 scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza,
44 const ReplyCallback& callback) { 44 const ReplyCallback& callback) {
45 std::string addressee = stanza->Attr(buzz::QN_TO); 45 std::string addressee = stanza->Attr(buzz::QN_TO);
46 std::string id = signal_strategy_->GetNextId(); 46 std::string id = signal_strategy_->GetNextId();
47 stanza->AddAttr(buzz::QN_ID, id); 47 stanza->AddAttr(buzz::QN_ID, id);
48 if (!signal_strategy_->SendStanza(stanza.Pass())) { 48 if (!signal_strategy_->SendStanza(stanza.Pass())) {
49 return scoped_ptr<IqRequest>(NULL); 49 return scoped_ptr<IqRequest>();
50 } 50 }
51 DCHECK(requests_.find(id) == requests_.end()); 51 DCHECK(requests_.find(id) == requests_.end());
52 scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee)); 52 scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
53 if (!callback.is_null()) 53 if (!callback.is_null())
54 requests_[id] = request.get(); 54 requests_[id] = request.get();
55 return request.Pass(); 55 return request.Pass();
56 } 56 }
57 57
58 scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type, 58 scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type,
59 const std::string& addressee, 59 const std::string& addressee,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 base::ThreadTaskRunnerHandle::Get()->PostTask( 169 base::ThreadTaskRunnerHandle::Get()->PostTask(
170 FROM_HERE, base::Bind(&IqRequest::DeliverResponse, AsWeakPtr(), 170 FROM_HERE, base::Bind(&IqRequest::DeliverResponse, AsWeakPtr(),
171 base::Passed(&stanza_copy))); 171 base::Passed(&stanza_copy)));
172 } 172 }
173 173
174 void IqRequest::DeliverResponse(scoped_ptr<buzz::XmlElement> stanza) { 174 void IqRequest::DeliverResponse(scoped_ptr<buzz::XmlElement> stanza) {
175 CallCallback(stanza.get()); 175 CallCallback(stanza.get());
176 } 176 }
177 177
178 } // namespace remoting 178 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698