OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 NullEventQueue() { } | 49 NullEventQueue() { } |
50 virtual ~NullEventQueue() { } | 50 virtual ~NullEventQueue() { } |
51 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t
rue; } | 51 virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return t
rue; } |
52 virtual bool cancelEvent(Event*) OVERRIDE { return true; } | 52 virtual bool cancelEvent(Event*) OVERRIDE { return true; } |
53 virtual void close() OVERRIDE { } | 53 virtual void close() OVERRIDE { } |
54 }; | 54 }; |
55 | 55 |
56 class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinali
zed<NullExecutionContext>, public ExecutionContext { | 56 class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinali
zed<NullExecutionContext>, public ExecutionContext { |
57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); | 57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); |
58 public: | 58 public: |
59 void trace(Visitor* visitor) { ExecutionContext::trace(visitor); } | 59 NullExecutionContext(); |
| 60 |
| 61 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); } |
| 62 |
| 63 void trace(Visitor* visitor) |
| 64 { |
| 65 visitor->trace(m_queue); |
| 66 ExecutionContext::trace(visitor); |
| 67 } |
| 68 |
60 #if !ENABLE(OILPAN) | 69 #if !ENABLE(OILPAN) |
61 using RefCounted<NullExecutionContext>::ref; | 70 using RefCounted<NullExecutionContext>::ref; |
62 using RefCounted<NullExecutionContext>::deref; | 71 using RefCounted<NullExecutionContext>::deref; |
63 | 72 |
64 virtual void refExecutionContext() OVERRIDE { ref(); } | 73 virtual void refExecutionContext() OVERRIDE { ref(); } |
65 virtual void derefExecutionContext() OVERRIDE { deref(); } | 74 virtual void derefExecutionContext() OVERRIDE { deref(); } |
66 #endif | 75 #endif |
67 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); } | |
68 | 76 |
69 NullExecutionContext(); | |
70 private: | 77 private: |
71 OwnPtr<EventQueue> m_queue; | 78 OwnPtrWillBeMember<EventQueue> m_queue; |
72 }; | 79 }; |
73 | 80 |
74 NullExecutionContext::NullExecutionContext() | 81 NullExecutionContext::NullExecutionContext() |
75 : m_queue(adoptPtr(new NullEventQueue())) | 82 : m_queue(adoptPtrWillBeNoop(new NullEventQueue())) |
76 { | 83 { |
77 } | 84 } |
78 | 85 |
79 class IDBRequestTest : public testing::Test { | 86 class IDBRequestTest : public testing::Test { |
80 public: | 87 public: |
81 IDBRequestTest() | 88 IDBRequestTest() |
82 : m_scope(v8::Isolate::GetCurrent()) | 89 : m_scope(v8::Isolate::GetCurrent()) |
83 , m_executionContext(adoptRefWillBeNoop(new NullExecutionContext())) | 90 , m_executionContext(adoptRefWillBeNoop(new NullExecutionContext())) |
84 { | 91 { |
85 m_scope.scriptState()->setExecutionContext(m_executionContext.get()); | 92 m_scope.scriptState()->setExecutionContext(m_executionContext.get()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); | 186 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); |
180 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); | 187 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); |
181 EXPECT_EQ(request->readyState(), "pending"); | 188 EXPECT_EQ(request->readyState(), "pending"); |
182 | 189 |
183 executionContext()->stopActiveDOMObjects(); | 190 executionContext()->stopActiveDOMObjects(); |
184 request->onSuccess(backend.release(), metadata); | 191 request->onSuccess(backend.release(), metadata); |
185 } | 192 } |
186 } | 193 } |
187 | 194 |
188 } // namespace | 195 } // namespace |
OLD | NEW |