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

Unified Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 1321583002: IndexedDB: Make getAll() requests fail if result exceeds IPC limits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename constant Created 5 years, 4 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
Index: content/browser/indexed_db/indexed_db_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 8628768d91f5efb93067fb2f3764af8e3290862c..31d0e69224510ec3b28d2178b911f81455e67225 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -132,7 +132,8 @@ scoped_refptr<IndexedDBDatabase> IndexedDBDatabase::Create(
const Identifier& unique_identifier,
leveldb::Status* s) {
scoped_refptr<IndexedDBDatabase> database =
- new IndexedDBDatabase(name, backing_store, factory, unique_identifier);
+ IndexedDBClassFactory::Get()->CreateIndexedDBDatabase(
+ name, backing_store, factory, unique_identifier);
*s = database->OpenInternal();
if (s->ok())
return database;
@@ -227,6 +228,10 @@ IndexedDBDatabase::~IndexedDBDatabase() {
DCHECK(pending_delete_calls_.empty());
}
+size_t IndexedDBDatabase::GetMaxMessageSizeInBytes() const {
+ return kMaxIDBMessageSizeInBytes;
+}
+
scoped_ptr<IndexedDBConnection> IndexedDBDatabase::CreateConnection(
scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
int child_process_id) {
@@ -853,9 +858,11 @@ void IndexedDBDatabase::GetAllOperation(
response_size += return_key.size_estimate();
else
response_size += return_value.SizeEstimate();
- if (response_size > IPC::Channel::kMaximumMessageSize) {
- // TODO(cmumford): Reach this limit more gracefully (crbug.com/478949)
- break;
+ if (response_size > GetMaxMessageSizeInBytes()) {
+ callbacks->OnError(
+ IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError,
+ "Maximum IPC message size exceeded."));
+ return;
}
if (cursor_type == indexed_db::CURSOR_KEY_ONLY)

Powered by Google App Engine
This is Rietveld 408576698