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

Unified Diff: content/common/indexed_db/indexed_db_key_path.cc

Issue 19752007: Use builders to convert between WebKit and content IDB types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « content/common/indexed_db/indexed_db_key_path.h ('k') | content/common/indexed_db/indexed_db_key_range.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/indexed_db/indexed_db_key_path.cc
diff --git a/content/common/indexed_db/indexed_db_key_path.cc b/content/common/indexed_db/indexed_db_key_path.cc
index 4249f53bf25603d1ba8c1a273e184915c8416357..be6adfd31ff98be162fca79479da6b0bb64ec736 100644
--- a/content/common/indexed_db/indexed_db_key_path.cc
+++ b/content/common/indexed_db/indexed_db_key_path.cc
@@ -5,26 +5,12 @@
#include "content/common/indexed_db/indexed_db_key_path.h"
#include "base/logging.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
namespace content {
-using WebKit::WebIDBKeyPath;
using WebKit::WebIDBKeyPathTypeArray;
using WebKit::WebIDBKeyPathTypeNull;
using WebKit::WebIDBKeyPathTypeString;
-using WebKit::WebString;
-using WebKit::WebVector;
-
-namespace {
-static std::vector<string16> CopyArray(const WebVector<WebString>& array) {
- std::vector<string16> copy(array.size());
- for (size_t i = 0; i < array.size(); ++i)
- copy[i] = array[i];
- return copy;
-}
-} // namespace
IndexedDBKeyPath::IndexedDBKeyPath() : type_(WebIDBKeyPathTypeNull) {}
@@ -34,20 +20,8 @@ IndexedDBKeyPath::IndexedDBKeyPath(const string16& string)
IndexedDBKeyPath::IndexedDBKeyPath(const std::vector<string16>& array)
: type_(WebIDBKeyPathTypeArray), array_(array) {}
-IndexedDBKeyPath::IndexedDBKeyPath(const WebIDBKeyPath& other)
- : type_(other.keyPathType()),
- string_(type_ == WebIDBKeyPathTypeString
- ? static_cast<string16>(other.string()) : string16()),
- array_(type_ == WebIDBKeyPathTypeArray
- ? CopyArray(other.array()) : std::vector<string16>()) {}
-
IndexedDBKeyPath::~IndexedDBKeyPath() {}
-bool IndexedDBKeyPath::IsValid() const {
- WebIDBKeyPath key_path = *this;
- return key_path.isValid();
-}
-
const std::vector<string16>& IndexedDBKeyPath::array() const {
DCHECK(type_ == WebKit::WebIDBKeyPathTypeArray);
return array_;
@@ -74,17 +48,4 @@ bool IndexedDBKeyPath::operator==(const IndexedDBKeyPath& other) const {
return false;
}
-IndexedDBKeyPath::operator WebIDBKeyPath() const {
- switch (type_) {
- case WebIDBKeyPathTypeArray:
- return WebIDBKeyPath::create(array_);
- case WebIDBKeyPathTypeString:
- return WebIDBKeyPath::create(WebString(string_));
- case WebIDBKeyPathTypeNull:
- return WebIDBKeyPath::createNull();
- }
- NOTREACHED();
- return WebIDBKeyPath::createNull();
-}
-
} // namespace content
« no previous file with comments | « content/common/indexed_db/indexed_db_key_path.h ('k') | content/common/indexed_db/indexed_db_key_range.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698