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

Unified Diff: content/child/indexed_db/indexed_db_key_builders.cc

Issue 2537953003: WebString: makes string16 conversions explicit (part 1: blink, content) (Closed)
Patch Set: fix Created 4 years 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: content/child/indexed_db/indexed_db_key_builders.cc
diff --git a/content/child/indexed_db/indexed_db_key_builders.cc b/content/child/indexed_db/indexed_db_key_builders.cc
index d0da139c1859b3dfaf669765617fa6a505b4532b..005a2f52cf111b2cd32d62a845624b80904fbcff 100644
--- a/content/child/indexed_db/indexed_db_key_builders.cc
+++ b/content/child/indexed_db/indexed_db_key_builders.cc
@@ -11,6 +11,7 @@
#include <vector>
#include "base/logging.h"
+#include "third_party/WebKit/public/platform/StringVectorCopier.h"
#include "third_party/WebKit/public/platform/WebVector.h"
using blink::WebIDBKey;
@@ -40,11 +41,10 @@ static std::vector<base::string16> CopyArray(
const WebVector<WebString>& array) {
std::vector<base::string16> copy(array.size());
for (size_t i = 0; i < array.size(); ++i)
- copy[i] = array[i];
+ copy[i] = array[i].utf16();
return copy;
}
-
namespace content {
IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) {
@@ -55,7 +55,7 @@ IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) {
return IndexedDBKey(
std::string(key.binary().data(), key.binary().size()));
case WebIDBKeyTypeString:
- return IndexedDBKey(key.string());
+ return IndexedDBKey(key.string().utf16());
case WebIDBKeyTypeDate:
return IndexedDBKey(key.date(), WebIDBKeyTypeDate);
case WebIDBKeyTypeNumber:
@@ -83,7 +83,7 @@ WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) {
case WebIDBKeyTypeBinary:
return WebIDBKey::createBinary(key.binary());
case WebIDBKeyTypeString:
- return WebIDBKey::createString(key.string());
+ return WebIDBKey::createString(WebString::fromUTF16(key.string()));
case WebIDBKeyTypeDate:
return WebIDBKey::createDate(key.date());
case WebIDBKeyTypeNumber:
@@ -119,7 +119,7 @@ IndexedDBKeyPath IndexedDBKeyPathBuilder::Build(
const blink::WebIDBKeyPath& key_path) {
switch (key_path.keyPathType()) {
case blink::WebIDBKeyPathTypeString:
- return IndexedDBKeyPath(key_path.string());
+ return IndexedDBKeyPath(key_path.string().utf16());
case blink::WebIDBKeyPathTypeArray:
return IndexedDBKeyPath(CopyArray(key_path.array()));
case blink::WebIDBKeyPathTypeNull:
@@ -134,9 +134,11 @@ blink::WebIDBKeyPath WebIDBKeyPathBuilder::Build(
const IndexedDBKeyPath& key_path) {
switch (key_path.type()) {
case blink::WebIDBKeyPathTypeString:
- return blink::WebIDBKeyPath::create(WebString(key_path.string()));
+ return blink::WebIDBKeyPath::create(
+ WebString::fromUTF16(key_path.string()));
case blink::WebIDBKeyPathTypeArray:
- return blink::WebIDBKeyPath::create(CopyArray(key_path.array()));
+ return blink::WebIDBKeyPath::create(
+ blink::CopyStringVectorFromUTF16(key_path.array()));
case blink::WebIDBKeyPathTypeNull:
return blink::WebIDBKeyPath::createNull();
default:
« no previous file with comments | « content/child/indexed_db/indexed_db_database_callbacks_impl.cc ('k') | content/child/indexed_db/webidbdatabase_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698