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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp

Issue 2870803002: Rename IDBRequest::On* callbacks to IDBRequest::Enqueue*. (Closed)
Patch Set: De-virtualized one more callback. Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_->EnqueueResponse(
82 DOMException::Create(error.Code(), error.Message()));
82 } 83 }
83 84
84 void WebIDBCallbacksImpl::OnSuccess( 85 void WebIDBCallbacksImpl::OnSuccess(
85 const WebVector<WebString>& web_string_list) { 86 const WebVector<WebString>& web_string_list) {
86 if (!request_) 87 if (!request_)
87 return; 88 return;
88 89
89 Vector<String> string_list; 90 Vector<String> string_list;
90 for (size_t i = 0; i < web_string_list.size(); ++i) 91 for (size_t i = 0; i < web_string_list.size(); ++i)
91 string_list.push_back(web_string_list[i]); 92 string_list.push_back(web_string_list[i]);
92 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 93 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
93 request_->OnSuccess(string_list); 94 request_->EnqueueResponse(string_list);
94 } 95 }
95 96
96 void WebIDBCallbacksImpl::OnSuccess(WebIDBCursor* cursor, 97 void WebIDBCallbacksImpl::OnSuccess(WebIDBCursor* cursor,
97 const WebIDBKey& key, 98 const WebIDBKey& key,
98 const WebIDBKey& primary_key, 99 const WebIDBKey& primary_key,
99 const WebIDBValue& value) { 100 const WebIDBValue& value) {
100 if (!request_) 101 if (!request_)
101 return; 102 return;
102 103
103 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 104 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
104 request_->OnSuccess(WTF::WrapUnique(cursor), key, primary_key, 105 request_->EnqueueResponse(WTF::WrapUnique(cursor), key, primary_key,
105 IDBValue::Create(value, request_->GetIsolate())); 106 IDBValue::Create(value, request_->GetIsolate()));
106 } 107 }
107 108
108 void WebIDBCallbacksImpl::OnSuccess(WebIDBDatabase* backend, 109 void WebIDBCallbacksImpl::OnSuccess(WebIDBDatabase* backend,
109 const WebIDBMetadata& metadata) { 110 const WebIDBMetadata& metadata) {
110 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(backend); 111 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(backend);
111 if (request_) { 112 if (request_) {
112 probe::AsyncTask async_task(request_->GetExecutionContext(), this, 113 probe::AsyncTask async_task(request_->GetExecutionContext(), this,
113 "success"); 114 "success");
114 request_->OnSuccess(std::move(db), IDBDatabaseMetadata(metadata)); 115 request_->EnqueueResponse(std::move(db), IDBDatabaseMetadata(metadata));
115 } else if (db) { 116 } else if (db) {
116 db->Close(); 117 db->Close();
117 } 118 }
118 } 119 }
119 120
120 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key) { 121 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key) {
121 if (!request_) 122 if (!request_)
122 return; 123 return;
123 124
124 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 125 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
125 request_->OnSuccess(key); 126 request_->EnqueueResponse(key);
126 } 127 }
127 128
128 void WebIDBCallbacksImpl::OnSuccess(const WebIDBValue& value) { 129 void WebIDBCallbacksImpl::OnSuccess(const WebIDBValue& value) {
129 if (!request_) 130 if (!request_)
130 return; 131 return;
131 132
132 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 133 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
133 request_->OnSuccess(IDBValue::Create(value, request_->GetIsolate())); 134 request_->EnqueueResponse(IDBValue::Create(value, request_->GetIsolate()));
134 } 135 }
135 136
136 void WebIDBCallbacksImpl::OnSuccess(const WebVector<WebIDBValue>& values) { 137 void WebIDBCallbacksImpl::OnSuccess(const WebVector<WebIDBValue>& values) {
137 if (!request_) 138 if (!request_)
138 return; 139 return;
139 140
140 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 141 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
141 Vector<RefPtr<IDBValue>> idb_values(values.size()); 142 Vector<RefPtr<IDBValue>> idb_values(values.size());
142 for (size_t i = 0; i < values.size(); ++i) 143 for (size_t i = 0; i < values.size(); ++i)
143 idb_values[i] = IDBValue::Create(values[i], request_->GetIsolate()); 144 idb_values[i] = IDBValue::Create(values[i], request_->GetIsolate());
144 request_->OnSuccess(idb_values); 145 request_->EnqueueResponse(idb_values);
145 } 146 }
146 147
147 void WebIDBCallbacksImpl::OnSuccess(long long value) { 148 void WebIDBCallbacksImpl::OnSuccess(long long value) {
148 if (!request_) 149 if (!request_)
149 return; 150 return;
150 151
151 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 152 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
152 request_->OnSuccess(value); 153 request_->EnqueueResponse(value);
153 } 154 }
154 155
155 void WebIDBCallbacksImpl::OnSuccess() { 156 void WebIDBCallbacksImpl::OnSuccess() {
156 if (!request_) 157 if (!request_)
157 return; 158 return;
158 159
159 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 160 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
160 request_->OnSuccess(); 161 request_->EnqueueResponse();
161 } 162 }
162 163
163 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key, 164 void WebIDBCallbacksImpl::OnSuccess(const WebIDBKey& key,
164 const WebIDBKey& primary_key, 165 const WebIDBKey& primary_key,
165 const WebIDBValue& value) { 166 const WebIDBValue& value) {
166 if (!request_) 167 if (!request_)
167 return; 168 return;
168 169
169 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success"); 170 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "success");
170 request_->OnSuccess(key, primary_key, 171 request_->EnqueueResponse(key, primary_key,
171 IDBValue::Create(value, request_->GetIsolate())); 172 IDBValue::Create(value, request_->GetIsolate()));
172 } 173 }
173 174
174 void WebIDBCallbacksImpl::OnBlocked(long long old_version) { 175 void WebIDBCallbacksImpl::OnBlocked(long long old_version) {
175 if (!request_) 176 if (!request_)
176 return; 177 return;
177 178
178 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "blocked"); 179 probe::AsyncTask async_task(request_->GetExecutionContext(), this, "blocked");
179 request_->OnBlocked(old_version); 180 request_->EnqueueBlocked(old_version);
180 } 181 }
181 182
182 void WebIDBCallbacksImpl::OnUpgradeNeeded(long long old_version, 183 void WebIDBCallbacksImpl::OnUpgradeNeeded(long long old_version,
183 WebIDBDatabase* database, 184 WebIDBDatabase* database,
184 const WebIDBMetadata& metadata, 185 const WebIDBMetadata& metadata,
185 unsigned short data_loss, 186 unsigned short data_loss,
186 WebString data_loss_message) { 187 WebString data_loss_message) {
187 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(database); 188 std::unique_ptr<WebIDBDatabase> db = WTF::WrapUnique(database);
188 if (request_) { 189 if (request_) {
189 probe::AsyncTask async_task(request_->GetExecutionContext(), this, 190 probe::AsyncTask async_task(request_->GetExecutionContext(), this,
190 "upgradeNeeded"); 191 "upgradeNeeded");
191 request_->OnUpgradeNeeded( 192 request_->EnqueueUpgradeNeeded(
192 old_version, std::move(db), IDBDatabaseMetadata(metadata), 193 old_version, std::move(db), IDBDatabaseMetadata(metadata),
193 static_cast<WebIDBDataLoss>(data_loss), data_loss_message); 194 static_cast<WebIDBDataLoss>(data_loss), data_loss_message);
194 } else { 195 } else {
195 db->Close(); 196 db->Close();
196 } 197 }
197 } 198 }
198 199
199 void WebIDBCallbacksImpl::Detach() { 200 void WebIDBCallbacksImpl::Detach() {
200 request_.Clear(); 201 request_.Clear();
201 } 202 }
202 203
203 } // namespace blink 204 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698