| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "EventTarget.h" | 34 #include "EventTarget.h" |
| 35 #include "ScriptExecutionContext.h" | 35 #include "ScriptExecutionContext.h" |
| 36 #include "WorkerScriptController.h" | 36 #include "WorkerScriptController.h" |
| 37 #include <wtf/OwnPtr.h> | 37 #include <wtf/OwnPtr.h> |
| 38 #include <wtf/PassRefPtr.h> | 38 #include <wtf/PassRefPtr.h> |
| 39 #include <wtf/RefCounted.h> | 39 #include <wtf/RefCounted.h> |
| 40 #include <wtf/RefPtr.h> | 40 #include <wtf/RefPtr.h> |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class ScheduledAction; |
| 44 class WorkerLocation; | 45 class WorkerLocation; |
| 45 class WorkerNavigator; | 46 class WorkerNavigator; |
| 46 class WorkerThread; | 47 class WorkerThread; |
| 47 | 48 |
| 48 class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecuti
onContext, public EventTarget { | 49 class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecuti
onContext, public EventTarget { |
| 49 public: | 50 public: |
| 50 static PassRefPtr<WorkerContext> create(const KURL& url, const String& u
serAgent, WorkerThread* thread) | 51 static PassRefPtr<WorkerContext> create(const KURL& url, const String& u
serAgent, WorkerThread* thread) |
| 51 { | 52 { |
| 52 return adoptRef(new WorkerContext(url, userAgent, thread)); | 53 return adoptRef(new WorkerContext(url, userAgent, thread)); |
| 53 } | 54 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 bool hasPendingActivity() const; | 72 bool hasPendingActivity() const; |
| 72 | 73 |
| 73 virtual void reportException(const String& errorMessage, int lineNumber,
const String& sourceURL); | 74 virtual void reportException(const String& errorMessage, int lineNumber,
const String& sourceURL); |
| 74 virtual void addMessage(MessageDestination, MessageSource, MessageLevel,
const String& message, unsigned lineNumber, const String& sourceURL); | 75 virtual void addMessage(MessageDestination, MessageSource, MessageLevel,
const String& message, unsigned lineNumber, const String& sourceURL); |
| 75 virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier,
const ScriptString& sourceString); | 76 virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier,
const ScriptString& sourceString); |
| 76 | 77 |
| 77 virtual WorkerContext* toWorkerContext() { return this; } | 78 virtual WorkerContext* toWorkerContext() { return this; } |
| 78 | 79 |
| 79 void postMessage(const String& message); | 80 void postMessage(const String& message); |
| 80 virtual void postTask(PassRefPtr<Task>); // Executes the task on context
's thread asynchronously. | 81 virtual void postTask(PassRefPtr<Task>); // Executes the task on context
's thread asynchronously. |
| 81 void postTaskToParentContext(PassRefPtr<Task>); // Executes the task in
the parent's context (and thread) asynchronously. | 82 void postTaskToWorkerObject(PassRefPtr<Task>); // Executes the task on t
he worker object's thread asynchronously. |
| 83 |
| 84 int installTimeout(ScheduledAction*, int timeout, bool singleShot); |
| 85 void removeTimeout(int timeoutId); |
| 82 | 86 |
| 83 virtual void addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener>, bool useCapture); | 87 virtual void addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener>, bool useCapture); |
| 84 virtual void removeEventListener(const AtomicString& eventType, EventLis
tener*, bool useCapture); | 88 virtual void removeEventListener(const AtomicString& eventType, EventLis
tener*, bool useCapture); |
| 85 virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); | 89 virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); |
| 86 | 90 |
| 87 void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessage
Listener = eventListener; } | 91 void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessage
Listener = eventListener; } |
| 88 EventListener* onmessage() const { return m_onmessageListener.get(); } | 92 EventListener* onmessage() const { return m_onmessageListener.get(); } |
| 89 | 93 |
| 90 typedef Vector<RefPtr<EventListener> > ListenerVector; | 94 typedef Vector<RefPtr<EventListener> > ListenerVector; |
| 91 typedef HashMap<AtomicString, ListenerVector> EventListenersMap; | 95 typedef HashMap<AtomicString, ListenerVector> EventListenersMap; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 } // namespace WebCore | 124 } // namespace WebCore |
| 121 | 125 |
| 122 #endif // ENABLE(WORKERS) | 126 #endif // ENABLE(WORKERS) |
| 123 | 127 |
| 124 #endif // WorkerContext_h | 128 #endif // WorkerContext_h |
| 125 | 129 |
| 126 | 130 |
| 127 | 131 |
| OLD | NEW |