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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NullExecutionContext_h 5 #ifndef NullExecutionContext_h
6 #define NullExecutionContext_h 6 #define NullExecutionContext_h
7 7
8 #include "bindings/core/v8/SourceLocation.h" 8 #include "bindings/core/v8/SourceLocation.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
11 #include "core/events/EventQueue.h" 11 #include "core/events/EventQueue.h"
12 #include "core/inspector/ConsoleMessage.h" 12 #include "core/inspector/ConsoleMessage.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "platform/weborigin/KURL.h" 14 #include "platform/weborigin/KURL.h"
15 #include <memory>
15 16
16 namespace blink { 17 namespace blink {
17 18
18 class NullExecutionContext final : public GarbageCollectedFinalized<NullExecutio nContext>, public SecurityContext, public ExecutionContext { 19 class NullExecutionContext final : public GarbageCollectedFinalized<NullExecutio nContext>, public SecurityContext, public ExecutionContext {
19 USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext); 20 USING_GARBAGE_COLLECTED_MIXIN(NullExecutionContext);
20 public: 21 public:
21 NullExecutionContext(); 22 NullExecutionContext();
22 23
23 void disableEval(const String&) override { } 24 void disableEval(const String&) override { }
24 String userAgent() const override { return String(); } 25 String userAgent() const override { return String(); }
25 26
26 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> ) override; 27 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask> ) override;
27 28
28 EventTarget* errorEventTarget() override { return nullptr; } 29 EventTarget* errorEventTarget() override { return nullptr; }
29 EventQueue* getEventQueue() const override { return m_queue.get(); } 30 EventQueue* getEventQueue() const override { return m_queue.get(); }
30 31
31 bool tasksNeedSuspension() override { return m_tasksNeedSuspension; } 32 bool tasksNeedSuspension() override { return m_tasksNeedSuspension; }
32 void setTasksNeedSuspension(bool flag) { m_tasksNeedSuspension = flag; } 33 void setTasksNeedSuspension(bool flag) { m_tasksNeedSuspension = flag; }
33 34
34 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov erride { } 35 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov erride { }
35 void didUpdateSecurityOrigin() override { } 36 void didUpdateSecurityOrigin() override { }
36 SecurityContext& securityContext() override { return *this; } 37 SecurityContext& securityContext() override { return *this; }
37 DOMTimerCoordinator* timers() override { return nullptr; } 38 DOMTimerCoordinator* timers() override { return nullptr; }
38 39
39 void addConsoleMessage(ConsoleMessage*) override { } 40 void addConsoleMessage(ConsoleMessage*) override { }
40 void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLoca tion>) override { } 41 void logExceptionToConsole(const String& errorMessage, std::unique_ptr<Sourc eLocation>) override { }
41 42
42 void setIsSecureContext(bool); 43 void setIsSecureContext(bool);
43 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa rdSecureContextCheck) const override; 44 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa rdSecureContextCheck) const override;
44 45
45 DEFINE_INLINE_TRACE() 46 DEFINE_INLINE_TRACE()
46 { 47 {
47 visitor->trace(m_queue); 48 visitor->trace(m_queue);
48 SecurityContext::trace(visitor); 49 SecurityContext::trace(visitor);
49 ExecutionContext::trace(visitor); 50 ExecutionContext::trace(visitor);
50 } 51 }
51 52
52 protected: 53 protected:
53 const KURL& virtualURL() const override { return m_dummyURL; } 54 const KURL& virtualURL() const override { return m_dummyURL; }
54 KURL virtualCompleteURL(const String&) const override { return m_dummyURL; } 55 KURL virtualCompleteURL(const String&) const override { return m_dummyURL; }
55 56
56 private: 57 private:
57 bool m_tasksNeedSuspension; 58 bool m_tasksNeedSuspension;
58 bool m_isSecureContext; 59 bool m_isSecureContext;
59 Member<EventQueue> m_queue; 60 Member<EventQueue> m_queue;
60 61
61 KURL m_dummyURL; 62 KURL m_dummyURL;
62 }; 63 };
63 64
64 } // namespace blink 65 } // namespace blink
65 66
66 #endif // NullExecutionContext_h 67 #endif // NullExecutionContext_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698