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

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

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some (incomplete) work on struct traits. Created 4 years, 5 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 24 matching lines...) Expand all
35 #include "modules/EventTargetModules.h" 35 #include "modules/EventTargetModules.h"
36 #include "modules/ModulesExport.h" 36 #include "modules/ModulesExport.h"
37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" 37 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
38 #include "modules/indexeddb/IDBHistograms.h" 38 #include "modules/indexeddb/IDBHistograms.h"
39 #include "modules/indexeddb/IDBMetadata.h" 39 #include "modules/indexeddb/IDBMetadata.h"
40 #include "modules/indexeddb/IDBObjectStore.h" 40 #include "modules/indexeddb/IDBObjectStore.h"
41 #include "modules/indexeddb/IDBObjectStoreParameters.h" 41 #include "modules/indexeddb/IDBObjectStoreParameters.h"
42 #include "modules/indexeddb/IDBTransaction.h" 42 #include "modules/indexeddb/IDBTransaction.h"
43 #include "modules/indexeddb/IndexedDB.h" 43 #include "modules/indexeddb/IndexedDB.h"
44 #include "platform/heap/Handle.h" 44 #include "platform/heap/Handle.h"
45 #include "public/platform/modules/indexeddb/WebIDBDatabase.h"
46 #include "wtf/PassRefPtr.h" 45 #include "wtf/PassRefPtr.h"
47 #include "wtf/RefPtr.h" 46 #include "wtf/RefPtr.h"
48 #include <memory> 47 #include <memory>
49 48
50 namespace blink { 49 namespace blink {
51 50
52 class DOMException; 51 class DOMException;
53 class ExceptionState; 52 class ExceptionState;
54 class ExecutionContext; 53 class ExecutionContext;
54 class IDBDatabaseProxy;
55 55
56 class MODULES_EXPORT IDBDatabase final 56 class MODULES_EXPORT IDBDatabase final
57 : public EventTargetWithInlineData 57 : public EventTargetWithInlineData
58 , public ActiveScriptWrappable 58 , public ActiveScriptWrappable
59 , public ActiveDOMObject { 59 , public ActiveDOMObject {
60 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); 60 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase);
61 DEFINE_WRAPPERTYPEINFO(); 61 DEFINE_WRAPPERTYPEINFO();
62 public: 62 public:
63 static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase >, IDBDatabaseCallbacks*); 63 static IDBDatabase* create(ExecutionContext*, std::unique_ptr<IDBDatabasePro xy>, IDBDatabaseCallbacks*);
64 ~IDBDatabase() override; 64 ~IDBDatabase() override;
65 DECLARE_VIRTUAL_TRACE(); 65 DECLARE_VIRTUAL_TRACE();
66 66
67 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat a; } 67 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat a; }
68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); 68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&);
69 void indexDeleted(int64_t objectStoreId, int64_t indexId); 69 void indexDeleted(int64_t objectStoreId, int64_t indexId);
70 void transactionCreated(IDBTransaction*); 70 void transactionCreated(IDBTransaction*);
71 void transactionFinished(const IDBTransaction*); 71 void transactionFinished(const IDBTransaction*);
72 72
73 // Implement the IDL 73 // Implement the IDL
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const IDBDatabaseMetadata& metadata() const { return m_metadata; } 105 const IDBDatabaseMetadata& metadata() const { return m_metadata; }
106 void enqueueEvent(Event*); 106 void enqueueEvent(Event*);
107 107
108 int64_t findObjectStoreId(const String& name) const; 108 int64_t findObjectStoreId(const String& name) const;
109 bool containsObjectStore(const String& name) const 109 bool containsObjectStore(const String& name) const
110 { 110 {
111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId;
112 } 112 }
113 113
114 // Will return nullptr if this database is stopped. 114 // Will return nullptr if this database is stopped.
115 WebIDBDatabase* backend() const { return m_backend.get(); } 115 IDBDatabaseProxy* backend() const { return m_backend.get(); }
116 116
117 static int64_t nextTransactionId(); 117 static int64_t nextTransactionId();
118 118
119 static const char indexDeletedErrorMessage[]; 119 static const char indexDeletedErrorMessage[];
120 static const char isKeyCursorErrorMessage[]; 120 static const char isKeyCursorErrorMessage[];
121 static const char noKeyOrKeyRangeErrorMessage[]; 121 static const char noKeyOrKeyRangeErrorMessage[];
122 static const char noSuchIndexErrorMessage[]; 122 static const char noSuchIndexErrorMessage[];
123 static const char noSuchObjectStoreErrorMessage[]; 123 static const char noSuchObjectStoreErrorMessage[];
124 static const char noValueErrorMessage[]; 124 static const char noValueErrorMessage[];
125 static const char notValidKeyErrorMessage[]; 125 static const char notValidKeyErrorMessage[];
126 static const char notVersionChangeTransactionErrorMessage[]; 126 static const char notVersionChangeTransactionErrorMessage[];
127 static const char objectStoreDeletedErrorMessage[]; 127 static const char objectStoreDeletedErrorMessage[];
128 static const char requestNotFinishedErrorMessage[]; 128 static const char requestNotFinishedErrorMessage[];
129 static const char sourceDeletedErrorMessage[]; 129 static const char sourceDeletedErrorMessage[];
130 static const char transactionFinishedErrorMessage[]; 130 static const char transactionFinishedErrorMessage[];
131 static const char transactionInactiveErrorMessage[]; 131 static const char transactionInactiveErrorMessage[];
132 static const char transactionReadOnlyErrorMessage[]; 132 static const char transactionReadOnlyErrorMessage[];
133 static const char databaseClosedErrorMessage[]; 133 static const char databaseClosedErrorMessage[];
134 134
135 static void recordApiCallsHistogram(IndexedDatabaseMethods); 135 static void recordApiCallsHistogram(IndexedDatabaseMethods);
136 136
137 protected: 137 protected:
138 // EventTarget 138 // EventTarget
139 DispatchEventResult dispatchEventInternal(Event*) override; 139 DispatchEventResult dispatchEventInternal(Event*) override;
140 140
141 private: 141 private:
142 IDBDatabase(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseC allbacks*); 142 IDBDatabase(ExecutionContext*, std::unique_ptr<IDBDatabaseProxy>, IDBDatabas eCallbacks*);
143 143
144 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo l autoIncrement, ExceptionState&); 144 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo l autoIncrement, ExceptionState&);
145 void closeConnection(); 145 void closeConnection();
146 146
147 IDBDatabaseMetadata m_metadata; 147 IDBDatabaseMetadata m_metadata;
148 std::unique_ptr<WebIDBDatabase> m_backend; 148 std::unique_ptr<IDBDatabaseProxy> m_backend;
149 Member<IDBTransaction> m_versionChangeTransaction; 149 Member<IDBTransaction> m_versionChangeTransaction;
150 HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions; 150 HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions;
151 151
152 bool m_closePending = false; 152 bool m_closePending = false;
153 bool m_contextStopped = false; 153 bool m_contextStopped = false;
154 154
155 // Keep track of the versionchange events waiting to be fired on this 155 // Keep track of the versionchange events waiting to be fired on this
156 // database so that we can cancel them if the database closes. 156 // database so that we can cancel them if the database closes.
157 HeapVector<Member<Event>> m_enqueuedEvents; 157 HeapVector<Member<Event>> m_enqueuedEvents;
158 158
159 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 159 Member<IDBDatabaseCallbacks> m_databaseCallbacks;
160 }; 160 };
161 161
162 } // namespace blink 162 } // namespace blink
163 163
164 #endif // IDBDatabase_h 164 #endif // IDBDatabase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698