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

Side by Side Diff: third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.cpp

Issue 2254593002: [worklets] Introduce AnimationWorkletGlobalScope and ThreadedWorkletGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove global listing as no console output. Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/workers/ThreadedWorkletGlobalScope.h"
6
7 #include "core/inspector/ConsoleMessage.h"
8 #include "core/inspector/ConsoleMessageStorage.h"
9 #include "core/inspector/WorkerThreadDebugger.h"
10 #include "core/loader/WorkerThreadableLoader.h"
11 #include "core/workers/WorkerLoaderProxy.h"
12 #include "core/workers/WorkerReportingProxy.h"
13 #include "core/workers/WorkerScriptLoader.h"
14 #include "core/workers/WorkerThread.h"
15 #include "platform/network/ContentSecurityPolicyParsers.h"
16 #include "platform/weborigin/KURL.h"
17 #include "platform/weborigin/SecurityOrigin.h"
18 #include "public/platform/Platform.h"
19 #include "public/platform/WebScheduler.h"
20 #include "public/platform/WebURLRequest.h"
21 #include "wtf/Assertions.h"
22 #include "wtf/RefPtr.h"
nhiroki 2016/08/17 05:56:57 Following inclusions might not be necessary. "cor
ikilpatrick 2016/08/22 19:07:32 Done.
23
24 namespace blink {
25
26 ThreadedWorkletGlobalScope::ThreadedWorkletGlobalScope(const KURL& url, const St ring& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isolate , WorkerThread* thread)
27 : WorkletGlobalScope(url, userAgent, securityOrigin, isolate)
28 , m_thread(thread)
29 {
30 }
31
32 ThreadedWorkletGlobalScope::~ThreadedWorkletGlobalScope()
33 {
haraken 2016/08/17 06:07:25 Shall we add DCHECK(!m_thread) ?
ikilpatrick 2016/08/22 19:07:32 Done.
34 }
35
36 void ThreadedWorkletGlobalScope::dispose()
37 {
38 DCHECK(isContextThread());
39 stopActiveDOMObjects();
40
41 m_thread = nullptr;
42 }
43
44 bool ThreadedWorkletGlobalScope::isContextThread() const
45 {
46 return thread()->isCurrentThread();
47 }
48
49 void ThreadedWorkletGlobalScope::postTask(const WebTraceLocation& location, std: :unique_ptr<ExecutionContextTask> task, const String& taskNameForInstrumentation )
50 {
51 thread()->postTask(location, std::move(task), !taskNameForInstrumentation.is Empty());
52 }
53
54 void ThreadedWorkletGlobalScope::addConsoleMessage(ConsoleMessage* consoleMessag e)
55 {
56 DCHECK(isContextThread());
57 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage->source (), consoleMessage->level(), consoleMessage->message(), consoleMessage->location ());
58 thread()->consoleMessageStorage()->addConsoleMessage(this, consoleMessage);
59 }
60
61 void ThreadedWorkletGlobalScope::exceptionThrown(ErrorEvent* errorEvent)
62 {
63 DCHECK(isContextThread());
64 if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(thread()->is olate()))
65 debugger->exceptionThrown(errorEvent);
66 }
67
68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698