OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "Worker.h" | 30 #include "Worker.h" |
31 | 31 |
32 #include "DOMWindow.h" | 32 #include "DOMWindow.h" |
33 #include "CachedResourceLoader.h" | 33 #include "CachedResourceLoader.h" |
34 #include "Document.h" | 34 #include "Document.h" |
35 #include "EventException.h" | 35 #include "EventException.h" |
36 #include "EventListener.h" | 36 #include "EventListener.h" |
37 #include "EventNames.h" | 37 #include "EventNames.h" |
38 #include "ExceptionCode.h" | 38 #include "ExceptionCode.h" |
39 #include "FeatureObserver.h" | 39 #include "UseCounter.h" |
40 #include "Frame.h" | 40 #include "Frame.h" |
41 #include "FrameLoader.h" | 41 #include "FrameLoader.h" |
42 #include "InspectorInstrumentation.h" | 42 #include "InspectorInstrumentation.h" |
43 #include "MessageEvent.h" | 43 #include "MessageEvent.h" |
44 #include "TextEncoding.h" | 44 #include "TextEncoding.h" |
45 #include "WorkerContextProxy.h" | 45 #include "WorkerContextProxy.h" |
46 #include "WorkerScriptLoader.h" | 46 #include "WorkerScriptLoader.h" |
47 #include "WorkerThread.h" | 47 #include "WorkerThread.h" |
48 #include <wtf/MainThread.h> | 48 #include <wtf/MainThread.h> |
49 | 49 |
50 namespace WebCore { | 50 namespace WebCore { |
51 | 51 |
52 inline Worker::Worker(ScriptExecutionContext* context) | 52 inline Worker::Worker(ScriptExecutionContext* context) |
53 : AbstractWorker(context) | 53 : AbstractWorker(context) |
54 , m_contextProxy(WorkerContextProxy::create(this)) | 54 , m_contextProxy(WorkerContextProxy::create(this)) |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String&
url, ExceptionCode& ec) | 58 PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String&
url, ExceptionCode& ec) |
59 { | 59 { |
60 ASSERT(isMainThread()); | 60 ASSERT(isMainThread()); |
61 FeatureObserver::observe(static_cast<Document*>(context)->domWindow(), Featu
reObserver::WorkerStart); | 61 UseCounter::observe(static_cast<Document*>(context)->domWindow(), UseCounter
::WorkerStart); |
62 | 62 |
63 RefPtr<Worker> worker = adoptRef(new Worker(context)); | 63 RefPtr<Worker> worker = adoptRef(new Worker(context)); |
64 | 64 |
65 worker->suspendIfNeeded(); | 65 worker->suspendIfNeeded(); |
66 | 66 |
67 KURL scriptURL = worker->resolveURL(url, ec); | 67 KURL scriptURL = worker->resolveURL(url, ec); |
68 if (scriptURL.isEmpty()) | 68 if (scriptURL.isEmpty()) |
69 return 0; | 69 return 0; |
70 | 70 |
71 // The worker context does not exist while loading, so we must ensure that t
he worker object is not collected, nor are its event listeners. | 71 // The worker context does not exist while loading, so we must ensure that t
he worker object is not collected, nor are its event listeners. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 startMode = PauseWorkerContextOnStart; | 142 startMode = PauseWorkerContextOnStart; |
143 m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutio
nContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMod
e); | 143 m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutio
nContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMod
e); |
144 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr
iptLoader->identifier(), m_scriptLoader->script()); | 144 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr
iptLoader->identifier(), m_scriptLoader->script()); |
145 } | 145 } |
146 m_scriptLoader = nullptr; | 146 m_scriptLoader = nullptr; |
147 | 147 |
148 unsetPendingActivity(this); | 148 unsetPendingActivity(this); |
149 } | 149 } |
150 | 150 |
151 } // namespace WebCore | 151 } // namespace WebCore |
OLD | NEW |