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

Unified Diff: third_party/WebKit/Source/core/html/forms/FormController.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/forms/FormController.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.cpp b/third_party/WebKit/Source/core/html/forms/FormController.cpp
index e28c74de0667c4fedec6f9f2d162cf2ef23f7748..558ada8e8643ecfe6bd395117521aede6717fbae 100644
--- a/third_party/WebKit/Source/core/html/forms/FormController.cpp
+++ b/third_party/WebKit/Source/core/html/forms/FormController.cpp
@@ -26,7 +26,9 @@
#include "platform/FileChooser.h"
#include "wtf/Deque.h"
#include "wtf/HashTableDeletedValueType.h"
+#include "wtf/PtrUtil.h"
#include "wtf/text/StringBuilder.h"
+#include <memory>
namespace blink {
@@ -176,8 +178,8 @@ class SavedFormState {
USING_FAST_MALLOC(SavedFormState);
public:
- static PassOwnPtr<SavedFormState> create();
- static PassOwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index);
+ static std::unique_ptr<SavedFormState> create();
+ static std::unique_ptr<SavedFormState> deserialize(const Vector<String>&, size_t& index);
void serializeTo(Vector<String>&) const;
bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); }
void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&);
@@ -193,9 +195,9 @@ private:
size_t m_controlStateCount;
};
-PassOwnPtr<SavedFormState> SavedFormState::create()
+std::unique_ptr<SavedFormState> SavedFormState::create()
{
- return adoptPtr(new SavedFormState);
+ return wrapUnique(new SavedFormState);
}
static bool isNotFormControlTypeCharacter(UChar ch)
@@ -203,7 +205,7 @@ static bool isNotFormControlTypeCharacter(UChar ch)
return ch != '-' && (ch > 'z' || ch < 'a');
}
-PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index)
+std::unique_ptr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index)
{
if (index >= stateVector.size())
return nullptr;
@@ -211,7 +213,7 @@ PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& sta
size_t itemCount = stateVector[index++].toUInt();
if (!itemCount)
return nullptr;
- OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState);
+ std::unique_ptr<SavedFormState> savedFormState = wrapUnique(new SavedFormState);
while (itemCount--) {
if (index + 1 >= stateVector.size())
return nullptr;
@@ -411,7 +413,7 @@ static String formStateSignature()
Vector<String> DocumentState::toStateVector()
{
FormKeyGenerator* keyGenerator = FormKeyGenerator::create();
- OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap);
+ std::unique_ptr<SavedFormStateMap> stateMap = wrapUnique(new SavedFormStateMap);
for (const auto& formControl : m_formControls) {
HTMLFormControlElementWithState* control = formControl.get();
ASSERT(control->inShadowIncludingDocument());
@@ -488,7 +490,7 @@ void FormController::formStatesFromStateVector(const Vector<String>& stateVector
while (i + 1 < stateVector.size()) {
AtomicString formKey = AtomicString(stateVector[i++]);
- OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i);
+ std::unique_ptr<SavedFormState> state = SavedFormState::deserialize(stateVector, i);
if (!state) {
i = 0;
break;

Powered by Google App Engine
This is Rietveld 408576698