| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 class IDBTransactionTest : public testing::Test { | 50 class IDBTransactionTest : public testing::Test { |
| 51 public: | 51 public: |
| 52 IDBTransactionTest() | 52 IDBTransactionTest() |
| 53 : m_scope(V8ExecutionScope::create(v8::Isolate::GetCurrent())) | 53 : m_scope(V8ExecutionScope::create(v8::Isolate::GetCurrent())) |
| 54 , m_document(Document::create()) | 54 , m_document(Document::create()) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 v8::Isolate* isolate() const { return m_scope->isolate(); } |
| 59 |
| 58 ExecutionContext* executionContext() | 60 ExecutionContext* executionContext() |
| 59 { | 61 { |
| 60 return m_document.get(); | 62 return m_document.get(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 private: | 65 private: |
| 64 OwnPtr<V8ExecutionScope> m_scope; | 66 OwnPtr<V8ExecutionScope> m_scope; |
| 65 RefPtr<Document> m_document; | 67 RefPtr<Document> m_document; |
| 66 }; | 68 }; |
| 67 | 69 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 PersistentHeapHashSet<WeakMember<IDBTransaction> > set; | 102 PersistentHeapHashSet<WeakMember<IDBTransaction> > set; |
| 101 set.add(transaction); | 103 set.add(transaction); |
| 102 | 104 |
| 103 Heap::collectAllGarbage(); | 105 Heap::collectAllGarbage(); |
| 104 EXPECT_EQ(1u, set.size()); | 106 EXPECT_EQ(1u, set.size()); |
| 105 #else | 107 #else |
| 106 // Local reference, IDBDatabase's reference and IDBPendingTransactionMonitor
's reference: | 108 // Local reference, IDBDatabase's reference and IDBPendingTransactionMonitor
's reference: |
| 107 EXPECT_EQ(3, transaction->refCount()); | 109 EXPECT_EQ(3, transaction->refCount()); |
| 108 #endif | 110 #endif |
| 109 | 111 |
| 110 RefPtrWillBePersistent<IDBRequest> request = IDBRequest::create(executionCon
text(), IDBAny::createUndefined(), transaction.get()); | 112 RefPtrWillBePersistent<IDBRequest> request = IDBRequest::create(ScriptState:
:current(isolate()), IDBAny::createUndefined(), transaction.get()); |
| 111 IDBPendingTransactionMonitor::from(*executionContext()).deactivateNewTransac
tions(); | 113 IDBPendingTransactionMonitor::from(*executionContext()).deactivateNewTransac
tions(); |
| 112 | 114 |
| 113 #if ENABLE(OILPAN) | 115 #if ENABLE(OILPAN) |
| 114 Heap::collectAllGarbage(); | 116 Heap::collectAllGarbage(); |
| 115 EXPECT_EQ(1u, set.size()); | 117 EXPECT_EQ(1u, set.size()); |
| 116 #else | 118 #else |
| 117 // Local reference and IDBDatabase's reference., and the IDBRequest's refer
ence | 119 // Local reference and IDBDatabase's reference., and the IDBRequest's refer
ence |
| 118 EXPECT_EQ(3, transaction->refCount()); | 120 EXPECT_EQ(3, transaction->refCount()); |
| 119 #endif | 121 #endif |
| 120 | 122 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // onAbort() should have cleared the transaction's reference to the database
. | 186 // onAbort() should have cleared the transaction's reference to the database
. |
| 185 #if ENABLE(OILPAN) | 187 #if ENABLE(OILPAN) |
| 186 Heap::collectAllGarbage(); | 188 Heap::collectAllGarbage(); |
| 187 EXPECT_EQ(0u, set.size()); | 189 EXPECT_EQ(0u, set.size()); |
| 188 #else | 190 #else |
| 189 EXPECT_EQ(1, db->refCount()); | 191 EXPECT_EQ(1, db->refCount()); |
| 190 #endif | 192 #endif |
| 191 } | 193 } |
| 192 | 194 |
| 193 } // namespace | 195 } // namespace |
| OLD | NEW |