OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 { | 70 { |
71 // Don't use m_url.copy() because it isn't a threadsafe method. | 71 // Don't use m_url.copy() because it isn't a threadsafe method. |
72 return KURL(ParsedURLString, m_url.string().isolatedCopy()); | 72 return KURL(ParsedURLString, m_url.string().isolatedCopy()); |
73 } | 73 } |
74 | 74 |
75 String name() const { return m_name.isolatedCopy(); } | 75 String name() const { return m_name.isolatedCopy(); } |
76 bool matches(const String& name, PassRefPtr<SecurityOrigin> origin, const KU
RL& urlToMatch) const; | 76 bool matches(const String& name, PassRefPtr<SecurityOrigin> origin, const KU
RL& urlToMatch) const; |
77 | 77 |
78 // WorkerLoaderProxy | 78 // WorkerLoaderProxy |
79 virtual void postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task>); | 79 virtual void postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task>); |
80 virtual void postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContex
t::Task>, const String&); | 80 virtual bool postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContex
t::Task>, const String&); |
81 | 81 |
82 // WorkerReportingProxy | 82 // WorkerReportingProxy |
83 virtual void postExceptionToWorkerObject(const String& errorMessage, int lin
eNumber, const String& sourceURL); | 83 virtual void postExceptionToWorkerObject(const String& errorMessage, int lin
eNumber, const String& sourceURL); |
84 virtual void postConsoleMessageToWorkerObject(MessageSource, MessageType, Me
ssageLevel, const String& message, int lineNumber, const String& sourceURL); | 84 virtual void postConsoleMessageToWorkerObject(MessageSource, MessageType, Me
ssageLevel, const String& message, int lineNumber, const String& sourceURL); |
85 #if ENABLE(INSPECTOR) | 85 #if ENABLE(INSPECTOR) |
86 virtual void postMessageToPageInspector(const String&); | 86 virtual void postMessageToPageInspector(const String&); |
87 virtual void updateInspectorStateCookie(const String&); | 87 virtual void updateInspectorStateCookie(const String&); |
88 #endif | 88 #endif |
89 virtual void workerContextClosed(); | 89 virtual void workerContextClosed(); |
90 virtual void workerContextDestroyed(); | 90 virtual void workerContextDestroyed(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 // If we aren't closing, then we must have at least one document. | 145 // If we aren't closing, then we must have at least one document. |
146 ASSERT(m_workerDocuments.size()); | 146 ASSERT(m_workerDocuments.size()); |
147 | 147 |
148 // Just pick an arbitrary active document from the HashSet and pass load req
uests to it. | 148 // Just pick an arbitrary active document from the HashSet and pass load req
uests to it. |
149 // FIXME: Do we need to deal with the case where the user closes the documen
t mid-load, via a shadow document or some other solution? | 149 // FIXME: Do we need to deal with the case where the user closes the documen
t mid-load, via a shadow document or some other solution? |
150 Document* document = *(m_workerDocuments.begin()); | 150 Document* document = *(m_workerDocuments.begin()); |
151 document->postTask(task); | 151 document->postTask(task); |
152 } | 152 } |
153 | 153 |
154 void SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutio
nContext::Task> task, const String& mode) | 154 bool SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutio
nContext::Task> task, const String& mode) |
155 { | 155 { |
156 if (isClosing()) | 156 if (isClosing()) |
157 return; | 157 return false; |
158 ASSERT(m_thread); | 158 ASSERT(m_thread); |
159 m_thread->runLoop().postTaskForMode(task, mode); | 159 m_thread->runLoop().postTaskForMode(task, mode); |
| 160 return true; |
160 } | 161 } |
161 | 162 |
162 static void postExceptionTask(ScriptExecutionContext* context, const String& err
orMessage, int lineNumber, const String& sourceURL) | 163 static void postExceptionTask(ScriptExecutionContext* context, const String& err
orMessage, int lineNumber, const String& sourceURL) |
163 { | 164 { |
164 context->reportException(errorMessage, lineNumber, sourceURL, 0); | 165 context->reportException(errorMessage, lineNumber, sourceURL, 0); |
165 } | 166 } |
166 | 167 |
167 void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage,
int lineNumber, const String& sourceURL) | 168 void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage,
int lineNumber, const String& sourceURL) |
168 { | 169 { |
169 MutexLocker lock(m_workerDocumentsLock); | 170 MutexLocker lock(m_workerDocumentsLock); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 { | 441 { |
441 } | 442 } |
442 | 443 |
443 DefaultSharedWorkerRepository::~DefaultSharedWorkerRepository() | 444 DefaultSharedWorkerRepository::~DefaultSharedWorkerRepository() |
444 { | 445 { |
445 } | 446 } |
446 | 447 |
447 } // namespace WebCore | 448 } // namespace WebCore |
448 | 449 |
449 #endif // ENABLE(SHARED_WORKERS) | 450 #endif // ENABLE(SHARED_WORKERS) |
OLD | NEW |