| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/page/DOMTimer.h" | 34 #include "core/page/DOMTimer.h" |
| 35 #include "core/platform/LifecycleContext.h" | 35 #include "core/platform/LifecycleContext.h" |
| 36 #include "core/platform/Supplementable.h" | 36 #include "core/platform/Supplementable.h" |
| 37 #include "weborigin/KURL.h" | 37 #include "weborigin/KURL.h" |
| 38 #include "wtf/HashSet.h" | 38 #include "wtf/HashSet.h" |
| 39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class CachedScript; | |
| 45 class ContextLifecycleNotifier; | 44 class ContextLifecycleNotifier; |
| 46 class DatabaseContext; | 45 class DatabaseContext; |
| 47 class EventListener; | 46 class EventListener; |
| 48 class EventQueue; | 47 class EventQueue; |
| 49 class EventTarget; | 48 class EventTarget; |
| 50 class MessagePort; | 49 class MessagePort; |
| 51 class PublicURLManager; | 50 class PublicURLManager; |
| 52 class ScriptCallStack; | 51 class ScriptCallStack; |
| 53 class ScriptState; | 52 class ScriptState; |
| 54 | 53 |
| 55 class ScriptExecutionContext : public LifecycleContext, public SecurityContext,
public Supplementable<ScriptExecutionContext> { | 54 class ScriptExecutionContext : public LifecycleContext, public SecurityContext,
public Supplementable<ScriptExecutionContext> { |
| 56 public: | 55 public: |
| 57 ScriptExecutionContext(); | 56 ScriptExecutionContext(); |
| 58 virtual ~ScriptExecutionContext(); | 57 virtual ~ScriptExecutionContext(); |
| 59 | 58 |
| 60 virtual bool isDocument() const { return false; } | 59 virtual bool isDocument() const { return false; } |
| 61 virtual bool isWorkerGlobalScope() const { return false; } | 60 virtual bool isWorkerGlobalScope() const { return false; } |
| 62 | 61 |
| 63 virtual bool isJSExecutionForbidden() const = 0; | 62 virtual bool isJSExecutionForbidden() const = 0; |
| 64 | 63 |
| 65 const KURL& url() const { return virtualURL(); } | 64 const KURL& url() const { return virtualURL(); } |
| 66 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} | 65 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} |
| 67 | 66 |
| 68 virtual String userAgent(const KURL&) const = 0; | 67 virtual String userAgent(const KURL&) const = 0; |
| 69 | 68 |
| 70 virtual void disableEval(const String& errorMessage) = 0; | 69 virtual void disableEval(const String& errorMessage) = 0; |
| 71 | 70 |
| 72 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL, CachedScript* = 0); | 71 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL); |
| 73 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>, CachedScript* = 0); | 72 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>); |
| 74 | 73 |
| 75 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); | 74 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); |
| 76 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; | 75 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; |
| 77 | 76 |
| 78 PublicURLManager& publicURLManager(); | 77 PublicURLManager& publicURLManager(); |
| 79 | 78 |
| 80 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 79 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
| 81 bool canSuspendActiveDOMObjects(); | 80 bool canSuspendActiveDOMObjects(); |
| 82 bool hasPendingActivity(); | 81 bool hasPendingActivity(); |
| 83 | 82 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 149 |
| 151 private: | 150 private: |
| 152 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. | 151 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. |
| 153 | 152 |
| 154 virtual const KURL& virtualURL() const = 0; | 153 virtual const KURL& virtualURL() const = 0; |
| 155 virtual KURL virtualCompleteURL(const String&) const = 0; | 154 virtual KURL virtualCompleteURL(const String&) const = 0; |
| 156 | 155 |
| 157 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; | 156 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; |
| 158 virtual EventTarget* errorEventTarget() = 0; | 157 virtual EventTarget* errorEventTarget() = 0; |
| 159 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; | 158 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; |
| 160 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL, CachedScript*); | 159 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL); |
| 161 | 160 |
| 162 void closeMessagePorts(); | 161 void closeMessagePorts(); |
| 163 | 162 |
| 164 virtual void refScriptExecutionContext() = 0; | 163 virtual void refScriptExecutionContext() = 0; |
| 165 virtual void derefScriptExecutionContext() = 0; | 164 virtual void derefScriptExecutionContext() = 0; |
| 166 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; | 165 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; |
| 167 | 166 |
| 168 // Implementation details for DOMTimer. No other classes should call these f
unctions. | 167 // Implementation details for DOMTimer. No other classes should call these f
unctions. |
| 169 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); | 168 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); |
| 170 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. | 169 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 189 | 188 |
| 190 // The location of this member is important; to make sure contextDestroyed()
notification on | 189 // The location of this member is important; to make sure contextDestroyed()
notification on |
| 191 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, | 190 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, |
| 192 // m_lifecycleNotifer should be placed *after* such members. | 191 // m_lifecycleNotifer should be placed *after* such members. |
| 193 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 192 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
| 194 }; | 193 }; |
| 195 | 194 |
| 196 } // namespace WebCore | 195 } // namespace WebCore |
| 197 | 196 |
| 198 #endif // ScriptExecutionContext_h | 197 #endif // ScriptExecutionContext_h |
| OLD | NEW |