Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * 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 * | 10 * |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 probe::AsyncTaskCanceled(request_->GetExecutionContext(), this); | 71 probe::AsyncTaskCanceled(request_->GetExecutionContext(), this); |
| 72 request_->WebCallbacksDestroyed(); | 72 request_->WebCallbacksDestroyed(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void WebIDBCallbacksImpl::OnError(const WebIDBDatabaseError& error) { | 76 void WebIDBCallbacksImpl::OnError(const WebIDBDatabaseError& error) { |
| 77 if (!request_) | 77 if (!request_) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "error"); | 80 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "error"); |
| 81 request_->OnError(DOMException::Create(error.Code(), error.Message())); | 81 request_->QueueResult(DOMException::Create(error.Code(), error.Message())); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void WebIDBCallbacksImpl::OnSuccess( | 84 void WebIDBCallbacksImpl::OnSuccess( |
| 85 const WebVector<WebString>& web_string_list) { | 85 const WebVector<WebString>& web_string_list) { |
| 86 if (!request_) | 86 if (!request_) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 Vector<String> string_list; | 89 Vector<String> string_list; |
| 90 for (size_t i = 0; i < web_string_list.size(); ++i) | 90 for (size_t i = 0; i < web_string_list.size(); ++i) |
| 91 string_list.push_back(web_string_list[i]); | 91 string_list.push_back(web_string_list[i]); |
| 92 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 92 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 93 request_->OnSuccess(string_list); | 93 request_->OnSuccess(string_list); |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:24
Done.
| |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WebIDBCallbacksImpl::OnSuccess(WebIDBCursor* cursor, | 96 void WebIDBCallbacksImpl::OnSuccess(WebIDBCursor* cursor, |
| 97 const WebIDBKey& key, | 97 const WebIDBKey& key, |
| 98 const WebIDBKey& primary_key, | 98 const WebIDBKey& primary_key, |
| 99 const WebIDBValue& value) { | 99 const WebIDBValue& value) { |
| 100 if (!request_) | 100 if (!request_) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 103 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 104 request_->OnSuccess(WTF::WrapUnique(cursor), key, primary_key, | 104 request_->QueueResult(WTF::WrapUnique(cursor), key, primary_key, |
| 105 IDBValue::Create(value, request_->GetIsolate())); | 105 IDBValue::Create(value, request_->GetIsolate())); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void WebIDBCallbacksImpl::OnSuccess(WebIDBDatabase* backend, | 108 void WebIDBCallbacksImpl::OnSuccess(WebIDBDatabase* backend, |
| 109 const WebIDBMetadata& metadata) { | 109 const WebIDBMetadata& metadata) { |
| 110 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(backend); | 110 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(backend); |
| 111 if (request_) { | 111 if (request_) { |
| 112 probe::AsyncTask async_task(request_->GetExecutionContext(), this, | 112 probe::AsyncTask async_task(request_->GetExecutionContext(), this, |
| 113 "success"); | 113 "success"); |
| 114 request_->OnSuccess(std::move(db), IDBDatabaseMetadata(metadata)); | 114 request_->OnSuccess(std::move(db), IDBDatabaseMetadata(metadata)); |
| 115 } else if (db) { | 115 } else if (db) { |
| 116 db->Close(); | 116 db->Close(); |
| 117 } | 117 } |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:24
Done.
| |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key) { | 120 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key) { |
| 121 if (!request_) | 121 if (!request_) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 124 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 125 request_->OnSuccess(key); | 125 request_->QueueResult(key); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void WebIDBCallbacksImpl::OnSuccess(const WebIDBValue& value) { | 128 void WebIDBCallbacksImpl::OnSuccess(const WebIDBValue& value) { |
| 129 if (!request_) | 129 if (!request_) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 132 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 133 request_->OnSuccess(IDBValue::Create(value, request_->GetIsolate())); | 133 request_->QueueResult(IDBValue::Create(value, request_->GetIsolate())); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void WebIDBCallbacksImpl::OnSuccess(const WebVector<WebIDBValue>& values) { | 136 void WebIDBCallbacksImpl::OnSuccess(const WebVector<WebIDBValue>& values) { |
| 137 if (!request_) | 137 if (!request_) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 140 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 141 Vector<RefPtr<IDBValue>> idb_values(values.size()); | 141 Vector<RefPtr<IDBValue>> idb_values(values.size()); |
| 142 for (size_t i = 0; i < values.size(); ++i) | 142 for (size_t i = 0; i < values.size(); ++i) |
| 143 idb_values[i] = IDBValue::Create(values[i], request_->GetIsolate()); | 143 idb_values[i] = IDBValue::Create(values[i], request_->GetIsolate()); |
| 144 request_->OnSuccess(idb_values); | 144 request_->QueueResult(idb_values); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WebIDBCallbacksImpl::OnSuccess(long long value) { | 147 void WebIDBCallbacksImpl::OnSuccess(long long value) { |
| 148 if (!request_) | 148 if (!request_) |
| 149 return; | 149 return; |
| 150 | 150 |
| 151 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 151 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 152 request_->OnSuccess(value); | 152 request_->OnSuccess(value); |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:24
Per jsbell's comment, this one's actually going th
| |
| 153 } | 153 } |
| 154 | 154 |
| 155 void WebIDBCallbacksImpl::OnSuccess() { | 155 void WebIDBCallbacksImpl::OnSuccess() { |
| 156 if (!request_) | 156 if (!request_) |
| 157 return; | 157 return; |
| 158 | 158 |
| 159 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 159 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 160 request_->OnSuccess(); | 160 request_->OnSuccess(); |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:25
Per jsbell's comment, this one's actually going th
| |
| 161 } | 161 } |
| 162 | 162 |
| 163 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key, | 163 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key, |
| 164 const WebIDBKey& primary_key, | 164 const WebIDBKey& primary_key, |
| 165 const WebIDBValue& value) { | 165 const WebIDBValue& value) { |
| 166 if (!request_) | 166 if (!request_) |
| 167 return; | 167 return; |
| 168 | 168 |
| 169 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); | 169 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); |
| 170 request_->OnSuccess(key, primary_key, | 170 request_->QueueResult(key, primary_key, |
| 171 IDBValue::Create(value, request_->GetIsolate())); | 171 IDBValue::Create(value, request_->GetIsolate())); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void WebIDBCallbacksImpl::OnBlocked(long long old_version) { | 174 void WebIDBCallbacksImpl::OnBlocked(long long old_version) { |
| 175 if (!request_) | 175 if (!request_) |
| 176 return; | 176 return; |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:24
Done.
| |
| 177 | 177 |
| 178 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "blocked"); | 178 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "blocked"); |
| 179 request_->OnBlocked(old_version); | 179 request_->OnBlocked(old_version); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void WebIDBCallbacksImpl::OnUpgradeNeeded(long long old_version, | 182 void WebIDBCallbacksImpl::OnUpgradeNeeded(long long old_version, |
| 183 WebIDBDatabase* database, | 183 WebIDBDatabase* database, |
| 184 const WebIDBMetadata& metadata, | 184 const WebIDBMetadata& metadata, |
| 185 unsigned short data_loss, | 185 unsigned short data_loss, |
| 186 WebString data_loss_message) { | 186 WebString data_loss_message) { |
| 187 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(database); | 187 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(database); |
|
dmurph
2017/05/04 22:27:07
Can you dcheck that we don't have any queued resul
pwnall
2017/05/11 23:54:24
Done.
| |
| 188 if (request_) { | 188 if (request_) { |
| 189 probe::AsyncTask async_task(request_->GetExecutionContext(), this, | 189 probe::AsyncTask async_task(request_->GetExecutionContext(), this, |
| 190 "upgradeNeeded"); | 190 "upgradeNeeded"); |
| 191 request_->OnUpgradeNeeded( | 191 request_->OnUpgradeNeeded( |
| 192 old_version, std::move(db), IDBDatabaseMetadata(metadata), | 192 old_version, std::move(db), IDBDatabaseMetadata(metadata), |
| 193 static_cast<WebIDBDataLoss>(data_loss), data_loss_message); | 193 static_cast<WebIDBDataLoss>(data_loss), data_loss_message); |
| 194 } else { | 194 } else { |
| 195 db->Close(); | 195 db->Close(); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void WebIDBCallbacksImpl::Detach() { | 199 void WebIDBCallbacksImpl::Detach() { |
| 200 request_.Clear(); | 200 request_.Clear(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |