Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: Source/core/workers/Worker.cpp

Issue 17885002: Use toDocument instead of static_cast<Document*>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/SharedWorker.cpp ('k') | Source/core/workers/WorkerMessagingProxy.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 inline Worker::Worker(ScriptExecutionContext* context) 50 inline Worker::Worker(ScriptExecutionContext* context)
51 : AbstractWorker(context) 51 : AbstractWorker(context)
52 , m_contextProxy(WorkerGlobalScopeProxy::create(this)) 52 , m_contextProxy(WorkerGlobalScopeProxy::create(this))
53 { 53 {
54 ScriptWrappable::init(this); 54 ScriptWrappable::init(this);
55 } 55 }
56 56
57 PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& url, ExceptionCode& ec) 57 PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& url, ExceptionCode& ec)
58 { 58 {
59 ASSERT(isMainThread()); 59 ASSERT(isMainThread());
60 UseCounter::count(static_cast<Document*>(context)->domWindow(), UseCounter:: WorkerStart); 60 UseCounter::count(toDocument(context)->domWindow(), UseCounter::WorkerStart) ;
61 61
62 RefPtr<Worker> worker = adoptRef(new Worker(context)); 62 RefPtr<Worker> worker = adoptRef(new Worker(context));
63 63
64 worker->suspendIfNeeded(); 64 worker->suspendIfNeeded();
65 65
66 KURL scriptURL = worker->resolveURL(url, ec); 66 KURL scriptURL = worker->resolveURL(url, ec);
67 if (scriptURL.isEmpty()) 67 if (scriptURL.isEmpty())
68 return 0; 68 return 0;
69 69
70 // 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. 70 // 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 startMode = PauseWorkerGlobalScopeOnStart; 133 startMode = PauseWorkerGlobalScopeOnStart;
134 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), scriptExec utionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), star tMode); 134 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), scriptExec utionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), star tMode);
135 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr iptLoader->identifier(), m_scriptLoader->script()); 135 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr iptLoader->identifier(), m_scriptLoader->script());
136 } 136 }
137 m_scriptLoader = nullptr; 137 m_scriptLoader = nullptr;
138 138
139 unsetPendingActivity(this); 139 unsetPendingActivity(this);
140 } 140 }
141 141
142 } // namespace WebCore 142 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/SharedWorker.cpp ('k') | Source/core/workers/WorkerMessagingProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698