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

Side by Side Diff: content/child/indexed_db/indexed_db_dispatcher.cc

Issue 1544273002: Switch to standard integer types in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/indexed_db/indexed_db_dispatcher.h" 5 #include "content/child/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 << IPC_MESSAGE_ID_LINE(msg.type()); 164 << IPC_MESSAGE_ID_LINE(msg.type());
165 } 165 }
166 166
167 bool IndexedDBDispatcher::Send(IPC::Message* msg) { 167 bool IndexedDBDispatcher::Send(IPC::Message* msg) {
168 return thread_safe_sender_->Send(msg); 168 return thread_safe_sender_->Send(msg);
169 } 169 }
170 170
171 void IndexedDBDispatcher::RequestIDBCursorAdvance( 171 void IndexedDBDispatcher::RequestIDBCursorAdvance(
172 unsigned long count, 172 unsigned long count,
173 WebIDBCallbacks* callbacks_ptr, 173 WebIDBCallbacks* callbacks_ptr,
174 int32 ipc_cursor_id, 174 int32_t ipc_cursor_id,
175 int64 transaction_id) { 175 int64_t transaction_id) {
176 // Reset all cursor prefetch caches except for this cursor. 176 // Reset all cursor prefetch caches except for this cursor.
177 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id); 177 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id);
178 178
179 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 179 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
180 180
181 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 181 int32_t ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
182 Send(new IndexedDBHostMsg_CursorAdvance( 182 Send(new IndexedDBHostMsg_CursorAdvance(
183 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, count)); 183 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, count));
184 } 184 }
185 185
186 void IndexedDBDispatcher::RequestIDBCursorContinue( 186 void IndexedDBDispatcher::RequestIDBCursorContinue(
187 const IndexedDBKey& key, 187 const IndexedDBKey& key,
188 const IndexedDBKey& primary_key, 188 const IndexedDBKey& primary_key,
189 WebIDBCallbacks* callbacks_ptr, 189 WebIDBCallbacks* callbacks_ptr,
190 int32 ipc_cursor_id, 190 int32_t ipc_cursor_id,
191 int64 transaction_id) { 191 int64_t transaction_id) {
192 // Reset all cursor prefetch caches except for this cursor. 192 // Reset all cursor prefetch caches except for this cursor.
193 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id); 193 ResetCursorPrefetchCaches(transaction_id, ipc_cursor_id);
194 194
195 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 195 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
196 196
197 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 197 int32_t ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
198 Send(new IndexedDBHostMsg_CursorContinue( 198 Send(new IndexedDBHostMsg_CursorContinue(
199 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, key, primary_key)); 199 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, key, primary_key));
200 } 200 }
201 201
202 void IndexedDBDispatcher::RequestIDBCursorPrefetch( 202 void IndexedDBDispatcher::RequestIDBCursorPrefetch(
203 int n, 203 int n,
204 WebIDBCallbacks* callbacks_ptr, 204 WebIDBCallbacks* callbacks_ptr,
205 int32 ipc_cursor_id) { 205 int32_t ipc_cursor_id) {
206 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 206 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
207 207
208 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 208 int32_t ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
209 Send(new IndexedDBHostMsg_CursorPrefetch( 209 Send(new IndexedDBHostMsg_CursorPrefetch(
210 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, n)); 210 ipc_cursor_id, CurrentWorkerId(), ipc_callbacks_id, n));
211 } 211 }
212 212
213 void IndexedDBDispatcher::RequestIDBCursorPrefetchReset(int used_prefetches, 213 void IndexedDBDispatcher::RequestIDBCursorPrefetchReset(int used_prefetches,
214 int unused_prefetches, 214 int unused_prefetches,
215 int32 ipc_cursor_id) { 215 int32_t ipc_cursor_id) {
216 Send(new IndexedDBHostMsg_CursorPrefetchReset( 216 Send(new IndexedDBHostMsg_CursorPrefetchReset(
217 ipc_cursor_id, used_prefetches, unused_prefetches)); 217 ipc_cursor_id, used_prefetches, unused_prefetches));
218 } 218 }
219 219
220 void IndexedDBDispatcher::RequestIDBFactoryOpen( 220 void IndexedDBDispatcher::RequestIDBFactoryOpen(
221 const base::string16& name, 221 const base::string16& name,
222 int64 version, 222 int64_t version,
223 int64 transaction_id, 223 int64_t transaction_id,
224 WebIDBCallbacks* callbacks_ptr, 224 WebIDBCallbacks* callbacks_ptr,
225 WebIDBDatabaseCallbacks* database_callbacks_ptr, 225 WebIDBDatabaseCallbacks* database_callbacks_ptr,
226 const std::string& database_identifier) { 226 const std::string& database_identifier) {
227 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 227 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
228 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks( 228 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks(
229 database_callbacks_ptr); 229 database_callbacks_ptr);
230 230
231 IndexedDBHostMsg_FactoryOpen_Params params; 231 IndexedDBHostMsg_FactoryOpen_Params params;
232 params.ipc_thread_id = CurrentWorkerId(); 232 params.ipc_thread_id = CurrentWorkerId();
233 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 233 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
(...skipping 26 matching lines...) Expand all
260 260
261 IndexedDBHostMsg_FactoryDeleteDatabase_Params params; 261 IndexedDBHostMsg_FactoryDeleteDatabase_Params params;
262 params.ipc_thread_id = CurrentWorkerId(); 262 params.ipc_thread_id = CurrentWorkerId();
263 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 263 params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
264 params.database_identifier = database_identifier; 264 params.database_identifier = database_identifier;
265 params.name = name; 265 params.name = name;
266 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params)); 266 Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params));
267 } 267 }
268 268
269 void IndexedDBDispatcher::RequestIDBDatabaseClose( 269 void IndexedDBDispatcher::RequestIDBDatabaseClose(
270 int32 ipc_database_id, 270 int32_t ipc_database_id,
271 int32 ipc_database_callbacks_id) { 271 int32_t ipc_database_callbacks_id) {
272 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id)); 272 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id));
273 // There won't be pending database callbacks if the transaction was aborted in 273 // There won't be pending database callbacks if the transaction was aborted in
274 // the initial upgradeneeded event handler. 274 // the initial upgradeneeded event handler.
275 if (pending_database_callbacks_.Lookup(ipc_database_callbacks_id)) 275 if (pending_database_callbacks_.Lookup(ipc_database_callbacks_id))
276 pending_database_callbacks_.Remove(ipc_database_callbacks_id); 276 pending_database_callbacks_.Remove(ipc_database_callbacks_id);
277 } 277 }
278 278
279 void IndexedDBDispatcher::NotifyIDBDatabaseVersionChangeIgnored( 279 void IndexedDBDispatcher::NotifyIDBDatabaseVersionChangeIgnored(
280 int32 ipc_database_id) { 280 int32_t ipc_database_id) {
281 Send(new IndexedDBHostMsg_DatabaseVersionChangeIgnored(ipc_database_id)); 281 Send(new IndexedDBHostMsg_DatabaseVersionChangeIgnored(ipc_database_id));
282 } 282 }
283 283
284 void IndexedDBDispatcher::RequestIDBDatabaseCreateTransaction( 284 void IndexedDBDispatcher::RequestIDBDatabaseCreateTransaction(
285 int32 ipc_database_id, 285 int32_t ipc_database_id,
286 int64 transaction_id, 286 int64_t transaction_id,
287 WebIDBDatabaseCallbacks* database_callbacks_ptr, 287 WebIDBDatabaseCallbacks* database_callbacks_ptr,
288 WebVector<long long> object_store_ids, 288 WebVector<long long> object_store_ids,
289 blink::WebIDBTransactionMode mode) { 289 blink::WebIDBTransactionMode mode) {
290 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks( 290 scoped_ptr<WebIDBDatabaseCallbacks> database_callbacks(
291 database_callbacks_ptr); 291 database_callbacks_ptr);
292 IndexedDBHostMsg_DatabaseCreateTransaction_Params params; 292 IndexedDBHostMsg_DatabaseCreateTransaction_Params params;
293 params.ipc_thread_id = CurrentWorkerId(); 293 params.ipc_thread_id = CurrentWorkerId();
294 params.ipc_database_id = ipc_database_id; 294 params.ipc_database_id = ipc_database_id;
295 params.transaction_id = transaction_id; 295 params.transaction_id = transaction_id;
296 params.ipc_database_callbacks_id = 296 params.ipc_database_callbacks_id =
297 pending_database_callbacks_.Add(database_callbacks.release()); 297 pending_database_callbacks_.Add(database_callbacks.release());
298 params.object_store_ids 298 params.object_store_ids
299 .assign(object_store_ids.data(), 299 .assign(object_store_ids.data(),
300 object_store_ids.data() + object_store_ids.size()); 300 object_store_ids.data() + object_store_ids.size());
301 params.mode = mode; 301 params.mode = mode;
302 302
303 Send(new IndexedDBHostMsg_DatabaseCreateTransaction(params)); 303 Send(new IndexedDBHostMsg_DatabaseCreateTransaction(params));
304 } 304 }
305 305
306 void IndexedDBDispatcher::RequestIDBDatabaseGet( 306 void IndexedDBDispatcher::RequestIDBDatabaseGet(
307 int32 ipc_database_id, 307 int32_t ipc_database_id,
308 int64 transaction_id, 308 int64_t transaction_id,
309 int64 object_store_id, 309 int64_t object_store_id,
310 int64 index_id, 310 int64_t index_id,
311 const IndexedDBKeyRange& key_range, 311 const IndexedDBKeyRange& key_range,
312 bool key_only, 312 bool key_only,
313 WebIDBCallbacks* callbacks) { 313 WebIDBCallbacks* callbacks) {
314 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 314 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
315 IndexedDBHostMsg_DatabaseGet_Params params; 315 IndexedDBHostMsg_DatabaseGet_Params params;
316 init_params(&params, callbacks); 316 init_params(&params, callbacks);
317 params.ipc_database_id = ipc_database_id; 317 params.ipc_database_id = ipc_database_id;
318 params.transaction_id = transaction_id; 318 params.transaction_id = transaction_id;
319 params.object_store_id = object_store_id; 319 params.object_store_id = object_store_id;
320 params.index_id = index_id; 320 params.index_id = index_id;
321 params.key_range = key_range; 321 params.key_range = key_range;
322 params.key_only = key_only; 322 params.key_only = key_only;
323 Send(new IndexedDBHostMsg_DatabaseGet(params)); 323 Send(new IndexedDBHostMsg_DatabaseGet(params));
324 } 324 }
325 325
326 void IndexedDBDispatcher::RequestIDBDatabaseGetAll( 326 void IndexedDBDispatcher::RequestIDBDatabaseGetAll(
327 int32 ipc_database_id, 327 int32_t ipc_database_id,
328 int64 transaction_id, 328 int64_t transaction_id,
329 int64 object_store_id, 329 int64_t object_store_id,
330 int64 index_id, 330 int64_t index_id,
331 const IndexedDBKeyRange& key_range, 331 const IndexedDBKeyRange& key_range,
332 bool key_only, 332 bool key_only,
333 int64 max_count, 333 int64_t max_count,
334 WebIDBCallbacks* callbacks) { 334 WebIDBCallbacks* callbacks) {
335 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 335 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
336 IndexedDBHostMsg_DatabaseGetAll_Params params; 336 IndexedDBHostMsg_DatabaseGetAll_Params params;
337 init_params(&params, callbacks); 337 init_params(&params, callbacks);
338 params.ipc_database_id = ipc_database_id; 338 params.ipc_database_id = ipc_database_id;
339 params.transaction_id = transaction_id; 339 params.transaction_id = transaction_id;
340 params.object_store_id = object_store_id; 340 params.object_store_id = object_store_id;
341 params.index_id = index_id; 341 params.index_id = index_id;
342 params.key_range = key_range; 342 params.key_range = key_range;
343 params.key_only = key_only; 343 params.key_only = key_only;
344 params.max_count = max_count; 344 params.max_count = max_count;
345 Send(new IndexedDBHostMsg_DatabaseGetAll(params)); 345 Send(new IndexedDBHostMsg_DatabaseGetAll(params));
346 } 346 }
347 347
348 void IndexedDBDispatcher::RequestIDBDatabasePut( 348 void IndexedDBDispatcher::RequestIDBDatabasePut(
349 int32 ipc_database_id, 349 int32_t ipc_database_id,
350 int64 transaction_id, 350 int64_t transaction_id,
351 int64 object_store_id, 351 int64_t object_store_id,
352 const WebData& value, 352 const WebData& value,
353 const blink::WebVector<WebBlobInfo>& web_blob_info, 353 const blink::WebVector<WebBlobInfo>& web_blob_info,
354 const IndexedDBKey& key, 354 const IndexedDBKey& key,
355 blink::WebIDBPutMode put_mode, 355 blink::WebIDBPutMode put_mode,
356 WebIDBCallbacks* callbacks, 356 WebIDBCallbacks* callbacks,
357 const WebVector<long long>& index_ids, 357 const WebVector<long long>& index_ids,
358 const WebVector<WebVector<WebIDBKey> >& index_keys) { 358 const WebVector<WebVector<WebIDBKey>>& index_keys) {
359 if (value.size() + key.size_estimate() > max_put_value_size_) { 359 if (value.size() + key.size_estimate() > max_put_value_size_) {
360 callbacks->onError(WebIDBDatabaseError( 360 callbacks->onError(WebIDBDatabaseError(
361 blink::WebIDBDatabaseExceptionUnknownError, 361 blink::WebIDBDatabaseExceptionUnknownError,
362 WebString::fromUTF8(base::StringPrintf( 362 WebString::fromUTF8(base::StringPrintf(
363 "The serialized value is too large" 363 "The serialized value is too large"
364 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", 364 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).",
365 value.size(), 365 value.size(),
366 max_put_value_size_).c_str()))); 366 max_put_value_size_).c_str())));
367 return; 367 return;
368 } 368 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 blob_or_file_info.size = info.size(); 403 blob_or_file_info.size = info.size();
404 blob_or_file_info.uuid = info.uuid().latin1(); 404 blob_or_file_info.uuid = info.uuid().latin1();
405 DCHECK(blob_or_file_info.uuid.size()); 405 DCHECK(blob_or_file_info.uuid.size());
406 blob_or_file_info.mime_type = info.type(); 406 blob_or_file_info.mime_type = info.type();
407 } 407 }
408 408
409 Send(new IndexedDBHostMsg_DatabasePut(params)); 409 Send(new IndexedDBHostMsg_DatabasePut(params));
410 } 410 }
411 411
412 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( 412 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor(
413 int32 ipc_database_id, 413 int32_t ipc_database_id,
414 int64 transaction_id, 414 int64_t transaction_id,
415 int64 object_store_id, 415 int64_t object_store_id,
416 int64 index_id, 416 int64_t index_id,
417 const IndexedDBKeyRange& key_range, 417 const IndexedDBKeyRange& key_range,
418 blink::WebIDBCursorDirection direction, 418 blink::WebIDBCursorDirection direction,
419 bool key_only, 419 bool key_only,
420 blink::WebIDBTaskType task_type, 420 blink::WebIDBTaskType task_type,
421 WebIDBCallbacks* callbacks) { 421 WebIDBCallbacks* callbacks) {
422 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 422 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
423 IndexedDBHostMsg_DatabaseOpenCursor_Params params; 423 IndexedDBHostMsg_DatabaseOpenCursor_Params params;
424 init_params(&params, callbacks); 424 init_params(&params, callbacks);
425 params.ipc_database_id = ipc_database_id; 425 params.ipc_database_id = ipc_database_id;
426 params.transaction_id = transaction_id; 426 params.transaction_id = transaction_id;
427 params.object_store_id = object_store_id; 427 params.object_store_id = object_store_id;
428 params.index_id = index_id; 428 params.index_id = index_id;
429 params.key_range = key_range; 429 params.key_range = key_range;
430 params.direction = direction; 430 params.direction = direction;
431 params.key_only = key_only; 431 params.key_only = key_only;
432 params.task_type = task_type; 432 params.task_type = task_type;
433 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params)); 433 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params));
434 434
435 DCHECK(cursor_transaction_ids_.find(params.ipc_callbacks_id) == 435 DCHECK(cursor_transaction_ids_.find(params.ipc_callbacks_id) ==
436 cursor_transaction_ids_.end()); 436 cursor_transaction_ids_.end());
437 cursor_transaction_ids_[params.ipc_callbacks_id] = transaction_id; 437 cursor_transaction_ids_[params.ipc_callbacks_id] = transaction_id;
438 } 438 }
439 439
440 void IndexedDBDispatcher::RequestIDBDatabaseCount( 440 void IndexedDBDispatcher::RequestIDBDatabaseCount(
441 int32 ipc_database_id, 441 int32_t ipc_database_id,
442 int64 transaction_id, 442 int64_t transaction_id,
443 int64 object_store_id, 443 int64_t object_store_id,
444 int64 index_id, 444 int64_t index_id,
445 const IndexedDBKeyRange& key_range, 445 const IndexedDBKeyRange& key_range,
446 WebIDBCallbacks* callbacks) { 446 WebIDBCallbacks* callbacks) {
447 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 447 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
448 IndexedDBHostMsg_DatabaseCount_Params params; 448 IndexedDBHostMsg_DatabaseCount_Params params;
449 init_params(&params, callbacks); 449 init_params(&params, callbacks);
450 params.ipc_database_id = ipc_database_id; 450 params.ipc_database_id = ipc_database_id;
451 params.transaction_id = transaction_id; 451 params.transaction_id = transaction_id;
452 params.object_store_id = object_store_id; 452 params.object_store_id = object_store_id;
453 params.index_id = index_id; 453 params.index_id = index_id;
454 params.key_range = key_range; 454 params.key_range = key_range;
455 Send(new IndexedDBHostMsg_DatabaseCount(params)); 455 Send(new IndexedDBHostMsg_DatabaseCount(params));
456 } 456 }
457 457
458 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( 458 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange(
459 int32 ipc_database_id, 459 int32_t ipc_database_id,
460 int64 transaction_id, 460 int64_t transaction_id,
461 int64 object_store_id, 461 int64_t object_store_id,
462 const IndexedDBKeyRange& key_range, 462 const IndexedDBKeyRange& key_range,
463 WebIDBCallbacks* callbacks) { 463 WebIDBCallbacks* callbacks) {
464 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 464 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
465 IndexedDBHostMsg_DatabaseDeleteRange_Params params; 465 IndexedDBHostMsg_DatabaseDeleteRange_Params params;
466 init_params(&params, callbacks); 466 init_params(&params, callbacks);
467 params.ipc_database_id = ipc_database_id; 467 params.ipc_database_id = ipc_database_id;
468 params.transaction_id = transaction_id; 468 params.transaction_id = transaction_id;
469 params.object_store_id = object_store_id; 469 params.object_store_id = object_store_id;
470 params.key_range = key_range; 470 params.key_range = key_range;
471 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params)); 471 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params));
472 } 472 }
473 473
474 void IndexedDBDispatcher::RequestIDBDatabaseClear( 474 void IndexedDBDispatcher::RequestIDBDatabaseClear(
475 int32 ipc_database_id, 475 int32_t ipc_database_id,
476 int64 transaction_id, 476 int64_t transaction_id,
477 int64 object_store_id, 477 int64_t object_store_id,
478 WebIDBCallbacks* callbacks_ptr) { 478 WebIDBCallbacks* callbacks_ptr) {
479 ResetCursorPrefetchCaches(transaction_id, kAllCursors); 479 ResetCursorPrefetchCaches(transaction_id, kAllCursors);
480 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 480 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
481 int32 ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); 481 int32_t ipc_callbacks_id = pending_callbacks_.Add(callbacks.release());
482 Send(new IndexedDBHostMsg_DatabaseClear(CurrentWorkerId(), 482 Send(new IndexedDBHostMsg_DatabaseClear(CurrentWorkerId(),
483 ipc_callbacks_id, 483 ipc_callbacks_id,
484 ipc_database_id, 484 ipc_database_id,
485 transaction_id, 485 transaction_id,
486 object_store_id)); 486 object_store_id));
487 } 487 }
488 488
489 void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) { 489 void IndexedDBDispatcher::CursorDestroyed(int32_t ipc_cursor_id) {
490 cursors_.erase(ipc_cursor_id); 490 cursors_.erase(ipc_cursor_id);
491 } 491 }
492 492
493 void IndexedDBDispatcher::DatabaseDestroyed(int32 ipc_database_id) { 493 void IndexedDBDispatcher::DatabaseDestroyed(int32_t ipc_database_id) {
494 DCHECK_EQ(databases_.count(ipc_database_id), 1u); 494 DCHECK_EQ(databases_.count(ipc_database_id), 1u);
495 databases_.erase(ipc_database_id); 495 databases_.erase(ipc_database_id);
496 } 496 }
497 497
498 void IndexedDBDispatcher::OnSuccessIDBDatabase( 498 void IndexedDBDispatcher::OnSuccessIDBDatabase(
499 int32 ipc_thread_id, 499 int32_t ipc_thread_id,
500 int32 ipc_callbacks_id, 500 int32_t ipc_callbacks_id,
501 int32 ipc_database_callbacks_id, 501 int32_t ipc_database_callbacks_id,
502 int32 ipc_object_id, 502 int32_t ipc_object_id,
503 const IndexedDBDatabaseMetadata& idb_metadata) { 503 const IndexedDBDatabaseMetadata& idb_metadata) {
504 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 504 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
505 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 505 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
506 if (!callbacks) 506 if (!callbacks)
507 return; 507 return;
508 WebIDBMetadata metadata(ConvertMetadata(idb_metadata)); 508 WebIDBMetadata metadata(ConvertMetadata(idb_metadata));
509 // If an upgrade was performed, count will be non-zero. 509 // If an upgrade was performed, count will be non-zero.
510 WebIDBDatabase* database = NULL; 510 WebIDBDatabase* database = NULL;
511 511
512 // Back-end will send kNoDatabase if it was already sent in OnUpgradeNeeded. 512 // Back-end will send kNoDatabase if it was already sent in OnUpgradeNeeded.
513 // May already be deleted and removed from the table, but do not recreate.. 513 // May already be deleted and removed from the table, but do not recreate..
514 if (ipc_object_id != kNoDatabase) { 514 if (ipc_object_id != kNoDatabase) {
515 DCHECK(!databases_.count(ipc_object_id)); 515 DCHECK(!databases_.count(ipc_object_id));
516 database = databases_[ipc_object_id] = new WebIDBDatabaseImpl( 516 database = databases_[ipc_object_id] = new WebIDBDatabaseImpl(
517 ipc_object_id, ipc_database_callbacks_id, thread_safe_sender_.get()); 517 ipc_object_id, ipc_database_callbacks_id, thread_safe_sender_.get());
518 } 518 }
519 519
520 callbacks->onSuccess(database, metadata); 520 callbacks->onSuccess(database, metadata);
521 pending_callbacks_.Remove(ipc_callbacks_id); 521 pending_callbacks_.Remove(ipc_callbacks_id);
522 } 522 }
523 523
524 void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32 ipc_thread_id, 524 void IndexedDBDispatcher::OnSuccessIndexedDBKey(int32_t ipc_thread_id,
525 int32 ipc_callbacks_id, 525 int32_t ipc_callbacks_id,
526 const IndexedDBKey& key) { 526 const IndexedDBKey& key) {
527 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 527 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
528 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 528 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
529 if (!callbacks) 529 if (!callbacks)
530 return; 530 return;
531 callbacks->onSuccess(WebIDBKeyBuilder::Build(key)); 531 callbacks->onSuccess(WebIDBKeyBuilder::Build(key));
532 pending_callbacks_.Remove(ipc_callbacks_id); 532 pending_callbacks_.Remove(ipc_callbacks_id);
533 } 533 }
534 534
535 void IndexedDBDispatcher::OnSuccessStringList( 535 void IndexedDBDispatcher::OnSuccessStringList(
536 int32 ipc_thread_id, 536 int32_t ipc_thread_id,
537 int32 ipc_callbacks_id, 537 int32_t ipc_callbacks_id,
538 const std::vector<base::string16>& value) { 538 const std::vector<base::string16>& value) {
539 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 539 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
540 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 540 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
541 if (!callbacks) 541 if (!callbacks)
542 return; 542 return;
543 callbacks->onSuccess(WebVector<WebString>(value)); 543 callbacks->onSuccess(WebVector<WebString>(value));
544 pending_callbacks_.Remove(ipc_callbacks_id); 544 pending_callbacks_.Remove(ipc_callbacks_id);
545 } 545 }
546 546
547 // Populate some WebIDBValue members (data & blob info) from the supplied 547 // Populate some WebIDBValue members (data & blob info) from the supplied
(...skipping 24 matching lines...) Expand all
572 static void PrepareReturnWebValue(const IndexedDBMsg_ReturnValue& value, 572 static void PrepareReturnWebValue(const IndexedDBMsg_ReturnValue& value,
573 WebIDBValue* web_value) { 573 WebIDBValue* web_value) {
574 PrepareWebValue(value, web_value); 574 PrepareWebValue(value, web_value);
575 web_value->primaryKey = WebIDBKeyBuilder::Build(value.primary_key); 575 web_value->primaryKey = WebIDBKeyBuilder::Build(value.primary_key);
576 web_value->keyPath = WebIDBKeyPathBuilder::Build(value.key_path); 576 web_value->keyPath = WebIDBKeyPathBuilder::Build(value.key_path);
577 } 577 }
578 578
579 void IndexedDBDispatcher::OnSuccessArray( 579 void IndexedDBDispatcher::OnSuccessArray(
580 const IndexedDBMsg_CallbacksSuccessArray_Params& p) { 580 const IndexedDBMsg_CallbacksSuccessArray_Params& p) {
581 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); 581 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId());
582 int32 ipc_callbacks_id = p.ipc_callbacks_id; 582 int32_t ipc_callbacks_id = p.ipc_callbacks_id;
583 blink::WebVector<WebIDBValue> web_values(p.values.size()); 583 blink::WebVector<WebIDBValue> web_values(p.values.size());
584 for (size_t i = 0; i < p.values.size(); ++i) 584 for (size_t i = 0; i < p.values.size(); ++i)
585 PrepareReturnWebValue(p.values[i], &web_values[i]); 585 PrepareReturnWebValue(p.values[i], &web_values[i]);
586 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 586 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
587 DCHECK(callbacks); 587 DCHECK(callbacks);
588 callbacks->onSuccess(web_values); 588 callbacks->onSuccess(web_values);
589 pending_callbacks_.Remove(ipc_callbacks_id); 589 pending_callbacks_.Remove(ipc_callbacks_id);
590 } 590 }
591 591
592 void IndexedDBDispatcher::OnSuccessValue( 592 void IndexedDBDispatcher::OnSuccessValue(
593 const IndexedDBMsg_CallbacksSuccessValue_Params& params) { 593 const IndexedDBMsg_CallbacksSuccessValue_Params& params) {
594 DCHECK_EQ(params.ipc_thread_id, CurrentWorkerId()); 594 DCHECK_EQ(params.ipc_thread_id, CurrentWorkerId());
595 WebIDBCallbacks* callbacks = 595 WebIDBCallbacks* callbacks =
596 pending_callbacks_.Lookup(params.ipc_callbacks_id); 596 pending_callbacks_.Lookup(params.ipc_callbacks_id);
597 if (!callbacks) 597 if (!callbacks)
598 return; 598 return;
599 WebIDBValue web_value; 599 WebIDBValue web_value;
600 PrepareReturnWebValue(params.value, &web_value); 600 PrepareReturnWebValue(params.value, &web_value);
601 if (params.value.primary_key.IsValid()) { 601 if (params.value.primary_key.IsValid()) {
602 web_value.primaryKey = WebIDBKeyBuilder::Build(params.value.primary_key); 602 web_value.primaryKey = WebIDBKeyBuilder::Build(params.value.primary_key);
603 web_value.keyPath = WebIDBKeyPathBuilder::Build(params.value.key_path); 603 web_value.keyPath = WebIDBKeyPathBuilder::Build(params.value.key_path);
604 } 604 }
605 callbacks->onSuccess(web_value); 605 callbacks->onSuccess(web_value);
606 cursor_transaction_ids_.erase(params.ipc_callbacks_id); 606 cursor_transaction_ids_.erase(params.ipc_callbacks_id);
607 pending_callbacks_.Remove(params.ipc_callbacks_id); 607 pending_callbacks_.Remove(params.ipc_callbacks_id);
608 } 608 }
609 609
610 void IndexedDBDispatcher::OnSuccessInteger(int32 ipc_thread_id, 610 void IndexedDBDispatcher::OnSuccessInteger(int32_t ipc_thread_id,
611 int32 ipc_callbacks_id, 611 int32_t ipc_callbacks_id,
612 int64 value) { 612 int64_t value) {
613 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 613 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
614 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 614 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
615 if (!callbacks) 615 if (!callbacks)
616 return; 616 return;
617 callbacks->onSuccess(value); 617 callbacks->onSuccess(value);
618 pending_callbacks_.Remove(ipc_callbacks_id); 618 pending_callbacks_.Remove(ipc_callbacks_id);
619 } 619 }
620 620
621 void IndexedDBDispatcher::OnSuccessUndefined(int32 ipc_thread_id, 621 void IndexedDBDispatcher::OnSuccessUndefined(int32_t ipc_thread_id,
622 int32 ipc_callbacks_id) { 622 int32_t ipc_callbacks_id) {
623 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 623 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
624 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 624 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
625 if (!callbacks) 625 if (!callbacks)
626 return; 626 return;
627 callbacks->onSuccess(); 627 callbacks->onSuccess();
628 pending_callbacks_.Remove(ipc_callbacks_id); 628 pending_callbacks_.Remove(ipc_callbacks_id);
629 } 629 }
630 630
631 void IndexedDBDispatcher::OnSuccessOpenCursor( 631 void IndexedDBDispatcher::OnSuccessOpenCursor(
632 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { 632 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) {
633 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); 633 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId());
634 int32 ipc_callbacks_id = p.ipc_callbacks_id; 634 int32_t ipc_callbacks_id = p.ipc_callbacks_id;
635 int32 ipc_object_id = p.ipc_cursor_id; 635 int32_t ipc_object_id = p.ipc_cursor_id;
636 const IndexedDBKey& key = p.key; 636 const IndexedDBKey& key = p.key;
637 const IndexedDBKey& primary_key = p.primary_key; 637 const IndexedDBKey& primary_key = p.primary_key;
638 WebIDBValue web_value; 638 WebIDBValue web_value;
639 PrepareWebValue(p.value, &web_value); 639 PrepareWebValue(p.value, &web_value);
640 640
641 DCHECK(cursor_transaction_ids_.find(ipc_callbacks_id) != 641 DCHECK(cursor_transaction_ids_.find(ipc_callbacks_id) !=
642 cursor_transaction_ids_.end()); 642 cursor_transaction_ids_.end());
643 int64 transaction_id = cursor_transaction_ids_[ipc_callbacks_id]; 643 int64_t transaction_id = cursor_transaction_ids_[ipc_callbacks_id];
644 cursor_transaction_ids_.erase(ipc_callbacks_id); 644 cursor_transaction_ids_.erase(ipc_callbacks_id);
645 645
646 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 646 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
647 if (!callbacks) 647 if (!callbacks)
648 return; 648 return;
649 649
650 WebIDBCursorImpl* cursor = new WebIDBCursorImpl( 650 WebIDBCursorImpl* cursor = new WebIDBCursorImpl(
651 ipc_object_id, transaction_id, thread_safe_sender_.get()); 651 ipc_object_id, transaction_id, thread_safe_sender_.get());
652 cursors_[ipc_object_id] = cursor; 652 cursors_[ipc_object_id] = cursor;
653 callbacks->onSuccess(cursor, WebIDBKeyBuilder::Build(key), 653 callbacks->onSuccess(cursor, WebIDBKeyBuilder::Build(key),
654 WebIDBKeyBuilder::Build(primary_key), web_value); 654 WebIDBKeyBuilder::Build(primary_key), web_value);
655 655
656 pending_callbacks_.Remove(ipc_callbacks_id); 656 pending_callbacks_.Remove(ipc_callbacks_id);
657 } 657 }
658 658
659 void IndexedDBDispatcher::OnSuccessCursorContinue( 659 void IndexedDBDispatcher::OnSuccessCursorContinue(
660 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { 660 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) {
661 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); 661 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId());
662 int32 ipc_callbacks_id = p.ipc_callbacks_id; 662 int32_t ipc_callbacks_id = p.ipc_callbacks_id;
663 int32 ipc_cursor_id = p.ipc_cursor_id; 663 int32_t ipc_cursor_id = p.ipc_cursor_id;
664 const IndexedDBKey& key = p.key; 664 const IndexedDBKey& key = p.key;
665 const IndexedDBKey& primary_key = p.primary_key; 665 const IndexedDBKey& primary_key = p.primary_key;
666 666
667 if (cursors_.find(ipc_cursor_id) == cursors_.end()) 667 if (cursors_.find(ipc_cursor_id) == cursors_.end())
668 return; 668 return;
669 669
670 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 670 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
671 if (!callbacks) 671 if (!callbacks)
672 return; 672 return;
673 673
674 WebIDBValue web_value; 674 WebIDBValue web_value;
675 PrepareWebValue(p.value, &web_value); 675 PrepareWebValue(p.value, &web_value);
676 callbacks->onSuccess(WebIDBKeyBuilder::Build(key), 676 callbacks->onSuccess(WebIDBKeyBuilder::Build(key),
677 WebIDBKeyBuilder::Build(primary_key), web_value); 677 WebIDBKeyBuilder::Build(primary_key), web_value);
678 678
679 pending_callbacks_.Remove(ipc_callbacks_id); 679 pending_callbacks_.Remove(ipc_callbacks_id);
680 } 680 }
681 681
682 void IndexedDBDispatcher::OnSuccessCursorPrefetch( 682 void IndexedDBDispatcher::OnSuccessCursorPrefetch(
683 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { 683 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) {
684 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); 684 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId());
685 int32 ipc_callbacks_id = p.ipc_callbacks_id; 685 int32_t ipc_callbacks_id = p.ipc_callbacks_id;
686 int32 ipc_cursor_id = p.ipc_cursor_id; 686 int32_t ipc_cursor_id = p.ipc_cursor_id;
687 std::vector<WebIDBValue> values(p.values.size()); 687 std::vector<WebIDBValue> values(p.values.size());
688 for (size_t i = 0; i < p.values.size(); ++i) 688 for (size_t i = 0; i < p.values.size(); ++i)
689 PrepareWebValue(p.values[i], &values[i]); 689 PrepareWebValue(p.values[i], &values[i]);
690 std::map<int32, WebIDBCursorImpl*>::const_iterator cur_iter = 690 std::map<int32_t, WebIDBCursorImpl*>::const_iterator cur_iter =
691 cursors_.find(ipc_cursor_id); 691 cursors_.find(ipc_cursor_id);
692 if (cur_iter == cursors_.end()) 692 if (cur_iter == cursors_.end())
693 return; 693 return;
694 694
695 cur_iter->second->SetPrefetchData(p.keys, p.primary_keys, values); 695 cur_iter->second->SetPrefetchData(p.keys, p.primary_keys, values);
696 696
697 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 697 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
698 DCHECK(callbacks); 698 DCHECK(callbacks);
699 cur_iter->second->CachedContinue(callbacks); 699 cur_iter->second->CachedContinue(callbacks);
700 pending_callbacks_.Remove(ipc_callbacks_id); 700 pending_callbacks_.Remove(ipc_callbacks_id);
701 } 701 }
702 702
703 void IndexedDBDispatcher::OnIntBlocked(int32 ipc_thread_id, 703 void IndexedDBDispatcher::OnIntBlocked(int32_t ipc_thread_id,
704 int32 ipc_callbacks_id, 704 int32_t ipc_callbacks_id,
705 int64 existing_version) { 705 int64_t existing_version) {
706 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 706 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
707 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 707 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
708 DCHECK(callbacks); 708 DCHECK(callbacks);
709 callbacks->onBlocked(existing_version); 709 callbacks->onBlocked(existing_version);
710 } 710 }
711 711
712 void IndexedDBDispatcher::OnUpgradeNeeded( 712 void IndexedDBDispatcher::OnUpgradeNeeded(
713 const IndexedDBMsg_CallbacksUpgradeNeeded_Params& p) { 713 const IndexedDBMsg_CallbacksUpgradeNeeded_Params& p) {
714 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); 714 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId());
715 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(p.ipc_callbacks_id); 715 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(p.ipc_callbacks_id);
716 DCHECK(callbacks); 716 DCHECK(callbacks);
717 WebIDBMetadata metadata(ConvertMetadata(p.idb_metadata)); 717 WebIDBMetadata metadata(ConvertMetadata(p.idb_metadata));
718 DCHECK(!databases_.count(p.ipc_database_id)); 718 DCHECK(!databases_.count(p.ipc_database_id));
719 databases_[p.ipc_database_id] = 719 databases_[p.ipc_database_id] =
720 new WebIDBDatabaseImpl(p.ipc_database_id, 720 new WebIDBDatabaseImpl(p.ipc_database_id,
721 p.ipc_database_callbacks_id, 721 p.ipc_database_callbacks_id,
722 thread_safe_sender_.get()); 722 thread_safe_sender_.get());
723 callbacks->onUpgradeNeeded( 723 callbacks->onUpgradeNeeded(
724 p.old_version, 724 p.old_version,
725 databases_[p.ipc_database_id], 725 databases_[p.ipc_database_id],
726 metadata, 726 metadata,
727 static_cast<blink::WebIDBDataLoss>(p.data_loss), 727 static_cast<blink::WebIDBDataLoss>(p.data_loss),
728 WebString::fromUTF8(p.data_loss_message)); 728 WebString::fromUTF8(p.data_loss_message));
729 } 729 }
730 730
731 void IndexedDBDispatcher::OnError(int32 ipc_thread_id, 731 void IndexedDBDispatcher::OnError(int32_t ipc_thread_id,
732 int32 ipc_callbacks_id, 732 int32_t ipc_callbacks_id,
733 int code, 733 int code,
734 const base::string16& message) { 734 const base::string16& message) {
735 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 735 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
736 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); 736 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id);
737 if (!callbacks) 737 if (!callbacks)
738 return; 738 return;
739 if (message.empty()) 739 if (message.empty())
740 callbacks->onError(WebIDBDatabaseError(code)); 740 callbacks->onError(WebIDBDatabaseError(code));
741 else 741 else
742 callbacks->onError(WebIDBDatabaseError(code, message)); 742 callbacks->onError(WebIDBDatabaseError(code, message));
743 pending_callbacks_.Remove(ipc_callbacks_id); 743 pending_callbacks_.Remove(ipc_callbacks_id);
744 cursor_transaction_ids_.erase(ipc_callbacks_id); 744 cursor_transaction_ids_.erase(ipc_callbacks_id);
745 } 745 }
746 746
747 void IndexedDBDispatcher::OnAbort(int32 ipc_thread_id, 747 void IndexedDBDispatcher::OnAbort(int32_t ipc_thread_id,
748 int32 ipc_database_callbacks_id, 748 int32_t ipc_database_callbacks_id,
749 int64 transaction_id, 749 int64_t transaction_id,
750 int code, 750 int code,
751 const base::string16& message) { 751 const base::string16& message) {
752 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 752 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
753 WebIDBDatabaseCallbacks* callbacks = 753 WebIDBDatabaseCallbacks* callbacks =
754 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); 754 pending_database_callbacks_.Lookup(ipc_database_callbacks_id);
755 if (!callbacks) 755 if (!callbacks)
756 return; 756 return;
757 if (message.empty()) 757 if (message.empty())
758 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code)); 758 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code));
759 else 759 else
760 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code, message)); 760 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code, message));
761 } 761 }
762 762
763 void IndexedDBDispatcher::OnComplete(int32 ipc_thread_id, 763 void IndexedDBDispatcher::OnComplete(int32_t ipc_thread_id,
764 int32 ipc_database_callbacks_id, 764 int32_t ipc_database_callbacks_id,
765 int64 transaction_id) { 765 int64_t transaction_id) {
766 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 766 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
767 WebIDBDatabaseCallbacks* callbacks = 767 WebIDBDatabaseCallbacks* callbacks =
768 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); 768 pending_database_callbacks_.Lookup(ipc_database_callbacks_id);
769 if (!callbacks) 769 if (!callbacks)
770 return; 770 return;
771 callbacks->onComplete(transaction_id); 771 callbacks->onComplete(transaction_id);
772 } 772 }
773 773
774 void IndexedDBDispatcher::OnForcedClose(int32 ipc_thread_id, 774 void IndexedDBDispatcher::OnForcedClose(int32_t ipc_thread_id,
775 int32 ipc_database_callbacks_id) { 775 int32_t ipc_database_callbacks_id) {
776 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 776 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
777 WebIDBDatabaseCallbacks* callbacks = 777 WebIDBDatabaseCallbacks* callbacks =
778 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); 778 pending_database_callbacks_.Lookup(ipc_database_callbacks_id);
779 if (!callbacks) 779 if (!callbacks)
780 return; 780 return;
781 callbacks->onForcedClose(); 781 callbacks->onForcedClose();
782 } 782 }
783 783
784 void IndexedDBDispatcher::OnIntVersionChange(int32 ipc_thread_id, 784 void IndexedDBDispatcher::OnIntVersionChange(int32_t ipc_thread_id,
785 int32 ipc_database_callbacks_id, 785 int32_t ipc_database_callbacks_id,
786 int64 old_version, 786 int64_t old_version,
787 int64 new_version) { 787 int64_t new_version) {
788 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 788 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
789 WebIDBDatabaseCallbacks* callbacks = 789 WebIDBDatabaseCallbacks* callbacks =
790 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); 790 pending_database_callbacks_.Lookup(ipc_database_callbacks_id);
791 // callbacks would be NULL if a versionchange event is received after close 791 // callbacks would be NULL if a versionchange event is received after close
792 // has been called. 792 // has been called.
793 if (!callbacks) 793 if (!callbacks)
794 return; 794 return;
795 callbacks->onVersionChange(old_version, new_version); 795 callbacks->onVersionChange(old_version, new_version);
796 } 796 }
797 797
798 void IndexedDBDispatcher::ResetCursorPrefetchCaches( 798 void IndexedDBDispatcher::ResetCursorPrefetchCaches(
799 int64 transaction_id, 799 int64_t transaction_id,
800 int32 ipc_exception_cursor_id) { 800 int32_t ipc_exception_cursor_id) {
801 typedef std::map<int32, WebIDBCursorImpl*>::iterator Iterator; 801 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator;
802 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 802 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
803 if (i->first == ipc_exception_cursor_id || 803 if (i->first == ipc_exception_cursor_id ||
804 i->second->transaction_id() != transaction_id) 804 i->second->transaction_id() != transaction_id)
805 continue; 805 continue;
806 i->second->ResetPrefetchCache(); 806 i->second->ResetPrefetchCache();
807 } 807 }
808 } 808 }
809 809
810 } // namespace content 810 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/indexed_db_dispatcher.h ('k') | content/child/indexed_db/indexed_db_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698