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

Side by Side Diff: Source/modules/indexeddb/IDBDatabase.cpp

Issue 1241613004: Rework dispatchEvent so it is consistent for isTrusted support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work around MSVC optimization bug Created 5 years, 5 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) 394 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
395 { 395 {
396 ASSERT(!m_contextStopped); 396 ASSERT(!m_contextStopped);
397 ASSERT(executionContext()); 397 ASSERT(executionContext());
398 EventQueue* eventQueue = executionContext()->eventQueue(); 398 EventQueue* eventQueue = executionContext()->eventQueue();
399 event->setTarget(this); 399 event->setTarget(this);
400 eventQueue->enqueueEvent(event.get()); 400 eventQueue->enqueueEvent(event.get());
401 m_enqueuedEvents.append(event); 401 m_enqueuedEvents.append(event);
402 } 402 }
403 403
404 bool IDBDatabase::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 404 bool IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
405 { 405 {
406 IDB_TRACE("IDBDatabase::dispatchEvent"); 406 IDB_TRACE("IDBDatabase::dispatchEvent");
407 if (m_contextStopped || !executionContext()) 407 if (m_contextStopped || !executionContext())
408 return false; 408 return false;
409 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev entTypeNames::close); 409 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev entTypeNames::close);
410 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 410 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
411 if (m_enqueuedEvents[i].get() == event.get()) 411 if (m_enqueuedEvents[i].get() == event.get())
412 m_enqueuedEvents.remove(i); 412 m_enqueuedEvents.remove(i);
413 } 413 }
414 414
415 bool result = EventTarget::dispatchEvent(event.get()); 415 bool result = EventTarget::dispatchEventInternal(event.get());
416 if (event->type() == EventTypeNames::versionchange && !m_closePending && m_b ackend) 416 if (event->type() == EventTypeNames::versionchange && !m_closePending && m_b ackend)
417 m_backend->versionChangeIgnored(); 417 m_backend->versionChangeIgnored();
418 return result; 418 return result;
419 } 419 }
420 420
421 int64_t IDBDatabase::findObjectStoreId(const String& name) const 421 int64_t IDBDatabase::findObjectStoreId(const String& name) const
422 { 422 {
423 for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = m_metadata.obj ectStores.begin(); it != m_metadata.objectStores.end(); ++it) { 423 for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = m_metadata.obj ectStores.begin(); it != m_metadata.objectStores.end(); ++it) {
424 if (it->value.name == name) { 424 if (it->value.name == name) {
425 ASSERT(it->key != IDBObjectStoreMetadata::InvalidId); 425 ASSERT(it->key != IDBObjectStoreMetadata::InvalidId);
(...skipping 27 matching lines...) Expand all
453 { 453 {
454 return EventTargetNames::IDBDatabase; 454 return EventTargetNames::IDBDatabase;
455 } 455 }
456 456
457 ExecutionContext* IDBDatabase::executionContext() const 457 ExecutionContext* IDBDatabase::executionContext() const
458 { 458 {
459 return ActiveDOMObject::executionContext(); 459 return ActiveDOMObject::executionContext();
460 } 460 }
461 461
462 } // namespace blink 462 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698