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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp

Issue 2004313003: DevTools: migrate from OwnPtr to std::unique_ptr for inspector protocol classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined 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/modules/indexeddb/InspectorIndexedDBAgent.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
index 7523d66343d005abbfad860379e1ffa934bf7470..9abdb241ad4f04197e9373a1bfd210781d2bf8c1 100644
--- a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp
@@ -88,7 +88,7 @@ namespace {
class GetDatabaseNamesCallback final : public EventListener {
WTF_MAKE_NONCOPYABLE(GetDatabaseNamesCallback);
public:
- static GetDatabaseNamesCallback* create(PassOwnPtr<RequestDatabaseNamesCallback> requestCallback, const String& securityOrigin)
+ static GetDatabaseNamesCallback* create(std::unique_ptr<RequestDatabaseNamesCallback> requestCallback, const String& securityOrigin)
{
return new GetDatabaseNamesCallback(std::move(requestCallback), securityOrigin);
}
@@ -115,7 +115,7 @@ public:
}
DOMStringList* databaseNamesList = requestResult->domStringList();
- OwnPtr<protocol::Array<String>> databaseNames = protocol::Array<String>::create();
+ std::unique_ptr<protocol::Array<String>> databaseNames = protocol::Array<String>::create();
for (size_t i = 0; i < databaseNamesList->length(); ++i)
databaseNames->addItem(databaseNamesList->anonymousIndexedGetter(i));
m_requestCallback->sendSuccess(std::move(databaseNames));
@@ -127,11 +127,11 @@ public:
}
private:
- GetDatabaseNamesCallback(PassOwnPtr<RequestDatabaseNamesCallback> requestCallback, const String& securityOrigin)
+ GetDatabaseNamesCallback(std::unique_ptr<RequestDatabaseNamesCallback> requestCallback, const String& securityOrigin)
: EventListener(EventListener::CPPEventListenerType)
, m_requestCallback(std::move(requestCallback))
, m_securityOrigin(securityOrigin) { }
- OwnPtr<RequestDatabaseNamesCallback> m_requestCallback;
+ std::unique_ptr<RequestDatabaseNamesCallback> m_requestCallback;
String m_securityOrigin;
};
@@ -270,9 +270,9 @@ static IDBIndex* indexForObjectStore(IDBObjectStore* idbObjectStore, const Strin
return idbIndex;
}
-static PassOwnPtr<KeyPath> keyPathFromIDBKeyPath(const IDBKeyPath& idbKeyPath)
+static std::unique_ptr<KeyPath> keyPathFromIDBKeyPath(const IDBKeyPath& idbKeyPath)
{
- OwnPtr<KeyPath> keyPath;
+ std::unique_ptr<KeyPath> keyPath;
switch (idbKeyPath.getType()) {
case IDBKeyPath::NullType:
keyPath = KeyPath::create().setType(KeyPath::TypeEnum::Null).build();
@@ -282,7 +282,7 @@ static PassOwnPtr<KeyPath> keyPathFromIDBKeyPath(const IDBKeyPath& idbKeyPath)
break;
case IDBKeyPath::ArrayType: {
keyPath = KeyPath::create().setType(KeyPath::TypeEnum::Array).build();
- OwnPtr<protocol::Array<String>> array = protocol::Array<String>::create();
+ std::unique_ptr<protocol::Array<String>> array = protocol::Array<String>::create();
const Vector<String>& stringArray = idbKeyPath.array();
for (size_t i = 0; i < stringArray.size(); ++i)
array->addItem(stringArray[i]);
@@ -298,7 +298,7 @@ static PassOwnPtr<KeyPath> keyPathFromIDBKeyPath(const IDBKeyPath& idbKeyPath)
class DatabaseLoader final : public ExecutableWithDatabase {
public:
- static PassRefPtr<DatabaseLoader> create(ScriptState* scriptState, PassOwnPtr<RequestDatabaseCallback> requestCallback)
+ static PassRefPtr<DatabaseLoader> create(ScriptState* scriptState, std::unique_ptr<RequestDatabaseCallback> requestCallback)
{
return adoptRef(new DatabaseLoader(scriptState, std::move(requestCallback)));
}
@@ -309,17 +309,17 @@ public:
{
const IDBDatabaseMetadata databaseMetadata = idbDatabase->metadata();
- OwnPtr<protocol::Array<protocol::IndexedDB::ObjectStore>> objectStores = protocol::Array<protocol::IndexedDB::ObjectStore>::create();
+ std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStore>> objectStores = protocol::Array<protocol::IndexedDB::ObjectStore>::create();
for (const auto& storeMapEntry : databaseMetadata.objectStores) {
const IDBObjectStoreMetadata& objectStoreMetadata = storeMapEntry.value;
- OwnPtr<protocol::Array<protocol::IndexedDB::ObjectStoreIndex>> indexes = protocol::Array<protocol::IndexedDB::ObjectStoreIndex>::create();
+ std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStoreIndex>> indexes = protocol::Array<protocol::IndexedDB::ObjectStoreIndex>::create();
for (const auto& metadataMapEntry : objectStoreMetadata.indexes) {
const IDBIndexMetadata& indexMetadata = metadataMapEntry.value;
- OwnPtr<ObjectStoreIndex> objectStoreIndex = ObjectStoreIndex::create()
+ std::unique_ptr<ObjectStoreIndex> objectStoreIndex = ObjectStoreIndex::create()
.setName(indexMetadata.name)
.setKeyPath(keyPathFromIDBKeyPath(indexMetadata.keyPath))
.setUnique(indexMetadata.unique)
@@ -327,14 +327,14 @@ public:
indexes->addItem(std::move(objectStoreIndex));
}
- OwnPtr<ObjectStore> objectStore = ObjectStore::create()
+ std::unique_ptr<ObjectStore> objectStore = ObjectStore::create()
.setName(objectStoreMetadata.name)
.setKeyPath(keyPathFromIDBKeyPath(objectStoreMetadata.keyPath))
.setAutoIncrement(objectStoreMetadata.autoIncrement)
.setIndexes(std::move(indexes)).build();
objectStores->addItem(std::move(objectStore));
}
- OwnPtr<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create()
+ std::unique_ptr<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create()
.setName(databaseMetadata.name)
.setVersion(databaseMetadata.version)
.setObjectStores(std::move(objectStores)).build();
@@ -344,10 +344,10 @@ public:
RequestCallback* getRequestCallback() override { return m_requestCallback.get(); }
private:
- DatabaseLoader(ScriptState* scriptState, PassOwnPtr<RequestDatabaseCallback> requestCallback)
+ DatabaseLoader(ScriptState* scriptState, std::unique_ptr<RequestDatabaseCallback> requestCallback)
: ExecutableWithDatabase(scriptState)
, m_requestCallback(std::move(requestCallback)) { }
- OwnPtr<RequestDatabaseCallback> m_requestCallback;
+ std::unique_ptr<RequestDatabaseCallback> m_requestCallback;
};
static IDBKey* idbKeyFromInspectorObject(protocol::IndexedDB::Key* key)
@@ -407,7 +407,7 @@ class DataLoader;
class OpenCursorCallback final : public EventListener {
public:
- static OpenCursorCallback* create(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
+ static OpenCursorCallback* create(ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
{
return new OpenCursorCallback(scriptState, std::move(requestCallback), skipCount, pageSize);
}
@@ -469,13 +469,13 @@ public:
const String16 errorMessage("\"Inspection error. Maximum depth reached?\"");
ScriptState* scriptState = m_scriptState.get();
ScriptState::Scope scope(scriptState);
- OwnPtr<protocol::Value> keyJsonValue = toProtocolValue(scriptState->context(), idbCursor->key(scriptState).v8Value());
- OwnPtr<protocol::Value> primaryKeyJsonValue = toProtocolValue(scriptState->context(), idbCursor->primaryKey(scriptState).v8Value());
- OwnPtr<protocol::Value> valueJsonValue = toProtocolValue(scriptState->context(), idbCursor->value(scriptState).v8Value());
+ std::unique_ptr<protocol::Value> keyJsonValue = toProtocolValue(scriptState->context(), idbCursor->key(scriptState).v8Value());
+ std::unique_ptr<protocol::Value> primaryKeyJsonValue = toProtocolValue(scriptState->context(), idbCursor->primaryKey(scriptState).v8Value());
+ std::unique_ptr<protocol::Value> valueJsonValue = toProtocolValue(scriptState->context(), idbCursor->value(scriptState).v8Value());
String16 key = keyJsonValue ? keyJsonValue->toJSONString() : errorMessage;
String16 value = valueJsonValue ? valueJsonValue->toJSONString() : errorMessage;
String primaryKey = primaryKeyJsonValue ? primaryKeyJsonValue->toJSONString() : errorMessage;
- OwnPtr<DataEntry> dataEntry = DataEntry::create()
+ std::unique_ptr<DataEntry> dataEntry = DataEntry::create()
.setKey(key)
.setPrimaryKey(primaryKey)
.setValue(value).build();
@@ -493,7 +493,7 @@ public:
}
private:
- OpenCursorCallback(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
+ OpenCursorCallback(ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
: EventListener(EventListener::CPPEventListenerType)
, m_scriptState(scriptState)
, m_requestCallback(std::move(requestCallback))
@@ -504,15 +504,15 @@ private:
}
RefPtr<ScriptState> m_scriptState;
- OwnPtr<RequestDataCallback> m_requestCallback;
+ std::unique_ptr<RequestDataCallback> m_requestCallback;
int m_skipCount;
unsigned m_pageSize;
- OwnPtr<Array<DataEntry>> m_result;
+ std::unique_ptr<Array<DataEntry>> m_result;
};
class DataLoader final : public ExecutableWithDatabase {
public:
- static PassRefPtr<DataLoader> create(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> requestCallback, const String& objectStoreName, const String& indexName, IDBKeyRange* idbKeyRange, int skipCount, unsigned pageSize)
+ static PassRefPtr<DataLoader> create(ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, const String& objectStoreName, const String& indexName, IDBKeyRange* idbKeyRange, int skipCount, unsigned pageSize)
{
return adoptRef(new DataLoader(scriptState, std::move(requestCallback), objectStoreName, indexName, idbKeyRange, skipCount, pageSize));
}
@@ -549,7 +549,7 @@ public:
}
RequestCallback* getRequestCallback() override { return m_requestCallback.get(); }
- DataLoader(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> requestCallback, const String& objectStoreName, const String& indexName, IDBKeyRange* idbKeyRange, int skipCount, unsigned pageSize)
+ DataLoader(ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, const String& objectStoreName, const String& indexName, IDBKeyRange* idbKeyRange, int skipCount, unsigned pageSize)
: ExecutableWithDatabase(scriptState)
, m_requestCallback(std::move(requestCallback))
, m_objectStoreName(objectStoreName)
@@ -560,7 +560,7 @@ public:
{
}
- OwnPtr<RequestDataCallback> m_requestCallback;
+ std::unique_ptr<RequestDataCallback> m_requestCallback;
String m_objectStoreName;
String m_indexName;
Persistent<IDBKeyRange> m_idbKeyRange;
@@ -629,7 +629,7 @@ static IDBFactory* assertIDBFactory(ErrorString* errorString, Document* document
return idbFactory;
}
-void InspectorIndexedDBAgent::requestDatabaseNames(ErrorString* errorString, const String& securityOrigin, PassOwnPtr<RequestDatabaseNamesCallback> requestCallback)
+void InspectorIndexedDBAgent::requestDatabaseNames(ErrorString* errorString, const String& securityOrigin, std::unique_ptr<RequestDatabaseNamesCallback> requestCallback)
{
LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigin);
Document* document = assertDocument(errorString, frame);
@@ -652,7 +652,7 @@ void InspectorIndexedDBAgent::requestDatabaseNames(ErrorString* errorString, con
idbRequest->addEventListener(EventTypeNames::success, GetDatabaseNamesCallback::create(std::move(requestCallback), document->getSecurityOrigin()->toRawString()), false);
}
-void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, const String& securityOrigin, const String& databaseName, PassOwnPtr<RequestDatabaseCallback> requestCallback)
+void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, const String& securityOrigin, const String& databaseName, std::unique_ptr<RequestDatabaseCallback> requestCallback)
{
LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigin);
Document* document = assertDocument(errorString, frame);
@@ -678,7 +678,7 @@ void InspectorIndexedDBAgent::requestData(ErrorString* errorString,
int skipCount,
int pageSize,
const Maybe<protocol::IndexedDB::KeyRange>& keyRange,
- PassOwnPtr<RequestDataCallback> requestCallback)
+ std::unique_ptr<RequestDataCallback> requestCallback)
{
LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigin);
Document* document = assertDocument(errorString, frame);
@@ -705,7 +705,7 @@ void InspectorIndexedDBAgent::requestData(ErrorString* errorString,
class ClearObjectStoreListener final : public EventListener {
WTF_MAKE_NONCOPYABLE(ClearObjectStoreListener);
public:
- static ClearObjectStoreListener* create(PassOwnPtr<ClearObjectStoreCallback> requestCallback)
+ static ClearObjectStoreListener* create(std::unique_ptr<ClearObjectStoreCallback> requestCallback)
{
return new ClearObjectStoreListener(std::move(requestCallback));
}
@@ -733,24 +733,24 @@ public:
}
private:
- ClearObjectStoreListener(PassOwnPtr<ClearObjectStoreCallback> requestCallback)
+ ClearObjectStoreListener(std::unique_ptr<ClearObjectStoreCallback> requestCallback)
: EventListener(EventListener::CPPEventListenerType)
, m_requestCallback(std::move(requestCallback))
{
}
- OwnPtr<ClearObjectStoreCallback> m_requestCallback;
+ std::unique_ptr<ClearObjectStoreCallback> m_requestCallback;
};
class ClearObjectStore final : public ExecutableWithDatabase {
public:
- static PassRefPtr<ClearObjectStore> create(ScriptState* scriptState, const String& objectStoreName, PassOwnPtr<ClearObjectStoreCallback> requestCallback)
+ static PassRefPtr<ClearObjectStore> create(ScriptState* scriptState, const String& objectStoreName, std::unique_ptr<ClearObjectStoreCallback> requestCallback)
{
return adoptRef(new ClearObjectStore(scriptState, objectStoreName, std::move(requestCallback)));
}
- ClearObjectStore(ScriptState* scriptState, const String& objectStoreName, PassOwnPtr<ClearObjectStoreCallback> requestCallback)
+ ClearObjectStore(ScriptState* scriptState, const String& objectStoreName, std::unique_ptr<ClearObjectStoreCallback> requestCallback)
: ExecutableWithDatabase(scriptState)
, m_objectStoreName(objectStoreName)
, m_requestCallback(std::move(requestCallback))
@@ -784,10 +784,10 @@ public:
RequestCallback* getRequestCallback() override { return m_requestCallback.get(); }
private:
const String m_objectStoreName;
- OwnPtr<ClearObjectStoreCallback> m_requestCallback;
+ std::unique_ptr<ClearObjectStoreCallback> m_requestCallback;
};
-void InspectorIndexedDBAgent::clearObjectStore(ErrorString* errorString, const String& securityOrigin, const String& databaseName, const String& objectStoreName, PassOwnPtr<ClearObjectStoreCallback> requestCallback)
+void InspectorIndexedDBAgent::clearObjectStore(ErrorString* errorString, const String& securityOrigin, const String& databaseName, const String& objectStoreName, std::unique_ptr<ClearObjectStoreCallback> requestCallback)
{
LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigin);
Document* document = assertDocument(errorString, frame);

Powered by Google App Engine
This is Rietveld 408576698