| 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 28 matching lines...) Expand all Loading... |
| 39 // | 39 // |
| 40 // Global metadata | 40 // Global metadata |
| 41 // --------------- | 41 // --------------- |
| 42 // The prefix is <0, 0, 0>, followed by a metadata type byte: | 42 // The prefix is <0, 0, 0>, followed by a metadata type byte: |
| 43 // | 43 // |
| 44 // <0, 0, 0, 0> => backing store schema version [SchemaVersionKey] | 44 // <0, 0, 0, 0> => backing store schema version [SchemaVersionKey] |
| 45 // <0, 0, 0, 1> => maximum allocated database [MaxDatabaseIdKey] | 45 // <0, 0, 0, 1> => maximum allocated database [MaxDatabaseIdKey] |
| 46 // <0, 0, 0, 2> => SerializedScriptValue version [DataVersionKey] | 46 // <0, 0, 0, 2> => SerializedScriptValue version [DataVersionKey] |
| 47 // <0, 0, 0, 3> | 47 // <0, 0, 0, 3> |
| 48 // => Blob journal | 48 // => Blob journal |
| 49 // The format of the journal is: {database_id, blobKey}*. | 49 // The format of the journal is: |
| 50 // {database_id (var int), blobKey (var int)}*. |
| 50 // If the blobKey is kAllBlobsKey, the whole database should be deleted. | 51 // If the blobKey is kAllBlobsKey, the whole database should be deleted. |
| 51 // [BlobJournalKey] | 52 // [BlobJournalKey] |
| 52 // <0, 0, 0, 4> => Live blob journal; same format. [LiveBlobJournalKey] | 53 // <0, 0, 0, 4> => Live blob journal; same format. [LiveBlobJournalKey] |
| 53 // <0, 0, 0, 100, database id> | 54 // <0, 0, 0, 100, database id> |
| 54 // => Existence implies the database id is in the free list | 55 // => Existence implies the database id is in the free list |
| 55 // [DatabaseFreeListKey] | 56 // [DatabaseFreeListKey] |
| 56 // <0, 0, 0, 201, origin, database name> => Database id [DatabaseNameKey] | 57 // <0, 0, 0, 201, origin, database name> => Database id [DatabaseNameKey] |
| 57 // | 58 // |
| 58 // | 59 // |
| 59 // Database metadata: [DatabaseMetaDataKey] | 60 // Database metadata: [DatabaseMetaDataKey] |
| (...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 2030 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
| 2030 scoped_ptr<IndexedDBKey> key; | 2031 scoped_ptr<IndexedDBKey> key; |
| 2031 StringPiece slice(encoded_primary_key_); | 2032 StringPiece slice(encoded_primary_key_); |
| 2032 if (!DecodeIDBKey(&slice, &key)) { | 2033 if (!DecodeIDBKey(&slice, &key)) { |
| 2033 // TODO(jsbell): Return error. | 2034 // TODO(jsbell): Return error. |
| 2034 } | 2035 } |
| 2035 return key.Pass(); | 2036 return key.Pass(); |
| 2036 } | 2037 } |
| 2037 | 2038 |
| 2038 } // namespace content | 2039 } // namespace content |
| OLD | NEW |