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

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

Issue 2571193002: Signal no pending activity in destructed contexts. (Closed)
Patch Set: Created 4 years 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 << "Object store metadata reverted when versionchange transaction is " 551 << "Object store metadata reverted when versionchange transaction is "
552 "still active"; 552 "still active";
553 DCHECK(oldMetadata.get()); 553 DCHECK(oldMetadata.get());
554 m_metadata.objectStores.set(oldMetadata->id, std::move(oldMetadata)); 554 m_metadata.objectStores.set(oldMetadata->id, std::move(oldMetadata));
555 } 555 }
556 556
557 bool IDBDatabase::hasPendingActivity() const { 557 bool IDBDatabase::hasPendingActivity() const {
558 // The script wrapper must not be collected before the object is closed or 558 // The script wrapper must not be collected before the object is closed or
559 // we can't fire a "versionchange" event to let script manually close the 559 // we can't fire a "versionchange" event to let script manually close the
560 // connection. 560 // connection.
561 return !m_closePending && hasEventListeners() && getExecutionContext(); 561 return !m_closePending && getExecutionContext() && hasEventListeners();
562 } 562 }
563 563
564 void IDBDatabase::contextDestroyed() { 564 void IDBDatabase::contextDestroyed() {
565 // Immediately close the connection to the back end. Don't attempt a 565 // Immediately close the connection to the back end. Don't attempt a
566 // normal close() since that may wait on transactions which require a 566 // normal close() since that may wait on transactions which require a
567 // round trip to the back-end to abort. 567 // round trip to the back-end to abort.
568 if (m_backend) { 568 if (m_backend) {
569 m_backend->close(); 569 m_backend->close();
570 m_backend.reset(); 570 m_backend.reset();
571 } 571 }
(...skipping 12 matching lines...) Expand all
584 584
585 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { 585 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) {
586 DEFINE_THREAD_SAFE_STATIC_LOCAL( 586 DEFINE_THREAD_SAFE_STATIC_LOCAL(
587 EnumerationHistogram, apiCallsHistogram, 587 EnumerationHistogram, apiCallsHistogram,
588 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", 588 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls",
589 IDBMethodsMax)); 589 IDBMethodsMax));
590 apiCallsHistogram.count(method); 590 apiCallsHistogram.count(method);
591 } 591 }
592 592
593 } // namespace blink 593 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698