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

Unified Diff: content/child/indexed_db/webidbdatabase_impl.cc

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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/child/indexed_db/webidbdatabase_impl.cc
diff --git a/content/child/indexed_db/webidbdatabase_impl.cc b/content/child/indexed_db/webidbdatabase_impl.cc
index 849c601faf73d9571b2c8afa38f755d8dcdd721d..802f97b3edab19008ef4f900c47cd63b413e4eb4 100644
--- a/content/child/indexed_db/webidbdatabase_impl.cc
+++ b/content/child/indexed_db/webidbdatabase_impl.cc
@@ -14,7 +14,6 @@
#include "content/child/indexed_db/indexed_db_dispatcher.h"
#include "content/child/indexed_db/indexed_db_key_builders.h"
#include "content/child/worker_thread_registry.h"
-#include "content/common/indexed_db/indexed_db_messages.h"
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
#include "third_party/WebKit/public/platform/WebBlobInfo.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -33,7 +32,6 @@ using blink::WebIDBMetadata;
using blink::WebIDBKey;
using blink::WebIDBKeyPath;
using blink::WebIDBKeyRange;
-using blink::WebIDBObserver;
using blink::WebString;
using blink::WebVector;
using indexed_db::mojom::CallbacksAssociatedPtrInfo;
@@ -215,10 +213,6 @@ void WebIDBDatabaseImpl::createTransaction(
}
void WebIDBDatabaseImpl::close() {
- std::vector<int32_t> remove_observer_ids(observer_ids_.begin(),
- observer_ids_.end());
- IndexedDBDispatcher::ThreadSpecificInstance()->RemoveObservers(
- remove_observer_ids);
io_runner_->PostTask(
FROM_HERE, base::Bind(&IOThreadHelper::Close, base::Unretained(helper_)));
}
@@ -229,23 +223,20 @@ void WebIDBDatabaseImpl::versionChangeIgnored() {
base::Unretained(helper_)));
}
-int32_t WebIDBDatabaseImpl::addObserver(
- std::unique_ptr<WebIDBObserver> observer,
- long long transaction_id) {
- WebIDBObserver* observer_ptr = observer.get();
- int32_t observer_id =
- IndexedDBDispatcher::ThreadSpecificInstance()->RegisterObserver(
- std::move(observer));
- observer_ids_.insert(observer_id);
+void WebIDBDatabaseImpl::addObserver(
+ long long transaction_id,
+ int32_t observer_id,
+ bool include_transaction,
+ bool no_records,
+ bool values,
+ const std::bitset<blink::WebIDBOperationTypeCount>& operation_types) {
static_assert(blink::WebIDBOperationTypeCount < sizeof(uint16_t) * CHAR_BIT,
"WebIDBOperationType Count exceeds size of uint16_t");
io_runner_->PostTask(
FROM_HERE,
base::Bind(&IOThreadHelper::AddObserver, base::Unretained(helper_),
- transaction_id, observer_id, observer_ptr->transaction(),
- observer_ptr->noRecords(), observer_ptr->values(),
- observer_ptr->operationTypes().to_ulong()));
- return observer_id;
+ transaction_id, observer_id, include_transaction, no_records,
+ values, operation_types.to_ulong()));
}
void WebIDBDatabaseImpl::removeObservers(
@@ -253,11 +244,7 @@ void WebIDBDatabaseImpl::removeObservers(
std::vector<int32_t> remove_observer_ids(
observer_ids_to_remove.data(),
observer_ids_to_remove.data() + observer_ids_to_remove.size());
- for (int32_t id : observer_ids_to_remove)
- observer_ids_.erase(id);
- IndexedDBDispatcher::ThreadSpecificInstance()->RemoveObservers(
- remove_observer_ids);
io_runner_->PostTask(
FROM_HERE, base::Bind(&IOThreadHelper::RemoveObservers,
base::Unretained(helper_), remove_observer_ids));

Powered by Google App Engine
This is Rietveld 408576698