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

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

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 years, 11 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 m_metadata.objectStores.set(oldMetadata->id, std::move(oldMetadata)); 549 m_metadata.objectStores.set(oldMetadata->id, std::move(oldMetadata));
550 } 550 }
551 551
552 bool IDBDatabase::hasPendingActivity() const { 552 bool IDBDatabase::hasPendingActivity() const {
553 // The script wrapper must not be collected before the object is closed or 553 // The script wrapper must not be collected before the object is closed or
554 // we can't fire a "versionchange" event to let script manually close the 554 // we can't fire a "versionchange" event to let script manually close the
555 // connection. 555 // connection.
556 return !m_closePending && getExecutionContext() && hasEventListeners(); 556 return !m_closePending && getExecutionContext() && hasEventListeners();
557 } 557 }
558 558
559 void IDBDatabase::contextDestroyed() { 559 void IDBDatabase::contextDestroyed(ExecutionContext*) {
560 // Immediately close the connection to the back end. Don't attempt a 560 // Immediately close the connection to the back end. Don't attempt a
561 // normal close() since that may wait on transactions which require a 561 // normal close() since that may wait on transactions which require a
562 // round trip to the back-end to abort. 562 // round trip to the back-end to abort.
563 if (m_backend) { 563 if (m_backend) {
564 m_backend->close(); 564 m_backend->close();
565 m_backend.reset(); 565 m_backend.reset();
566 } 566 }
567 567
568 if (m_databaseCallbacks) 568 if (m_databaseCallbacks)
569 m_databaseCallbacks->detachWebCallbacks(); 569 m_databaseCallbacks->detachWebCallbacks();
570 } 570 }
571 571
572 const AtomicString& IDBDatabase::interfaceName() const { 572 const AtomicString& IDBDatabase::interfaceName() const {
573 return EventTargetNames::IDBDatabase; 573 return EventTargetNames::IDBDatabase;
574 } 574 }
575 575
576 ExecutionContext* IDBDatabase::getExecutionContext() const { 576 ExecutionContext* IDBDatabase::getExecutionContext() const {
577 return ContextLifecycleObserver::getExecutionContext(); 577 return ContextLifecycleObserver::getExecutionContext();
578 } 578 }
579 579
580 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { 580 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) {
581 DEFINE_THREAD_SAFE_STATIC_LOCAL( 581 DEFINE_THREAD_SAFE_STATIC_LOCAL(
582 EnumerationHistogram, apiCallsHistogram, 582 EnumerationHistogram, apiCallsHistogram,
583 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", 583 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls",
584 IDBMethodsMax)); 584 IDBMethodsMax));
585 apiCallsHistogram.count(method); 585 apiCallsHistogram.count(method);
586 } 586 }
587 587
588 } // namespace blink 588 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698