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

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

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Remove unnecessary forward declaration. 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
« no previous file with comments | « content/child/indexed_db/webidbdatabase_impl.h ('k') | content/child/indexed_db/webidbfactory_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8a3f50ca154f5636478cd5007aece2d34567aa07 100644
--- a/content/child/indexed_db/webidbdatabase_impl.cc
+++ b/content/child/indexed_db/webidbdatabase_impl.cc
@@ -9,12 +9,11 @@
#include <string>
#include <vector>
-#include "base/stl_util.h"
+#include "base/strings/string16.h"
+#include "base/strings/stringprintf.h"
#include "content/child/indexed_db/indexed_db_callbacks_impl.h"
#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"
@@ -26,14 +25,12 @@
using blink::WebBlobInfo;
using blink::WebIDBCallbacks;
-using blink::WebIDBCursor;
using blink::WebIDBDatabase;
using blink::WebIDBDatabaseCallbacks;
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 +212,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 +222,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 +243,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));
@@ -304,7 +290,7 @@ void WebIDBDatabaseImpl::getAll(long long transaction_id,
void WebIDBDatabaseImpl::put(long long transaction_id,
long long object_store_id,
const blink::WebData& value,
- const blink::WebVector<WebBlobInfo>& web_blob_info,
+ const WebVector<WebBlobInfo>& web_blob_info,
const WebIDBKey& web_key,
blink::WebIDBPutMode put_mode,
WebIDBCallbacks* callbacks,
« no previous file with comments | « content/child/indexed_db/webidbdatabase_impl.h ('k') | content/child/indexed_db/webidbfactory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698