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_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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 const IndexedDBObserver::Options& options) { | 470 const IndexedDBObserver::Options& options) { |
471 pending_observers_.push_back(base::WrapUnique( | 471 pending_observers_.push_back(base::WrapUnique( |
472 new IndexedDBObserver(observer_id, object_store_ids_, options))); | 472 new IndexedDBObserver(observer_id, object_store_ids_, options))); |
473 } | 473 } |
474 | 474 |
475 void IndexedDBTransaction::RemovePendingObservers( | 475 void IndexedDBTransaction::RemovePendingObservers( |
476 const std::vector<int32_t>& pending_observer_ids) { | 476 const std::vector<int32_t>& pending_observer_ids) { |
477 const auto& it = std::remove_if( | 477 const auto& it = std::remove_if( |
478 pending_observers_.begin(), pending_observers_.end(), | 478 pending_observers_.begin(), pending_observers_.end(), |
479 [&pending_observer_ids](const std::unique_ptr<IndexedDBObserver>& o) { | 479 [&pending_observer_ids](const std::unique_ptr<IndexedDBObserver>& o) { |
480 return ContainsValue(pending_observer_ids, o->id()); | 480 return base::ContainsValue(pending_observer_ids, o->id()); |
481 }); | 481 }); |
482 if (it != pending_observers_.end()) | 482 if (it != pending_observers_.end()) |
483 pending_observers_.erase(it, pending_observers_.end()); | 483 pending_observers_.erase(it, pending_observers_.end()); |
484 } | 484 } |
485 | 485 |
486 void IndexedDBTransaction::AddObservation( | 486 void IndexedDBTransaction::AddObservation( |
487 int32_t connection_id, | 487 int32_t connection_id, |
488 std::unique_ptr<IndexedDBObservation> observation) { | 488 std::unique_ptr<IndexedDBObservation> observation) { |
489 auto it = connection_changes_map_.find(connection_id); | 489 auto it = connection_changes_map_.find(connection_id); |
490 if (it == connection_changes_map_.end()) { | 490 if (it == connection_changes_map_.end()) { |
491 it = connection_changes_map_ | 491 it = connection_changes_map_ |
492 .insert(std::make_pair( | 492 .insert(std::make_pair( |
493 connection_id, | 493 connection_id, |
494 base::WrapUnique(new IndexedDBObserverChanges()))) | 494 base::WrapUnique(new IndexedDBObserverChanges()))) |
495 .first; | 495 .first; |
496 } | 496 } |
497 it->second->AddObservation(std::move(observation)); | 497 it->second->AddObservation(std::move(observation)); |
498 } | 498 } |
499 | 499 |
500 void IndexedDBTransaction::RecordObserverForLastObservation( | 500 void IndexedDBTransaction::RecordObserverForLastObservation( |
501 int32_t connection_id, | 501 int32_t connection_id, |
502 int32_t observer_id) { | 502 int32_t observer_id) { |
503 auto it = connection_changes_map_.find(connection_id); | 503 auto it = connection_changes_map_.find(connection_id); |
504 DCHECK(it != connection_changes_map_.end()); | 504 DCHECK(it != connection_changes_map_.end()); |
505 it->second->RecordObserverForLastObservation(observer_id); | 505 it->second->RecordObserverForLastObservation(observer_id); |
506 } | 506 } |
507 | 507 |
508 } // namespace content | 508 } // namespace content |
OLD | NEW |