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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return IndexedDBNames::readwrite; 332 return IndexedDBNames::readwrite;
333 333
334 case WebIDBTransactionModeVersionChange: 334 case WebIDBTransactionModeVersionChange:
335 return IndexedDBNames::versionchange; 335 return IndexedDBNames::versionchange;
336 } 336 }
337 337
338 ASSERT_NOT_REACHED(); 338 ASSERT_NOT_REACHED();
339 return IndexedDBNames::readonly; 339 return IndexedDBNames::readonly;
340 } 340 }
341 341
342 PassRefPtrWillBeRawPtr<DOMStringList> IDBTransaction::objectStoreNames() const 342 RawPtr<DOMStringList> IDBTransaction::objectStoreNames() const
343 { 343 {
344 if (m_mode == WebIDBTransactionModeVersionChange) 344 if (m_mode == WebIDBTransactionModeVersionChange)
345 return m_database->objectStoreNames(); 345 return m_database->objectStoreNames();
346 346
347 RefPtrWillBeRawPtr<DOMStringList> objectStoreNames = DOMStringList::create(D OMStringList::IndexedDB); 347 RawPtr<DOMStringList> objectStoreNames = DOMStringList::create(DOMStringList ::IndexedDB);
348 for (const String& name : m_objectStoreNames) 348 for (const String& name : m_objectStoreNames)
349 objectStoreNames->append(name); 349 objectStoreNames->append(name);
350 objectStoreNames->sort(); 350 objectStoreNames->sort();
351 return objectStoreNames.release(); 351 return objectStoreNames.release();
352 } 352 }
353 353
354 const AtomicString& IDBTransaction::interfaceName() const 354 const AtomicString& IDBTransaction::interfaceName() const
355 { 355 {
356 return EventTargetNames::IDBTransaction; 356 return EventTargetNames::IDBTransaction;
357 } 357 }
358 358
359 ExecutionContext* IDBTransaction::getExecutionContext() const 359 ExecutionContext* IDBTransaction::getExecutionContext() const
360 { 360 {
361 return ActiveDOMObject::getExecutionContext(); 361 return ActiveDOMObject::getExecutionContext();
362 } 362 }
363 363
364 DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr <Event> event) 364 DispatchEventResult IDBTransaction::dispatchEventInternal(RawPtr<Event> event)
365 { 365 {
366 IDB_TRACE("IDBTransaction::dispatchEvent"); 366 IDB_TRACE("IDBTransaction::dispatchEvent");
367 if (m_contextStopped || !getExecutionContext()) { 367 if (m_contextStopped || !getExecutionContext()) {
368 m_state = Finished; 368 m_state = Finished;
369 return DispatchEventResult::CanceledBeforeDispatch; 369 return DispatchEventResult::CanceledBeforeDispatch;
370 } 370 }
371 ASSERT(m_state != Finished); 371 ASSERT(m_state != Finished);
372 ASSERT(m_hasPendingActivity); 372 ASSERT(m_hasPendingActivity);
373 ASSERT(getExecutionContext()); 373 ASSERT(getExecutionContext());
374 ASSERT(event->target() == this); 374 ASSERT(event->target() == this);
375 m_state = Finished; 375 m_state = Finished;
376 376
377 // Break reference cycles. 377 // Break reference cycles.
378 // TODO(jsbell): This can be removed c/o Oilpan. 378 // TODO(jsbell): This can be removed c/o Oilpan.
379 for (auto& it : m_objectStoreMap) 379 for (auto& it : m_objectStoreMap)
380 it.value->transactionFinished(); 380 it.value->transactionFinished();
381 m_objectStoreMap.clear(); 381 m_objectStoreMap.clear();
382 for (auto& it : m_deletedObjectStores) 382 for (auto& it : m_deletedObjectStores)
383 it->transactionFinished(); 383 it->transactionFinished();
384 m_createdObjectStores.clear(); 384 m_createdObjectStores.clear();
385 m_deletedObjectStores.clear(); 385 m_deletedObjectStores.clear();
386 386
387 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> targets; 387 HeapVector<Member<EventTarget>> targets;
388 targets.append(this); 388 targets.append(this);
389 targets.append(db()); 389 targets.append(db());
390 390
391 // FIXME: When we allow custom event dispatching, this will probably need to change. 391 // FIXME: When we allow custom event dispatching, this will probably need to change.
392 ASSERT(event->type() == EventTypeNames::complete || event->type() == EventTy peNames::abort); 392 ASSERT(event->type() == EventTypeNames::complete || event->type() == EventTy peNames::abort);
393 DispatchEventResult dispatchResult = IDBEventDispatcher::dispatch(event.get( ), targets); 393 DispatchEventResult dispatchResult = IDBEventDispatcher::dispatch(event.get( ), targets);
394 // FIXME: Try to construct a test where |this| outlives openDBRequest and we 394 // FIXME: Try to construct a test where |this| outlives openDBRequest and we
395 // get a crash. 395 // get a crash.
396 if (m_openDBRequest) { 396 if (m_openDBRequest) {
397 ASSERT(isVersionChange()); 397 ASSERT(isVersionChange());
398 m_openDBRequest->transactionDidFinishAndDispatch(); 398 m_openDBRequest->transactionDidFinishAndDispatch();
399 } 399 }
400 m_hasPendingActivity = false; 400 m_hasPendingActivity = false;
401 return dispatchResult; 401 return dispatchResult;
402 } 402 }
403 403
404 void IDBTransaction::stop() 404 void IDBTransaction::stop()
405 { 405 {
406 if (m_contextStopped) 406 if (m_contextStopped)
407 return; 407 return;
408 408
409 m_contextStopped = true; 409 m_contextStopped = true;
410 410
411 abort(IGNORE_EXCEPTION); 411 abort(IGNORE_EXCEPTION);
412 } 412 }
413 413
414 void IDBTransaction::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) 414 void IDBTransaction::enqueueEvent(RawPtr<Event> event)
415 { 415 {
416 DCHECK_NE(m_state, Finished) << "A finished transaction tried to enqueue an event of type " << event->type() << "."; 416 DCHECK_NE(m_state, Finished) << "A finished transaction tried to enqueue an event of type " << event->type() << ".";
417 if (m_contextStopped || !getExecutionContext()) 417 if (m_contextStopped || !getExecutionContext())
418 return; 418 return;
419 419
420 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); 420 EventQueue* eventQueue = getExecutionContext()->getEventQueue();
421 event->setTarget(this); 421 event->setTarget(this);
422 eventQueue->enqueueEvent(event); 422 eventQueue->enqueueEvent(event);
423 } 423 }
424 424
425 WebIDBDatabase* IDBTransaction::backendDB() const 425 WebIDBDatabase* IDBTransaction::backendDB() const
426 { 426 {
427 return m_database->backend(); 427 return m_database->backend();
428 } 428 }
429 429
430 } // namespace blink 430 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698