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

Unified Diff: third_party/WebKit/Source/platform/exported/WebCredential.cpp

Issue 1967693003: Avoid object slicing in WebCredential::create (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the hilarious namespace :) 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: third_party/WebKit/Source/platform/exported/WebCredential.cpp
diff --git a/third_party/WebKit/Source/platform/exported/WebCredential.cpp b/third_party/WebKit/Source/platform/exported/WebCredential.cpp
index 11125ecd1d40121ef026aa466818c24856aa1fee..759f9fb48d15cfbc35683c06b2402c20e46ffa5c 100644
--- a/third_party/WebKit/Source/platform/exported/WebCredential.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebCredential.cpp
@@ -7,23 +7,22 @@
#include "platform/credentialmanager/PlatformCredential.h"
#include "public/platform/WebFederatedCredential.h"
#include "public/platform/WebPasswordCredential.h"
+#include "wtf/PtrUtil.h"
namespace blink {
-WebCredential WebCredential::create(PlatformCredential* credential)
+std::unique_ptr<WebCredential> WebCredential::create(PlatformCredential* credential)
{
if (credential->isPassword()) {
- WebPasswordCredential password(credential);
- return password;
+ return WTF::wrapUnique(new WebPasswordCredential(credential));
Yuta Kitamura 2016/05/12 03:58:55 "WTF::" shouldn't be necessary.
}
if (credential->isFederated()) {
- WebFederatedCredential federated(credential);
- return federated;
+ return WTF::wrapUnique(new WebFederatedCredential(credential));
}
ASSERT_NOT_REACHED();
- return WebCredential(credential);
+ return nullptr;
}
WebCredential::WebCredential(const WebString& id, const WebString& name, const WebURL& iconURL)

Powered by Google App Engine
This is Rietveld 408576698