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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "JSDedicatedWorkerContext.h" | 54 #include "JSDedicatedWorkerContext.h" |
55 #include "JSWorker.h" | 55 #include "JSWorker.h" |
56 #include "Worker.h" | 56 #include "Worker.h" |
57 #endif | 57 #endif |
58 | 58 |
59 #if ENABLE(SHARED_WORKERS) | 59 #if ENABLE(SHARED_WORKERS) |
60 #include "JSSharedWorker.h" | 60 #include "JSSharedWorker.h" |
61 #include "SharedWorker.h" | 61 #include "SharedWorker.h" |
62 #endif | 62 #endif |
63 | 63 |
| 64 #if ENABLE(WEB_SOCKETS) |
| 65 #include "JSWebSocket.h" |
| 66 #include "WebSocket.h" |
| 67 #endif |
| 68 |
64 using namespace JSC; | 69 using namespace JSC; |
65 | 70 |
66 namespace WebCore { | 71 namespace WebCore { |
67 | 72 |
68 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ
et) | 73 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ
et) |
69 { | 74 { |
70 if (!target) | 75 if (!target) |
71 return jsNull(); | 76 return jsNull(); |
72 | 77 |
73 #if ENABLE(SVG) | 78 #if ENABLE(SVG) |
(...skipping 28 matching lines...) Expand all Loading... |
102 | 107 |
103 if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext
()) | 108 if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext
()) |
104 return toJSDOMGlobalObject(workerContext); | 109 return toJSDOMGlobalObject(workerContext); |
105 #endif | 110 #endif |
106 | 111 |
107 #if ENABLE(SHARED_WORKERS) | 112 #if ENABLE(SHARED_WORKERS) |
108 if (SharedWorker* sharedWorker = target->toSharedWorker()) | 113 if (SharedWorker* sharedWorker = target->toSharedWorker()) |
109 return toJS(exec, globalObject, sharedWorker); | 114 return toJS(exec, globalObject, sharedWorker); |
110 #endif | 115 #endif |
111 | 116 |
| 117 #if ENABLE(WEB_SOCKETS) |
| 118 if (WebSocket* websocket = target->toWebSocket()) |
| 119 return toJS(exec, websocket); |
| 120 #endif |
| 121 |
112 ASSERT_NOT_REACHED(); | 122 ASSERT_NOT_REACHED(); |
113 return jsNull(); | 123 return jsNull(); |
114 } | 124 } |
115 | 125 |
116 EventTarget* toEventTarget(JSC::JSValue value) | 126 EventTarget* toEventTarget(JSC::JSValue value) |
117 { | 127 { |
118 #define CONVERT_TO_EVENT_TARGET(type) \ | 128 #define CONVERT_TO_EVENT_TARGET(type) \ |
119 if (value.isObject(&JS##type::s_info)) \ | 129 if (value.isObject(&JS##type::s_info)) \ |
120 return static_cast<JS##type*>(asObject(value))->impl(); | 130 return static_cast<JS##type*>(asObject(value))->impl(); |
121 | 131 |
(...skipping 15 matching lines...) Expand all Loading... |
137 | 147 |
138 #if ENABLE(WORKERS) | 148 #if ENABLE(WORKERS) |
139 CONVERT_TO_EVENT_TARGET(Worker) | 149 CONVERT_TO_EVENT_TARGET(Worker) |
140 CONVERT_TO_EVENT_TARGET(DedicatedWorkerContext) | 150 CONVERT_TO_EVENT_TARGET(DedicatedWorkerContext) |
141 #endif | 151 #endif |
142 | 152 |
143 #if ENABLE(SHARED_WORKERS) | 153 #if ENABLE(SHARED_WORKERS) |
144 CONVERT_TO_EVENT_TARGET(SharedWorker) | 154 CONVERT_TO_EVENT_TARGET(SharedWorker) |
145 #endif | 155 #endif |
146 | 156 |
| 157 #if ENABLE(WEB_SOCKETS) |
| 158 CONVERT_TO_EVENT_TARGET(WebSocket) |
| 159 #endif |
| 160 |
147 return 0; | 161 return 0; |
148 } | 162 } |
149 | 163 |
150 } // namespace WebCore | 164 } // namespace WebCore |
OLD | NEW |