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 "WebIDBConnectionToServer.h"
30
31#include "ArgumentCoders.h"
32#include "Decoder.h"
33#include "HandleMessage.h"
34#include "WebCoreArgumentCoders.h"
35#include "WebIDBConnectionToServerMessages.h"
36#include "WebIDBResult.h"
37#include <WebCore/IDBError.h>
38#include <WebCore/IDBResourceIdentifier.h>
39#include <WebCore/IDBResultData.h>
40#include <wtf/Vector.h>
41#include <wtf/text/WTFString.h>
42
43namespace WebKit {
44
45void WebIDBConnectionToServer::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
46{
47 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidDeleteDatabase::name()) {
48 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidDeleteDatabase>(decoder, this, &WebIDBConnectionToServer::didDeleteDatabase);
49 return;
50 }
51 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidOpenDatabase::name()) {
52 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidOpenDatabase>(decoder, this, &WebIDBConnectionToServer::didOpenDatabase);
53 return;
54 }
55 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidAbortTransaction::name()) {
56 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidAbortTransaction>(decoder, this, &WebIDBConnectionToServer::didAbortTransaction);
57 return;
58 }
59 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidCommitTransaction::name()) {
60 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidCommitTransaction>(decoder, this, &WebIDBConnectionToServer::didCommitTransaction);
61 return;
62 }
63 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidCreateObjectStore::name()) {
64 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidCreateObjectStore>(decoder, this, &WebIDBConnectionToServer::didCreateObjectStore);
65 return;
66 }
67 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidDeleteObjectStore::name()) {
68 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidDeleteObjectStore>(decoder, this, &WebIDBConnectionToServer::didDeleteObjectStore);
69 return;
70 }
71 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidRenameObjectStore::name()) {
72 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidRenameObjectStore>(decoder, this, &WebIDBConnectionToServer::didRenameObjectStore);
73 return;
74 }
75 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidClearObjectStore::name()) {
76 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidClearObjectStore>(decoder, this, &WebIDBConnectionToServer::didClearObjectStore);
77 return;
78 }
79 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidCreateIndex::name()) {
80 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidCreateIndex>(decoder, this, &WebIDBConnectionToServer::didCreateIndex);
81 return;
82 }
83 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidDeleteIndex::name()) {
84 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidDeleteIndex>(decoder, this, &WebIDBConnectionToServer::didDeleteIndex);
85 return;
86 }
87 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidRenameIndex::name()) {
88 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidRenameIndex>(decoder, this, &WebIDBConnectionToServer::didRenameIndex);
89 return;
90 }
91 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidPutOrAdd::name()) {
92 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidPutOrAdd>(decoder, this, &WebIDBConnectionToServer::didPutOrAdd);
93 return;
94 }
95 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidGetRecord::name()) {
96 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidGetRecord>(decoder, this, &WebIDBConnectionToServer::didGetRecord);
97 return;
98 }
99 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidGetAllRecords::name()) {
100 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidGetAllRecords>(decoder, this, &WebIDBConnectionToServer::didGetAllRecords);
101 return;
102 }
103 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidGetCount::name()) {
104 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidGetCount>(decoder, this, &WebIDBConnectionToServer::didGetCount);
105 return;
106 }
107 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidDeleteRecord::name()) {
108 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidDeleteRecord>(decoder, this, &WebIDBConnectionToServer::didDeleteRecord);
109 return;
110 }
111 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidOpenCursor::name()) {
112 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidOpenCursor>(decoder, this, &WebIDBConnectionToServer::didOpenCursor);
113 return;
114 }
115 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidIterateCursor::name()) {
116 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidIterateCursor>(decoder, this, &WebIDBConnectionToServer::didIterateCursor);
117 return;
118 }
119 if (decoder.messageName() == Messages::WebIDBConnectionToServer::FireVersionChangeEvent::name()) {
120 IPC::handleMessage<Messages::WebIDBConnectionToServer::FireVersionChangeEvent>(decoder, this, &WebIDBConnectionToServer::fireVersionChangeEvent);
121 return;
122 }
123 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidStartTransaction::name()) {
124 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidStartTransaction>(decoder, this, &WebIDBConnectionToServer::didStartTransaction);
125 return;
126 }
127 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidCloseFromServer::name()) {
128 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidCloseFromServer>(decoder, this, &WebIDBConnectionToServer::didCloseFromServer);
129 return;
130 }
131 if (decoder.messageName() == Messages::WebIDBConnectionToServer::NotifyOpenDBRequestBlocked::name()) {
132 IPC::handleMessage<Messages::WebIDBConnectionToServer::NotifyOpenDBRequestBlocked>(decoder, this, &WebIDBConnectionToServer::notifyOpenDBRequestBlocked);
133 return;
134 }
135 if (decoder.messageName() == Messages::WebIDBConnectionToServer::DidGetAllDatabaseNames::name()) {
136 IPC::handleMessage<Messages::WebIDBConnectionToServer::DidGetAllDatabaseNames>(decoder, this, &WebIDBConnectionToServer::didGetAllDatabaseNames);
137 return;
138 }
139 UNUSED_PARAM(connection);
140 UNUSED_PARAM(decoder);
141 ASSERT_NOT_REACHED();
142}
143
144} // namespace WebKit
145
146
147#endif // ENABLE(INDEXED_DATABASE)
148