~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/workers/WorkerContext.h

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
 
2
 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
3
3
 *
4
4
 * Redistribution and use in source and binary forms, with or without
5
5
 * modification, are permitted provided that the following conditions
57
57
 
58
58
        virtual bool isWorkerContext() const { return true; }
59
59
 
 
60
        virtual WorkerContext* toWorkerContext() { return this; }
 
61
 
60
62
        virtual ScriptExecutionContext* scriptExecutionContext() const;
61
63
 
62
64
        const KURL& url() const { return m_url; }
64
66
 
65
67
        virtual String userAgent(const KURL&) const;
66
68
 
67
 
        WorkerLocation* location() const { return m_location.get(); }
68
 
        WorkerNavigator* navigator() const;
69
 
 
70
69
        WorkerScriptController* script() { return m_script.get(); }
71
70
        void clearScript() { return m_script.clear(); }
 
71
 
72
72
        WorkerThread* thread() { return m_thread; }
73
73
 
74
74
        bool hasPendingActivity() const;
78
78
        virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
79
79
        virtual void scriptImported(unsigned long identifier, const String& sourceString);
80
80
 
81
 
        virtual WorkerContext* toWorkerContext() { return this; }
82
 
 
 
81
        virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
 
82
 
 
83
 
 
84
        // WorkerGlobalScope
 
85
        WorkerContext* self() { return this; }
 
86
        WorkerLocation* location() const;
 
87
 
 
88
        // WorkerUtils
 
89
        void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&);
 
90
        WorkerNavigator* navigator() const;
 
91
 
 
92
 
 
93
        // DedicatedWorkerGlobalScope
83
94
        void postMessage(const String& message);
84
 
        virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
 
95
        void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; }
 
96
        EventListener* onmessage() const { return m_onmessageListener.get(); }
85
97
 
86
98
        // Timers
87
99
        int setTimeout(ScheduledAction*, int timeout);
89
101
        int setInterval(ScheduledAction*, int timeout);
90
102
        void clearInterval(int timeoutId);
91
103
 
92
 
        void dispatchMessage(const String&);
93
 
 
 
104
        // EventTarget
94
105
        virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
95
106
        virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
96
107
        virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
97
108
 
98
 
        void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; }
99
 
        EventListener* onmessage() const { return m_onmessageListener.get(); }
100
 
 
101
109
        typedef Vector<RefPtr<EventListener> > ListenerVector;
102
110
        typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
103
111
        EventListenersMap& eventListeners() { return m_eventListeners; }
104
112
 
105
 
        void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&);
106
 
        
 
113
        void dispatchMessage(const String&);
 
114
 
 
115
        // These methods are used for GC marking. See JSWorkerContext::mark() in
 
116
        // JSWorkerContextCustom.cpp.
 
117
        WorkerNavigator* optionalNavigator() const { return m_navigator.get(); }
 
118
        WorkerLocation* optionalLocation() const { return m_location.get(); }
 
119
 
107
120
        using RefCounted<WorkerContext>::ref;
108
121
        using RefCounted<WorkerContext>::deref;
109
122
 
110
123
    private:
 
124
        WorkerContext(const KURL&, const String&, WorkerThread*);
 
125
 
111
126
        virtual void refScriptExecutionContext() { ref(); }
112
127
        virtual void derefScriptExecutionContext() { deref(); }
113
128
        virtual void refEventTarget() { ref(); }
114
129
        virtual void derefEventTarget() { deref(); }
115
130
 
116
 
        WorkerContext(const KURL&, const String&, WorkerThread*);
117
 
 
118
131
        virtual const KURL& virtualURL() const;
119
132
        virtual KURL virtualCompleteURL(const String&) const;
120
133
 
121
134
        KURL m_url;
122
135
        String m_userAgent;
123
 
        RefPtr<WorkerLocation> m_location;
 
136
 
 
137
        mutable RefPtr<WorkerLocation> m_location;
124
138
        mutable RefPtr<WorkerNavigator> m_navigator;
125
139
 
126
140
        OwnPtr<WorkerScriptController> m_script;