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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 UseCounter::observe(static_cast<Document*>(context)->domWindow(), UseCounter
::WorkerStart); | 61 UseCounter::count(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 |