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

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

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Fix comments Created 4 years, 9 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 const AtomicString& IDBTransaction::interfaceName() const 337 const AtomicString& IDBTransaction::interfaceName() const
338 { 338 {
339 return EventTargetNames::IDBTransaction; 339 return EventTargetNames::IDBTransaction;
340 } 340 }
341 341
342 ExecutionContext* IDBTransaction::executionContext() const 342 ExecutionContext* IDBTransaction::executionContext() const
343 { 343 {
344 return ActiveDOMObject::executionContext(); 344 return ActiveDOMObject::executionContext();
345 } 345 }
346 346
347 bool IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) 347 DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr <Event> event)
348 { 348 {
349 IDB_TRACE("IDBTransaction::dispatchEvent"); 349 IDB_TRACE("IDBTransaction::dispatchEvent");
350 if (m_contextStopped || !executionContext()) { 350 if (m_contextStopped || !executionContext()) {
351 m_state = Finished; 351 m_state = Finished;
352 return false; 352 return DispatchEventResult::CanceledBeforeDispatch;
353 } 353 }
354 ASSERT(m_state != Finished); 354 ASSERT(m_state != Finished);
355 ASSERT(m_hasPendingActivity); 355 ASSERT(m_hasPendingActivity);
356 ASSERT(executionContext()); 356 ASSERT(executionContext());
357 ASSERT(event->target() == this); 357 ASSERT(event->target() == this);
358 m_state = Finished; 358 m_state = Finished;
359 359
360 // Break reference cycles. 360 // Break reference cycles.
361 for (auto& it : m_objectStoreMap) 361 for (auto& it : m_objectStoreMap)
362 it.value->transactionFinished(); 362 it.value->transactionFinished();
363 m_objectStoreMap.clear(); 363 m_objectStoreMap.clear();
364 for (auto& it : m_deletedObjectStores) 364 for (auto& it : m_deletedObjectStores)
365 it->transactionFinished(); 365 it->transactionFinished();
366 m_deletedObjectStores.clear(); 366 m_deletedObjectStores.clear();
367 367
368 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> targets; 368 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> targets;
369 targets.append(this); 369 targets.append(this);
370 targets.append(db()); 370 targets.append(db());
371 371
372 // FIXME: When we allow custom event dispatching, this will probably need to change. 372 // FIXME: When we allow custom event dispatching, this will probably need to change.
373 ASSERT(event->type() == EventTypeNames::complete || event->type() == EventTy peNames::abort); 373 ASSERT(event->type() == EventTypeNames::complete || event->type() == EventTy peNames::abort);
374 bool returnValue = IDBEventDispatcher::dispatch(event.get(), targets); 374 DispatchEventResult returnValue = IDBEventDispatcher::dispatch(event.get(), targets);
375 // FIXME: Try to construct a test where |this| outlives openDBRequest and we 375 // FIXME: Try to construct a test where |this| outlives openDBRequest and we
376 // get a crash. 376 // get a crash.
377 if (m_openDBRequest) { 377 if (m_openDBRequest) {
378 ASSERT(isVersionChange()); 378 ASSERT(isVersionChange());
379 m_openDBRequest->transactionDidFinishAndDispatch(); 379 m_openDBRequest->transactionDidFinishAndDispatch();
380 } 380 }
381 m_hasPendingActivity = false; 381 m_hasPendingActivity = false;
382 return returnValue; 382 return returnValue;
383 } 383 }
384 384
(...skipping 17 matching lines...) Expand all
402 event->setTarget(this); 402 event->setTarget(this);
403 eventQueue->enqueueEvent(event); 403 eventQueue->enqueueEvent(event);
404 } 404 }
405 405
406 WebIDBDatabase* IDBTransaction::backendDB() const 406 WebIDBDatabase* IDBTransaction::backendDB() const
407 { 407 {
408 return m_database->backend(); 408 return m_database->backend();
409 } 409 }
410 410
411 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698