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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h

Issue 2320213004: Port IndexedDB open() and database callbacks to Mojo. (Closed)
Patch Set: Make DatabaseClient an associated interface. Created 4 years, 3 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef IDBOpenDBRequest_h 26 #ifndef IDBOpenDBRequest_h
27 #define IDBOpenDBRequest_h 27 #define IDBOpenDBRequest_h
28 28
29 #include "modules/ModulesExport.h" 29 #include "modules/ModulesExport.h"
30 #include "modules/indexeddb/IDBRequest.h" 30 #include "modules/indexeddb/IDBRequest.h"
31 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" 31 #include "public/platform/modules/indexeddb/WebIDBDatabase.h"
32 #include "public/platform/modules/indexeddb/indexed_db.mojom-blink.h"
32 #include <memory> 33 #include <memory>
33 34
34 namespace blink { 35 namespace blink {
35 36
36 class IDBDatabaseCallbacks;
37
38 class MODULES_EXPORT IDBOpenDBRequest final : public IDBRequest { 37 class MODULES_EXPORT IDBOpenDBRequest final : public IDBRequest {
39 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
40 public: 39 public:
41 static IDBOpenDBRequest* create(ScriptState*, IDBDatabaseCallbacks*, int64_t transactionId, int64_t version); 40 static IDBOpenDBRequest* create(ScriptState*, int64_t transactionId, int64_t version);
42 ~IDBOpenDBRequest() override; 41 ~IDBOpenDBRequest() override;
43 DECLARE_VIRTUAL_TRACE(); 42 DECLARE_VIRTUAL_TRACE();
44 43
45 using IDBRequest::onSuccess; 44 using IDBRequest::onSuccess;
46 45
46 void setClientRequest(indexed_db::mojom::blink::DatabaseClientAssociatedRequ est);
47
47 void onBlocked(int64_t existingVersion) override; 48 void onBlocked(int64_t existingVersion) override;
48 void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, co nst IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override; 49 void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, co nst IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override;
49 void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) override; 50 void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) override;
50 void onSuccess(int64_t oldVersion) override; 51 void onSuccess(int64_t oldVersion) override;
51 52
52 // EventTarget 53 // EventTarget
53 const AtomicString& interfaceName() const override; 54 const AtomicString& interfaceName() const override;
54 55
55 DEFINE_ATTRIBUTE_EVENT_LISTENER(blocked); 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(blocked);
56 DEFINE_ATTRIBUTE_EVENT_LISTENER(upgradeneeded); 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(upgradeneeded);
57 58
58 protected: 59 protected:
59 bool shouldEnqueueEvent() const override; 60 bool shouldEnqueueEvent() const override;
60 61
61 // EventTarget 62 // EventTarget
62 DispatchEventResult dispatchEventInternal(Event*) override; 63 DispatchEventResult dispatchEventInternal(Event*) override;
63 64
64 private: 65 private:
65 IDBOpenDBRequest(ScriptState*, IDBDatabaseCallbacks*, int64_t transactionId, int64_t version); 66 IDBOpenDBRequest(ScriptState*, int64_t transactionId, int64_t version);
66 67
67 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 68 indexed_db::mojom::blink::DatabaseClientAssociatedRequest m_clientRequest;
68 const int64_t m_transactionId; 69 const int64_t m_transactionId;
69 int64_t m_version; 70 int64_t m_version;
70 }; 71 };
71 72
72 } // namespace blink 73 } // namespace blink
73 74
74 #endif // IDBOpenDBRequest_h 75 #endif // IDBOpenDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698