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

Unified Diff: extensions/browser/api/sockets_tcp/sockets_tcp_api.cc

Issue 1991083002: Remove ExtensionFunction::SetResult(T*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
diff --git a/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc b/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
index b2c06096008d04a3cf4b2a73e742f70c0056d097..cea70b0074b7c3c9d988eb6a608e914ea2c587a1 100644
--- a/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
+++ b/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
+#include "base/memory/ptr_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/socket_permission_request.h"
@@ -468,7 +469,8 @@ void SocketsTcpSecureFunction::AsyncWorkStart() {
ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id);
if (!socket) {
- SetResult(new base::FundamentalValue(net::ERR_INVALID_ARGUMENT));
+ SetResult(
+ base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
error_ = kSocketNotFoundError;
AsyncWorkCompleted();
return;
@@ -481,14 +483,16 @@ void SocketsTcpSecureFunction::AsyncWorkStart() {
// secure()'d.
if (socket->GetSocketType() != Socket::TYPE_TCP ||
socket->ClientStream() == NULL) {
- SetResult(new base::FundamentalValue(net::ERR_INVALID_ARGUMENT));
+ SetResult(
+ base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
error_ = kInvalidSocketStateError;
AsyncWorkCompleted();
return;
}
if (!socket->IsConnected()) {
- SetResult(new base::FundamentalValue(net::ERR_INVALID_ARGUMENT));
+ SetResult(
+ base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
error_ = kSocketNotConnectedError;
AsyncWorkCompleted();
return;

Powered by Google App Engine
This is Rietveld 408576698