Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / testing / NullExecutionContext.h
blobd5197a50a2ef2544e2433255602496df5a7e4c45
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NullExecutionContext_h
6 #define NullExecutionContext_h
8 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/SecurityContext.h"
10 #include "core/events/EventQueue.h"
11 #include "core/inspector/ConsoleMessage.h"
12 #include "core/inspector/ScriptCallStack.h"
13 #include "platform/heap/Handle.h"
14 #include "platform/weborigin/KURL.h"
15 #include "wtf/RefCounted.h"
17 namespace blink {
19 class NullExecutionContext final : public RefCountedWillBeGarbageCollectedFinalized<NullExecutionContext>, public SecurityContext, public ExecutionContext {
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext);
21 public:
22 NullExecutionContext();
24 void disableEval(const String&) override { }
25 String userAgent(const KURL&) const override { return String(); }
27 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) override;
29 EventTarget* errorEventTarget() override { return nullptr; }
30 EventQueue* eventQueue() const override { return m_queue.get(); }
32 bool tasksNeedSuspension() override { return m_tasksNeedSuspension; }
33 void setTasksNeedSuspension(bool flag) { m_tasksNeedSuspension = flag; }
35 void reportBlockedScriptExecutionToInspector(const String& directiveText) override { }
36 void didUpdateSecurityOrigin() override { }
37 SecurityContext& securityContext() override { return *this; }
38 DOMTimerCoordinator* timers() override { return nullptr; }
40 double timerAlignmentInterval() const;
42 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override { }
43 void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>) override { }
45 bool isPrivilegedContext(String& errorMessage, const PrivilegeContextCheck = StandardPrivilegeCheck) const override;
47 DEFINE_INLINE_TRACE()
49 visitor->trace(m_queue);
50 SecurityContext::trace(visitor);
51 ExecutionContext::trace(visitor);
54 #if !ENABLE(OILPAN)
55 using RefCounted<NullExecutionContext>::ref;
56 using RefCounted<NullExecutionContext>::deref;
58 void refExecutionContext() override { ref(); }
59 void derefExecutionContext() override { deref(); }
60 #endif
62 protected:
63 const KURL& virtualURL() const override { return m_dummyURL; }
64 KURL virtualCompleteURL(const String&) const override { return m_dummyURL; }
66 private:
67 bool m_tasksNeedSuspension;
68 OwnPtrWillBeMember<EventQueue> m_queue;
70 KURL m_dummyURL;
73 } // namespace blink
75 #endif // NullExecutionContext_h