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

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

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Transactions working Created 3 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_transaction.h" 5 #include "content/browser/indexed_db/indexed_db_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 database_->SendObservations(std::move(connection_changes_map_)); 358 database_->SendObservations(std::move(connection_changes_map_));
359 connection_changes_map_.clear(); 359 connection_changes_map_.clear();
360 } 360 }
361 { 361 {
362 IDB_TRACE1( 362 IDB_TRACE1(
363 "IndexedDBTransaction::CommitPhaseTwo.TransactionCompleteCallbacks", 363 "IndexedDBTransaction::CommitPhaseTwo.TransactionCompleteCallbacks",
364 "txn.id", id()); 364 "txn.id", id());
365 callbacks_->OnComplete(*this); 365 callbacks_->OnComplete(*this);
366 } 366 }
367 if (!pending_observers_.empty() && connection_) { 367 if (!pending_observers_.empty() && connection_) {
368 // Observers observe all stores for a version change transaction.
369 if (mode_ == blink::WebIDBTransactionModeVersionChange) {
370 std::set<int64_t> object_stores;
cmumford 2017/01/09 21:31:25 object_store_ids
dmurph 2017/01/10 00:17:39 removed.
371 for (const auto& store_metadata : database_->metadata().object_stores) {
372 object_stores.insert(store_metadata.first);
373 }
374 for (auto& pending_observer : pending_observers_) {
375 pending_observer->set_object_store_ids(std::move(object_stores));
cmumford 2017/01/09 21:31:26 Won't this only set the first pending observer's s
dmurph 2017/01/10 00:17:39 Removed this feature as per https://github.com/WIC
376 }
377 }
368 connection_->ActivatePendingObservers(std::move(pending_observers_)); 378 connection_->ActivatePendingObservers(std::move(pending_observers_));
369 pending_observers_.clear(); 379 pending_observers_.clear();
370 } 380 }
371 381
372 database_->TransactionFinished(this, true); 382 database_->TransactionFinished(this, true);
373 // RemoveTransaction will delete |this|. 383 // RemoveTransaction will delete |this|.
374 connection_->RemoveTransaction(id_); 384 connection_->RemoveTransaction(id_);
375 return s; 385 return s;
376 } else { 386 } else {
377 while (!abort_task_stack_.empty()) 387 while (!abort_task_stack_.empty())
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 auto it = connection_changes_map_.find(connection_id); 513 auto it = connection_changes_map_.find(connection_id);
504 if (it == connection_changes_map_.end()) { 514 if (it == connection_changes_map_.end()) {
505 it = connection_changes_map_ 515 it = connection_changes_map_
506 .insert(std::make_pair( 516 .insert(std::make_pair(
507 connection_id, ::indexed_db::mojom::ObserverChanges::New())) 517 connection_id, ::indexed_db::mojom::ObserverChanges::New()))
508 .first; 518 .first;
509 } 519 }
510 it->second->observations.push_back(std::move(observation)); 520 it->second->observations.push_back(std::move(observation));
511 } 521 }
512 522
513 void IndexedDBTransaction::RecordObserverForLastObservation( 523 ::indexed_db::mojom::ObserverChangesPtr*
cmumford 2017/01/09 21:31:26 function should be const, *and* return a const Obs
dmurph 2017/01/10 00:17:39 Neither can be const, as I need to modify the retu
514 int32_t connection_id, 524 IndexedDBTransaction::GetPendingChangesForConnection(int32_t connection_id) {
515 int32_t observer_id) {
516 auto it = connection_changes_map_.find(connection_id); 525 auto it = connection_changes_map_.find(connection_id);
517 DCHECK(it != connection_changes_map_.end()); 526 if (it != connection_changes_map_.end())
518 it->second->observation_index_map[observer_id].push_back( 527 return &it->second;
519 it->second->observations.size() - 1); 528 return nullptr;
520 } 529 }
521 530
522 } // namespace content 531 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698