From 28f4165b9b0eb6266245b47edf913539cc4ebb0a Mon Sep 17 00:00:00 2001
From: "jsbell@chromium.org"
 <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 21 Nov 2013 03:08:54 +0000
Subject: IndexedDB: Support binary keys in Chromium back-end

Back-end support for binary values (Uint8Arrays) as IDB keys.

This requires Blink public API changes before landing.

(This is part 3 of a 4 part landing sequence.)

BUG=297304

Review URL: https://codereview.chromium.org/23439009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236380 0039d316-1c4b-4281-b951-d872f2087c98
---
 content/child/indexed_db/indexed_db_key_builders.cc | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'content/child')

diff --git a/content/child/indexed_db/indexed_db_key_builders.cc b/content/child/indexed_db/indexed_db_key_builders.cc
index 162546c..a17065f 100644
--- a/content/child/indexed_db/indexed_db_key_builders.cc
+++ b/content/child/indexed_db/indexed_db_key_builders.cc
@@ -10,6 +10,7 @@
 using blink::WebIDBKey;
 using blink::WebIDBKeyRange;
 using blink::WebIDBKeyTypeArray;
+using blink::WebIDBKeyTypeBinary;
 using blink::WebIDBKeyTypeDate;
 using blink::WebIDBKeyTypeInvalid;
 using blink::WebIDBKeyTypeMin;
@@ -44,6 +45,9 @@ IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) {
   switch (key.keyType()) {
     case WebIDBKeyTypeArray:
       return IndexedDBKey(CopyKeyArray(key));
+    case WebIDBKeyTypeBinary:
+      return IndexedDBKey(
+          std::string(key.binary().data(), key.binary().size()));
     case WebIDBKeyTypeString:
       return IndexedDBKey(key.string());
     case WebIDBKeyTypeDate:
@@ -72,6 +76,8 @@ WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) {
       }
       return WebIDBKey::createArray(web_array);
     }
+    case WebIDBKeyTypeBinary:
+      return WebIDBKey::createBinary(key.binary());
     case WebIDBKeyTypeString:
       return WebIDBKey::createString(key.string());
     case WebIDBKeyTypeDate:
-- 
cgit v1.1