| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 5 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 int DatabaseNameKey::Compare(const DatabaseNameKey& other) { | 1393 int DatabaseNameKey::Compare(const DatabaseNameKey& other) { |
| 1394 if (int x = origin_.compare(other.origin_)) | 1394 if (int x = origin_.compare(other.origin_)) |
| 1395 return x; | 1395 return x; |
| 1396 return database_name_.compare(other.database_name_); | 1396 return database_name_.compare(other.database_name_); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 bool DatabaseMetaDataKey::IsValidBlobKey(int64 blob_key) { | 1399 bool DatabaseMetaDataKey::IsValidBlobKey(int64 blob_key) { |
| 1400 return blob_key >= kBlobKeyGeneratorInitialNumber; | 1400 return blob_key >= kBlobKeyGeneratorInitialNumber; |
| 1401 } | 1401 } |
| 1402 | 1402 |
| 1403 const int64 DatabaseMetaDataKey::kAllBlobsKey = 1; |
| 1404 const int64 DatabaseMetaDataKey::kBlobKeyGeneratorInitialNumber = 2; |
| 1405 const int64 DatabaseMetaDataKey::kInvalidBlobKey = -1; |
| 1406 |
| 1403 std::string DatabaseMetaDataKey::Encode(int64 database_id, | 1407 std::string DatabaseMetaDataKey::Encode(int64 database_id, |
| 1404 MetaDataType meta_data_type) { | 1408 MetaDataType meta_data_type) { |
| 1405 KeyPrefix prefix(database_id); | 1409 KeyPrefix prefix(database_id); |
| 1406 std::string ret = prefix.Encode(); | 1410 std::string ret = prefix.Encode(); |
| 1407 ret.push_back(meta_data_type); | 1411 ret.push_back(meta_data_type); |
| 1408 return ret; | 1412 return ret; |
| 1409 } | 1413 } |
| 1410 | 1414 |
| 1411 ObjectStoreMetaDataKey::ObjectStoreMetaDataKey() | 1415 ObjectStoreMetaDataKey::ObjectStoreMetaDataKey() |
| 1412 : object_store_id_(-1), meta_data_type_(-1) {} | 1416 : object_store_id_(-1), meta_data_type_(-1) {} |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 2007 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
| 2004 scoped_ptr<IndexedDBKey> key; | 2008 scoped_ptr<IndexedDBKey> key; |
| 2005 StringPiece slice(encoded_primary_key_); | 2009 StringPiece slice(encoded_primary_key_); |
| 2006 if (!DecodeIDBKey(&slice, &key)) { | 2010 if (!DecodeIDBKey(&slice, &key)) { |
| 2007 // TODO(jsbell): Return error. | 2011 // TODO(jsbell): Return error. |
| 2008 } | 2012 } |
| 2009 return key.Pass(); | 2013 return key.Pass(); |
| 2010 } | 2014 } |
| 2011 | 2015 |
| 2012 } // namespace content | 2016 } // namespace content |
| OLD | NEW |