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

Side by Side Diff: Source/core/testing/NullExecutionContext.h

Issue 338833002: Factor out NullExecutionContext from unittest files. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef NullExecutionContext_h
6 #define NullExecutionContext_h
7
8 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/SecurityContext.h"
10 #include "core/events/EventQueue.h"
11 #include "platform/heap/Handle.h"
12 #include "platform/weborigin/KURL.h"
13 #include "wtf/RefCounted.h"
14
15 namespace WebCore {
16
17 class NullExecutionContext FINAL : public RefCountedWillBeGarbageCollectedFinali zed<NullExecutionContext>, public SecurityContext, public ExecutionContext {
18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext);
19 public:
20 NullExecutionContext();
21
22 virtual EventQueue* eventQueue() const OVERRIDE { return m_queue.get(); }
23
24 virtual bool tasksNeedSuspension() OVERRIDE { return m_tasksNeedSuspension; }
25 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
26
27 void trace(Visitor* visitor)
28 {
29 visitor->trace(m_queue);
30 ExecutionContext::trace(visitor);
31 }
32
33 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) OVERRIDE { }
34 virtual SecurityContext& securityContext() OVERRIDE { return *this; }
35
36 #if !ENABLE(OILPAN)
37 using RefCounted<NullExecutionContext>::ref;
38 using RefCounted<NullExecutionContext>::deref;
39
40 virtual void refExecutionContext() OVERRIDE { ref(); }
41 virtual void derefExecutionContext() OVERRIDE { deref(); }
42 #endif
43
44 protected:
45 virtual const KURL& virtualURL() const OVERRIDE { return m_dummyURL; }
46 virtual KURL virtualCompleteURL(const String&) const OVERRIDE { return m_dum myURL; }
47
48 private:
49 bool m_tasksNeedSuspension;
50 OwnPtrWillBeMember<EventQueue> m_queue;
51
52 KURL m_dummyURL;
53 };
54
55 } // namespace WebCore
56
57 #endif // NullExecutionContext_h
OLDNEW
« no previous file with comments | « Source/core/dom/MainThreadTaskRunnerTest.cpp ('k') | Source/core/testing/NullExecutionContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698