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

Side by Side Diff: content/browser/indexed_db/indexed_db_leveldb_coding.cc

Issue 791923003: replace COMPILE_ASSERT with static_assert in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixups Created 5 years, 11 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 unified diff | Download patch
OLDNEW
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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 1249
1250 DCHECK(database_id_string.size() <= kMaxDatabaseIdSizeBytes); 1250 DCHECK(database_id_string.size() <= kMaxDatabaseIdSizeBytes);
1251 DCHECK(object_store_id_string.size() <= kMaxObjectStoreIdSizeBytes); 1251 DCHECK(object_store_id_string.size() <= kMaxObjectStoreIdSizeBytes);
1252 DCHECK(index_id_string.size() <= kMaxIndexIdSizeBytes); 1252 DCHECK(index_id_string.size() <= kMaxIndexIdSizeBytes);
1253 1253
1254 unsigned char first_byte = 1254 unsigned char first_byte =
1255 (database_id_string.size() - 1) << (kMaxObjectStoreIdSizeBits + 1255 (database_id_string.size() - 1) << (kMaxObjectStoreIdSizeBits +
1256 kMaxIndexIdSizeBits) | 1256 kMaxIndexIdSizeBits) |
1257 (object_store_id_string.size() - 1) << kMaxIndexIdSizeBits | 1257 (object_store_id_string.size() - 1) << kMaxIndexIdSizeBits |
1258 (index_id_string.size() - 1); 1258 (index_id_string.size() - 1);
1259 COMPILE_ASSERT(kMaxDatabaseIdSizeBits + kMaxObjectStoreIdSizeBits + 1259 static_assert(kMaxDatabaseIdSizeBits + kMaxObjectStoreIdSizeBits +
1260 kMaxIndexIdSizeBits == 1260 kMaxIndexIdSizeBits ==
1261 sizeof(first_byte) * 8, 1261 sizeof(first_byte) * 8,
1262 CANT_ENCODE_IDS); 1262 "cannot encode ids");
1263 std::string ret; 1263 std::string ret;
1264 ret.reserve(kDefaultInlineBufferSize); 1264 ret.reserve(kDefaultInlineBufferSize);
1265 ret.push_back(first_byte); 1265 ret.push_back(first_byte);
1266 ret.append(database_id_string); 1266 ret.append(database_id_string);
1267 ret.append(object_store_id_string); 1267 ret.append(object_store_id_string);
1268 ret.append(index_id_string); 1268 ret.append(index_id_string);
1269 1269
1270 DCHECK_LE(ret.size(), kDefaultInlineBufferSize); 1270 DCHECK_LE(ret.size(), kDefaultInlineBufferSize);
1271 return ret; 1271 return ret;
1272 } 1272 }
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { 2032 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const {
2033 scoped_ptr<IndexedDBKey> key; 2033 scoped_ptr<IndexedDBKey> key;
2034 StringPiece slice(encoded_primary_key_); 2034 StringPiece slice(encoded_primary_key_);
2035 if (!DecodeIDBKey(&slice, &key)) { 2035 if (!DecodeIDBKey(&slice, &key)) {
2036 // TODO(jsbell): Return error. 2036 // TODO(jsbell): Return error.
2037 } 2037 }
2038 return key.Pass(); 2038 return key.Pass();
2039 } 2039 }
2040 2040
2041 } // namespace content 2041 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.cc ('k') | content/browser/indexed_db/leveldb/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698