OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 Loading... |
35 #include "modules/indexeddb/IDBCallbacks.h" | 35 #include "modules/indexeddb/IDBCallbacks.h" |
36 #include "modules/indexeddb/IDBDatabaseError.h" | 36 #include "modules/indexeddb/IDBDatabaseError.h" |
37 #include "modules/indexeddb/IDBKey.h" | 37 #include "modules/indexeddb/IDBKey.h" |
38 #include "modules/indexeddb/IDBMetadata.h" | 38 #include "modules/indexeddb/IDBMetadata.h" |
39 #include <public/WebData.h> | 39 #include <public/WebData.h> |
40 | 40 |
41 using namespace WebCore; | 41 using namespace WebCore; |
42 | 42 |
43 namespace WebKit { | 43 namespace WebKit { |
44 | 44 |
45 WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks) | 45 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBCallbacks* callbacks) |
46 : m_callbacks(callbacks) | 46 : m_callbacks(callbacks) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 50 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) | 54 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) |
55 { | 55 { |
56 m_callbacks->onError(error); | 56 m_callbacks->onError(error); |
57 } | 57 } |
58 | 58 |
59 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) | 59 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList) |
60 { | 60 { |
61 Vector<String> stringList; | 61 Vector<String> stringList; |
62 for (size_t i = 0; i < webStringList.size(); ++i) | 62 for (size_t i = 0; i < webStringList.size(); ++i) |
63 stringList.append(webStringList[i]); | 63 stringList.append(webStringList[i]); |
64 m_callbacks->onSuccess(stringList); | 64 m_callbacks->onSuccess(stringList); |
65 } | 65 } |
66 | 66 |
67 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebData& value) | 67 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebData& value) |
68 { | 68 { |
69 m_callbacks->onSuccess(IDBCursorBackendProxy::create(adoptPtr(cursor)), key,
primaryKey, value); | 69 m_callbacks->onSuccess(IDBCursorBackendProxy::create(adoptPtr(cursor)), key,
primaryKey, value); |
70 } | 70 } |
71 | 71 |
72 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* webKitInstance, const WebIDB
Metadata& metadata) | 72 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* webKitInstance, const WebIDB
Metadata& metadata) |
73 { | 73 { |
74 if (m_databaseProxy) { | 74 if (m_databaseProxy) { |
75 m_callbacks->onSuccess(m_databaseProxy.release(), metadata); | 75 m_callbacks->onSuccess(m_databaseProxy, metadata); |
76 return; | 76 return; |
77 } | 77 } |
78 RefPtr<IDBDatabaseBackendInterface> localDatabaseProxy = IDBDatabaseBackendP
roxy::create(adoptPtr(webKitInstance)); | 78 IDBDatabaseBackendInterface* localDatabaseProxy = IDBDatabaseBackendProxy::c
reate(adoptPtr(webKitInstance)); |
79 m_callbacks->onSuccess(localDatabaseProxy.release(), metadata); | 79 m_callbacks->onSuccess(localDatabaseProxy, metadata); |
80 } | 80 } |
81 | 81 |
82 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 82 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
83 { | 83 { |
84 m_callbacks->onSuccess(key); | 84 m_callbacks->onSuccess(key); |
85 } | 85 } |
86 | 86 |
87 void WebIDBCallbacksImpl::onSuccess(const WebData& value) | 87 void WebIDBCallbacksImpl::onSuccess(const WebData& value) |
88 { | 88 { |
89 m_callbacks->onSuccess(value); | 89 m_callbacks->onSuccess(value); |
(...skipping 24 matching lines...) Expand all Loading... |
114 m_callbacks->onBlocked(oldVersion); | 114 m_callbacks->onBlocked(oldVersion); |
115 } | 115 } |
116 | 116 |
117 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata) | 117 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata) |
118 { | 118 { |
119 m_databaseProxy = IDBDatabaseBackendProxy::create(adoptPtr(database)); | 119 m_databaseProxy = IDBDatabaseBackendProxy::create(adoptPtr(database)); |
120 m_callbacks->onUpgradeNeeded(oldVersion, m_databaseProxy, metadata); | 120 m_callbacks->onUpgradeNeeded(oldVersion, m_databaseProxy, metadata); |
121 } | 121 } |
122 | 122 |
123 } // namespace WebKit | 123 } // namespace WebKit |
OLD | NEW |