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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Fixed compilation errors on Windows and no-DCHECKs. Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // during this destructor. 169 // during this destructor.
170 DCHECK(state_ == kFinished || !GetExecutionContext()); 170 DCHECK(state_ == kFinished || !GetExecutionContext());
171 DCHECK(request_list_.IsEmpty() || !GetExecutionContext()); 171 DCHECK(request_list_.IsEmpty() || !GetExecutionContext());
172 } 172 }
173 173
174 DEFINE_TRACE(IDBTransaction) { 174 DEFINE_TRACE(IDBTransaction) {
175 visitor->Trace(database_); 175 visitor->Trace(database_);
176 visitor->Trace(open_db_request_); 176 visitor->Trace(open_db_request_);
177 visitor->Trace(error_); 177 visitor->Trace(error_);
178 visitor->Trace(request_list_); 178 visitor->Trace(request_list_);
179 visitor->Trace(result_queue_);
179 visitor->Trace(object_store_map_); 180 visitor->Trace(object_store_map_);
180 visitor->Trace(old_store_metadata_); 181 visitor->Trace(old_store_metadata_);
181 visitor->Trace(deleted_indexes_); 182 visitor->Trace(deleted_indexes_);
182 EventTargetWithInlineData::Trace(visitor); 183 EventTargetWithInlineData::Trace(visitor);
183 ContextLifecycleObserver::Trace(visitor); 184 ContextLifecycleObserver::Trace(visitor);
184 } 185 }
185 186
186 void IDBTransaction::SetError(DOMException* error) { 187 void IDBTransaction::SetError(DOMException* error) {
187 DCHECK_NE(state_, kFinished); 188 DCHECK_NE(state_, kFinished);
188 DCHECK(error); 189 DCHECK(error);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if (BackendDB()) 371 if (BackendDB())
371 BackendDB()->Abort(id_); 372 BackendDB()->Abort(id_);
372 } 373 }
373 374
374 void IDBTransaction::RegisterRequest(IDBRequest* request) { 375 void IDBTransaction::RegisterRequest(IDBRequest* request) {
375 DCHECK(request); 376 DCHECK(request);
376 DCHECK_EQ(state_, kActive); 377 DCHECK_EQ(state_, kActive);
377 request_list_.insert(request); 378 request_list_.insert(request);
378 } 379 }
379 380
380 void IDBTransaction::UnregisterRequest(IDBRequest* request) { 381 void IDBTransaction::UnregisterRequest(IDBRequest* request) {
jsbell 2017/05/05 00:29:37 Seems like we could have a DCHECK here that the re
pwnall 2017/05/11 23:54:24 Done.
381 DCHECK(request); 382 DCHECK(request);
382 // If we aborted the request, it will already have been removed. 383 // If we aborted the request, it will already have been removed.
383 request_list_.erase(request); 384 request_list_.erase(request);
384 } 385 }
385 386
387 void IDBTransaction::EnqueueResult(IDBRequestQueueItem* result) {
388 DCHECK(result);
389 DCHECK(HasQueuedResult() || !result->IsReady());
390
391 result_queue_.push_back(result);
392 }
393
394 void IDBTransaction::OnResultReady() {
395 while (!result_queue_.empty()) {
396 IDBRequestQueueItem* result = result_queue_.front();
397 if (!result->IsReady())
398 break;
399
400 result->FireCallback();
401 result_queue_.pop_front();
402 }
403 }
404
386 void IDBTransaction::OnAbort(DOMException* error) { 405 void IDBTransaction::OnAbort(DOMException* error) {
387 IDB_TRACE("IDBTransaction::onAbort"); 406 IDB_TRACE("IDBTransaction::onAbort");
388 if (!GetExecutionContext()) { 407 if (!GetExecutionContext()) {
389 Finished(); 408 Finished();
390 return; 409 return;
391 } 410 }
392 411
393 DCHECK_NE(state_, kFinished); 412 DCHECK_NE(state_, kFinished);
394 if (state_ != kFinishing) { 413 if (state_ != kFinishing) {
395 // Abort was not triggered by front-end. 414 // Abort was not triggered by front-end.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 IDBObjectStore* object_store = it.key; 633 IDBObjectStore* object_store = it.key;
615 object_store->ClearIndexCache(); 634 object_store->ClearIndexCache();
616 } 635 }
617 old_store_metadata_.clear(); 636 old_store_metadata_.clear();
618 637
619 deleted_indexes_.clear(); 638 deleted_indexes_.clear();
620 deleted_object_stores_.clear(); 639 deleted_object_stores_.clear();
621 } 640 }
622 641
623 } // namespace blink 642 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698