1/*
2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include "config.h"
26
27#if ENABLE(INDEXED_DATABASE)
28
29#include "WebIDBConnectionToClient.h"
30
31#include "ArgumentCoders.h"
32#include "Decoder.h"
33#include "HandleMessage.h"
34#include "WebCoreArgumentCoders.h"
35#include "WebIDBConnectionToClientMessages.h"
36#include <WebCore/IDBCursorInfo.h>
37#include <WebCore/IDBGetAllRecordsData.h>
38#include <WebCore/IDBGetRecordData.h>
39#include <WebCore/IDBIndexInfo.h>
40#include <WebCore/IDBIterateCursorData.h>
41#include <WebCore/IDBKeyData.h>
42#include <WebCore/IDBKeyRangeData.h>
43#include <WebCore/IDBObjectStoreInfo.h>
44#include <WebCore/IDBRequestData.h>
45#include <WebCore/IDBResourceIdentifier.h>
46#include <WebCore/IDBTransactionInfo.h>
47#include <WebCore/IDBValue.h>
48#include <WebCore/IndexedDB.h>
49#include <WebCore/SecurityOriginData.h>
50#include <wtf/text/WTFString.h>
51
52namespace WebKit {
53
54void WebIDBConnectionToClient::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
55{
56 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DeleteDatabase::name()) {
57 IPC::handleMessage<Messages::WebIDBConnectionToClient::DeleteDatabase>(decoder, this, &WebIDBConnectionToClient::deleteDatabase);
58 return;
59 }
60 if (decoder.messageName() == Messages::WebIDBConnectionToClient::OpenDatabase::name()) {
61 IPC::handleMessage<Messages::WebIDBConnectionToClient::OpenDatabase>(decoder, this, &WebIDBConnectionToClient::openDatabase);
62 return;
63 }
64 if (decoder.messageName() == Messages::WebIDBConnectionToClient::AbortTransaction::name()) {
65 IPC::handleMessage<Messages::WebIDBConnectionToClient::AbortTransaction>(decoder, this, &WebIDBConnectionToClient::abortTransaction);
66 return;
67 }
68 if (decoder.messageName() == Messages::WebIDBConnectionToClient::CommitTransaction::name()) {
69 IPC::handleMessage<Messages::WebIDBConnectionToClient::CommitTransaction>(decoder, this, &WebIDBConnectionToClient::commitTransaction);
70 return;
71 }
72 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DidFinishHandlingVersionChangeTransaction::name()) {
73 IPC::handleMessage<Messages::WebIDBConnectionToClient::DidFinishHandlingVersionChangeTransaction>(decoder, this, &WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction);
74 return;
75 }
76 if (decoder.messageName() == Messages::WebIDBConnectionToClient::CreateObjectStore::name()) {
77 IPC::handleMessage<Messages::WebIDBConnectionToClient::CreateObjectStore>(decoder, this, &WebIDBConnectionToClient::createObjectStore);
78 return;
79 }
80 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DeleteObjectStore::name()) {
81 IPC::handleMessage<Messages::WebIDBConnectionToClient::DeleteObjectStore>(decoder, this, &WebIDBConnectionToClient::deleteObjectStore);
82 return;
83 }
84 if (decoder.messageName() == Messages::WebIDBConnectionToClient::RenameObjectStore::name()) {
85 IPC::handleMessage<Messages::WebIDBConnectionToClient::RenameObjectStore>(decoder, this, &WebIDBConnectionToClient::renameObjectStore);
86 return;
87 }
88 if (decoder.messageName() == Messages::WebIDBConnectionToClient::ClearObjectStore::name()) {
89 IPC::handleMessage<Messages::WebIDBConnectionToClient::ClearObjectStore>(decoder, this, &WebIDBConnectionToClient::clearObjectStore);
90 return;
91 }
92 if (decoder.messageName() == Messages::WebIDBConnectionToClient::CreateIndex::name()) {
93 IPC::handleMessage<Messages::WebIDBConnectionToClient::CreateIndex>(decoder, this, &WebIDBConnectionToClient::createIndex);
94 return;
95 }
96 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DeleteIndex::name()) {
97 IPC::handleMessage<Messages::WebIDBConnectionToClient::DeleteIndex>(decoder, this, &WebIDBConnectionToClient::deleteIndex);
98 return;
99 }
100 if (decoder.messageName() == Messages::WebIDBConnectionToClient::RenameIndex::name()) {
101 IPC::handleMessage<Messages::WebIDBConnectionToClient::RenameIndex>(decoder, this, &WebIDBConnectionToClient::renameIndex);
102 return;
103 }
104 if (decoder.messageName() == Messages::WebIDBConnectionToClient::PutOrAdd::name()) {
105 IPC::handleMessage<Messages::WebIDBConnectionToClient::PutOrAdd>(decoder, this, &WebIDBConnectionToClient::putOrAdd);
106 return;
107 }
108 if (decoder.messageName() == Messages::WebIDBConnectionToClient::GetRecord::name()) {
109 IPC::handleMessage<Messages::WebIDBConnectionToClient::GetRecord>(decoder, this, &WebIDBConnectionToClient::getRecord);
110 return;
111 }
112 if (decoder.messageName() == Messages::WebIDBConnectionToClient::GetAllRecords::name()) {
113 IPC::handleMessage<Messages::WebIDBConnectionToClient::GetAllRecords>(decoder, this, &WebIDBConnectionToClient::getAllRecords);
114 return;
115 }
116 if (decoder.messageName() == Messages::WebIDBConnectionToClient::GetCount::name()) {
117 IPC::handleMessage<Messages::WebIDBConnectionToClient::GetCount>(decoder, this, &WebIDBConnectionToClient::getCount);
118 return;
119 }
120 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DeleteRecord::name()) {
121 IPC::handleMessage<Messages::WebIDBConnectionToClient::DeleteRecord>(decoder, this, &WebIDBConnectionToClient::deleteRecord);
122 return;
123 }
124 if (decoder.messageName() == Messages::WebIDBConnectionToClient::OpenCursor::name()) {
125 IPC::handleMessage<Messages::WebIDBConnectionToClient::OpenCursor>(decoder, this, &WebIDBConnectionToClient::openCursor);
126 return;
127 }
128 if (decoder.messageName() == Messages::WebIDBConnectionToClient::IterateCursor::name()) {
129 IPC::handleMessage<Messages::WebIDBConnectionToClient::IterateCursor>(decoder, this, &WebIDBConnectionToClient::iterateCursor);
130 return;
131 }
132 if (decoder.messageName() == Messages::WebIDBConnectionToClient::EstablishTransaction::name()) {
133 IPC::handleMessage<Messages::WebIDBConnectionToClient::EstablishTransaction>(decoder, this, &WebIDBConnectionToClient::establishTransaction);
134 return;
135 }
136 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DatabaseConnectionPendingClose::name()) {
137 IPC::handleMessage<Messages::WebIDBConnectionToClient::DatabaseConnectionPendingClose>(decoder, this, &WebIDBConnectionToClient::databaseConnectionPendingClose);
138 return;
139 }
140 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DatabaseConnectionClosed::name()) {
141 IPC::handleMessage<Messages::WebIDBConnectionToClient::DatabaseConnectionClosed>(decoder, this, &WebIDBConnectionToClient::databaseConnectionClosed);
142 return;
143 }
144 if (decoder.messageName() == Messages::WebIDBConnectionToClient::AbortOpenAndUpgradeNeeded::name()) {
145 IPC::handleMessage<Messages::WebIDBConnectionToClient::AbortOpenAndUpgradeNeeded>(decoder, this, &WebIDBConnectionToClient::abortOpenAndUpgradeNeeded);
146 return;
147 }
148 if (decoder.messageName() == Messages::WebIDBConnectionToClient::DidFireVersionChangeEvent::name()) {
149 IPC::handleMessage<Messages::WebIDBConnectionToClient::DidFireVersionChangeEvent>(decoder, this, &WebIDBConnectionToClient::didFireVersionChangeEvent);
150 return;
151 }
152 if (decoder.messageName() == Messages::WebIDBConnectionToClient::OpenDBRequestCancelled::name()) {
153 IPC::handleMessage<Messages::WebIDBConnectionToClient::OpenDBRequestCancelled>(decoder, this, &WebIDBConnectionToClient::openDBRequestCancelled);
154 return;
155 }
156 if (decoder.messageName() == Messages::WebIDBConnectionToClient::ConfirmDidCloseFromServer::name()) {
157 IPC::handleMessage<Messages::WebIDBConnectionToClient::ConfirmDidCloseFromServer>(decoder, this, &WebIDBConnectionToClient::confirmDidCloseFromServer);
158 return;
159 }
160 if (decoder.messageName() == Messages::WebIDBConnectionToClient::GetAllDatabaseNames::name()) {
161 IPC::handleMessage<Messages::WebIDBConnectionToClient::GetAllDatabaseNames>(decoder, this, &WebIDBConnectionToClient::getAllDatabaseNames);
162 return;
163 }
164 UNUSED_PARAM(connection);
165 UNUSED_PARAM(decoder);
166 ASSERT_NOT_REACHED();
167}
168
169} // namespace WebKit
170
171
172#endif // ENABLE(INDEXED_DATABASE)
173