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

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

Issue 2312493002: [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy. (Closed)
Patch Set: fix buid /me shakes fist a GN files. Created 4 years, 3 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/ThreadedWorkletObjectProxy.h"
6
7 #include "bindings/core/v8/SerializedScriptValue.h"
8 #include "bindings/core/v8/SourceLocation.h"
9 #include "core/dom/Document.h"
10 #include "core/dom/ExecutionContext.h"
11 #include "core/dom/ExecutionContextTask.h"
12 #include "core/inspector/ConsoleMessage.h"
13 #include "core/workers/ThreadedWorkletMessagingProxy.h"
14 #include "wtf/Functional.h"
15 #include "wtf/PtrUtil.h"
16 #include <memory>
17
18 namespace blink {
19
20 std::unique_ptr<ThreadedWorkletObjectProxy> ThreadedWorkletObjectProxy::create(T hreadedWorkletMessagingProxy* messagingProxy)
21 {
22 DCHECK(messagingProxy);
23 return wrapUnique(new ThreadedWorkletObjectProxy(messagingProxy));
24 }
25
26 void ThreadedWorkletObjectProxy::postTaskToMainExecutionContext(std::unique_ptr< ExecutionContextTask> task)
27 {
28 getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task));
29 }
30
31 void ThreadedWorkletObjectProxy::reportConsoleMessage(MessageSource source, Mess ageLevel level, const String& message, SourceLocation* location)
32 {
33 getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&::bl ink::ThreadedWorkletMessagingProxy::reportConsoleMessage, crossThreadUnretained( m_messagingProxy), source, level, message, passed(location->clone())));
34 }
35
36 void ThreadedWorkletObjectProxy::postMessageToPageInspector(const String& messag e)
37 {
38 ExecutionContext* context = getExecutionContext();
39 if (context->isDocument())
yhirano 2016/09/12 09:02:58 Is there any chance to get a non-Document Executio
ikilpatrick 2016/09/12 17:29:07 No, removed.
40 toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThrea dTask(&::blink::ThreadedWorkletMessagingProxy::postMessageToPageInspector, cross ThreadUnretained(m_messagingProxy), message));
41 }
42
43 void ThreadedWorkletObjectProxy::workerGlobalScopeClosed()
44 {
45 getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&::bl ink::ThreadedWorkletMessagingProxy::terminateGlobalScope, crossThreadUnretained( m_messagingProxy)));
46 }
47
48 void ThreadedWorkletObjectProxy::workerThreadTerminated()
49 {
50 // This will terminate the MessagingProxy.
51 getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&Thre adedWorkletMessagingProxy::workerThreadTerminated, crossThreadUnretained(m_messa gingProxy)));
52 }
53
54 ThreadedWorkletObjectProxy::ThreadedWorkletObjectProxy(ThreadedWorkletMessagingP roxy* messagingProxy)
55 : m_messagingProxy(messagingProxy)
56 {
57 }
58
59 ExecutionContext* ThreadedWorkletObjectProxy::getExecutionContext() const
60 {
61 DCHECK(m_messagingProxy);
62 return m_messagingProxy->getExecutionContext();
63 }
64
65 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698