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

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

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address cmumford@ and jsbell@'s comments. 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.h
diff --git a/content/child/indexed_db/webidbdatabase_impl.h b/content/child/indexed_db/webidbdatabase_impl.h
index a348a4da24e8ddf93bfb25ba59752253bb2409bb..92ed48d6f93591659b857e4901dd5cc98b3c5e76 100644
--- a/content/child/indexed_db/webidbdatabase_impl.h
+++ b/content/child/indexed_db/webidbdatabase_impl.h
@@ -10,6 +10,9 @@
#include <set>
#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+#include "content/common/indexed_db/indexed_db.mojom.h"
+#include "content/common/indexed_db/indexed_db_constants.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
@@ -25,10 +28,12 @@ class WebString;
namespace content {
class ThreadSafeSender;
-class WebIDBDatabaseImpl : public blink::WebIDBDatabase {
+class CONTENT_EXPORT WebIDBDatabaseImpl
+ : public NON_EXPORTED_BASE(blink::WebIDBDatabase) {
public:
- WebIDBDatabaseImpl(int32_t ipc_database_id,
- ThreadSafeSender* thread_safe_sender);
+ WebIDBDatabaseImpl(indexed_db::mojom::DatabaseAssociatedPtrInfo database,
+ scoped_refptr<base::SingleThreadTaskRunner> io_runner,
+ scoped_refptr<ThreadSafeSender> thread_safe_sender);
~WebIDBDatabaseImpl() override;
// blink::WebIDBDatabase
@@ -124,8 +129,20 @@ class WebIDBDatabaseImpl : public blink::WebIDBDatabase {
const blink::WebVector<blink::WebString>& uuids) override;
private:
- int32_t ipc_database_id_;
+ FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, ValueSizeTest);
+ FRIEND_TEST_ALL_PREFIXES(WebIDBDatabaseImplTest, KeyAndValueSizeTest);
+
+ class IOThreadHelper;
+
+ // Maximum size (in bytes) of value/key pair allowed for put requests. Any
+ // requests larger than this size will be rejected.
+ // Used by unit tests to exercise behavior without allocating huge chunks
+ // of memory.
+ size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes;
+
+ IOThreadHelper* helper_;
std::set<int32_t> observer_ids_;
+ scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
};

Powered by Google App Engine
This is Rietveld 408576698