summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/ScriptExecutionContext.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
commit635860845790a19bf50bbc51ba8fb66a96dde068 (patch)
treeef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/dom/ScriptExecutionContext.h
parent8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff)
downloadexternal_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/dom/ScriptExecutionContext.h')
-rw-r--r--WebCore/dom/ScriptExecutionContext.h46
1 files changed, 42 insertions, 4 deletions
diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h
index 565dbe0..6f09e1a 100644
--- a/WebCore/dom/ScriptExecutionContext.h
+++ b/WebCore/dom/ScriptExecutionContext.h
@@ -27,17 +27,26 @@
#ifndef ScriptExecutionContext_h
#define ScriptExecutionContext_h
+#include "Console.h"
+#include "KURL.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
namespace WebCore {
class ActiveDOMObject;
class MessagePort;
- class KURL;
class SecurityOrigin;
+ class ScriptString;
class String;
+ enum MessageDestination {
+ InspectorControllerDestination,
+ ConsoleDestination,
+ };
+
class ScriptExecutionContext {
public:
ScriptExecutionContext();
@@ -47,14 +56,27 @@ namespace WebCore {
virtual bool isWorkerContext() const { return false; }
const KURL& url() const { return virtualURL(); }
+ KURL completeURL(const String& url) const { return virtualCompleteURL(url); }
+
+ SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
+
+ virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
+ virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
+ virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) = 0;
// Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
+ bool canSuspendActiveDOMObjects();
+ // Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' -
+ // step-by-step JS debugging is one example.
+ void suspendActiveDOMObjects();
+ void resumeActiveDOMObjects();
void stopActiveDOMObjects();
void createdActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
void destroyedActiveDOMObject(ActiveDOMObject*);
- const HashMap<ActiveDOMObject*, void*>& activeDOMObjects() const { return m_activeDOMObjects; }
+ typedef const HashMap<ActiveDOMObject*, void*> ActiveDOMObjectsMap;
+ ActiveDOMObjectsMap& activeDOMObjects() const { return m_activeDOMObjects; }
- // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch, and for cross-heap GC support.
+ // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch.
void processMessagePortMessagesSoon();
void dispatchMessagePortEvents();
void createdMessagePort(MessagePort*);
@@ -64,10 +86,26 @@ namespace WebCore {
void ref() { refScriptExecutionContext(); }
void deref() { derefScriptExecutionContext(); }
+ class Task : public ThreadSafeShared<Task> {
+ public:
+ virtual ~Task();
+ virtual void performTask(ScriptExecutionContext*) = 0;
+ };
+
+ virtual void postTask(PassRefPtr<Task>) = 0; // Executes the task on context's thread asynchronously.
+
+ protected:
+ // Explicitly override the security origin for this script context.
+ // Note: It is dangerous to change the security origin of a script context
+ // that already contains content.
+ void setSecurityOrigin(PassRefPtr<SecurityOrigin>);
+
private:
virtual const KURL& virtualURL() const = 0;
+ virtual KURL virtualCompleteURL(const String&) const = 0;
+
+ RefPtr<SecurityOrigin> m_securityOrigin;
- bool m_firedMessagePortTimer;
HashSet<MessagePort*> m_messagePorts;
HashMap<ActiveDOMObject*, void*> m_activeDOMObjects;