Chromium Code Reviews| Index: Source/core/testing/NullExecutionContext.h |
| diff --git a/Source/core/testing/NullExecutionContext.h b/Source/core/testing/NullExecutionContext.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1b921400fd0d6e877aef43e1b041a80790046c85 |
| --- /dev/null |
| +++ b/Source/core/testing/NullExecutionContext.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NullExecutionContext_h |
| +#define NullExecutionContext_h |
| + |
| +#include "core/dom/ExecutionContext.h" |
| +#include "core/dom/SecurityContext.h" |
| +#include "core/events/EventQueue.h" |
| +#include "platform/heap/Handle.h" |
| +#include "platform/weborigin/KURL.h" |
| +#include "wtf/RefCounted.h" |
| + |
| +namespace WebCore { |
| + |
| +class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinalized<NullExecutionContext>, public SecurityContext, public ExecutionContext { |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); |
| +public: |
| + NullExecutionContext(); |
| + |
| + virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); } |
| + |
| + virtual bool tasksNeedSuspension() OVERRIDE { return m_tasksNeedSuspension; } |
| + void setTasksNeedSuspention(bool flag) { m_tasksNeedSuspension = flag; } |
|
sof
2014/06/16 14:30:53
Fix the spelling mistake at the same time? :)
tyoshino (SeeGerritForStatus)
2014/06/17 01:55:45
Oh, OK. Done
|
| + |
| + void trace(Visitor* visitor) |
| + { |
| + visitor->trace(m_queue); |
| + ExecutionContext::trace(visitor); |
| + } |
| + |
| + virtual void reportBlockedScriptExecutionToInspector(const String& directiveText) OVERRIDE { } |
| + virtual SecurityContext& securityContext() OVERRIDE { return *this; } |
| + |
| +#if !ENABLE(OILPAN) |
| + using RefCounted<NullExecutionContext>::ref; |
| + using RefCounted<NullExecutionContext>::deref; |
| + |
| + virtual void refExecutionContext() OVERRIDE { ref(); } |
| + virtual void derefExecutionContext() OVERRIDE { deref(); } |
| +#endif |
| + |
| +protected: |
| + virtual const KURL& virtualURL() const OVERRIDE { return m_dummyURL; } |
| + virtual KURL virtualCompleteURL(const String&) const OVERRIDE { return m_dummyURL; } |
| + |
| +private: |
| + bool m_tasksNeedSuspension; |
| + OwnPtrWillBeMember<EventQueue> m_queue; |
| + |
| + KURL m_dummyURL; |
| +}; |
| + |
| +} // namespace WebCore |
| + |
| +#endif // NullExecutionContext_h |