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 19 matching lines...) Expand all Loading... |
30 #include "Console.h" | 30 #include "Console.h" |
31 #include "KURL.h" | 31 #include "KURL.h" |
32 #include <wtf/HashMap.h> | 32 #include <wtf/HashMap.h> |
33 #include <wtf/HashSet.h> | 33 #include <wtf/HashSet.h> |
34 #include <wtf/PassRefPtr.h> | 34 #include <wtf/PassRefPtr.h> |
35 #include <wtf/Threading.h> | 35 #include <wtf/Threading.h> |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class ActiveDOMObject; | 39 class ActiveDOMObject; |
| 40 class DOMTimer; |
40 class MessagePort; | 41 class MessagePort; |
41 class SecurityOrigin; | 42 class SecurityOrigin; |
42 class ScriptString; | 43 class ScriptString; |
43 class String; | 44 class String; |
44 | 45 |
45 enum MessageDestination { | 46 enum MessageDestination { |
46 InspectorControllerDestination, | 47 InspectorControllerDestination, |
47 ConsoleDestination, | 48 ConsoleDestination, |
48 }; | 49 }; |
49 | 50 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void deref() { derefScriptExecutionContext(); } | 88 void deref() { derefScriptExecutionContext(); } |
88 | 89 |
89 class Task : public ThreadSafeShared<Task> { | 90 class Task : public ThreadSafeShared<Task> { |
90 public: | 91 public: |
91 virtual ~Task(); | 92 virtual ~Task(); |
92 virtual void performTask(ScriptExecutionContext*) = 0; | 93 virtual void performTask(ScriptExecutionContext*) = 0; |
93 }; | 94 }; |
94 | 95 |
95 virtual void postTask(PassRefPtr<Task>) = 0; // Executes the task on con
text's thread asynchronously. | 96 virtual void postTask(PassRefPtr<Task>) = 0; // Executes the task on con
text's thread asynchronously. |
96 | 97 |
| 98 void addTimeout(int timeoutId, DOMTimer*); |
| 99 void removeTimeout(int timeoutId); |
| 100 DOMTimer* findTimeout(int timeoutId); |
| 101 |
97 protected: | 102 protected: |
98 // Explicitly override the security origin for this script context. | 103 // Explicitly override the security origin for this script context. |
99 // Note: It is dangerous to change the security origin of a script conte
xt | 104 // Note: It is dangerous to change the security origin of a script conte
xt |
100 // that already contains content. | 105 // that already contains content. |
101 void setSecurityOrigin(PassRefPtr<SecurityOrigin>); | 106 void setSecurityOrigin(PassRefPtr<SecurityOrigin>); |
102 | 107 |
103 private: | 108 private: |
104 virtual const KURL& virtualURL() const = 0; | 109 virtual const KURL& virtualURL() const = 0; |
105 virtual KURL virtualCompleteURL(const String&) const = 0; | 110 virtual KURL virtualCompleteURL(const String&) const = 0; |
106 | 111 |
107 RefPtr<SecurityOrigin> m_securityOrigin; | 112 RefPtr<SecurityOrigin> m_securityOrigin; |
108 | 113 |
109 HashSet<MessagePort*> m_messagePorts; | 114 HashSet<MessagePort*> m_messagePorts; |
110 | 115 |
111 HashMap<ActiveDOMObject*, void*> m_activeDOMObjects; | 116 HashMap<ActiveDOMObject*, void*> m_activeDOMObjects; |
112 | 117 |
| 118 HashMap<int, DOMTimer*> m_timeouts; |
| 119 |
113 virtual void refScriptExecutionContext() = 0; | 120 virtual void refScriptExecutionContext() = 0; |
114 virtual void derefScriptExecutionContext() = 0; | 121 virtual void derefScriptExecutionContext() = 0; |
115 }; | 122 }; |
116 | 123 |
117 } // namespace WebCore | 124 } // namespace WebCore |
118 | 125 |
119 | 126 |
120 #endif // ScriptExecutionContext_h | 127 #endif // ScriptExecutionContext_h |
121 | 128 |
122 | 129 |
OLD | NEW |