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

Side by Side Diff: third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp

Issue 2721543002: SharedWorker: Factor out WorkerReportingProxy impl from WebSharedWorkerImpl (Closed)
Patch Set: tweak header comment Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 "web/WebSharedWorkerReportingProxyImpl.h"
6
7 #include "bindings/core/v8/SourceLocation.h"
8 #include "platform/CrossThreadFunctional.h"
9 #include "public/platform/WebTraceLocation.h"
10 #include "web/WebSharedWorkerImpl.h"
11 #include "wtf/WTF.h"
12
13 namespace blink {
14
15 WebSharedWorkerReportingProxyImpl::WebSharedWorkerReportingProxyImpl(
16 WebSharedWorkerImpl* worker,
17 ParentFrameTaskRunners* parentFrameTaskRunners)
18 : m_worker(worker), m_parentFrameTaskRunners(parentFrameTaskRunners) {
19 DCHECK(isMainThread());
20 }
21
22 WebSharedWorkerReportingProxyImpl::~WebSharedWorkerReportingProxyImpl() {
23 DCHECK(isMainThread());
24 }
25
26 void WebSharedWorkerReportingProxyImpl::countFeature(
27 UseCounter::Feature feature) {
28 DCHECK(!isMainThread());
29 m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
30 ->postTask(BLINK_FROM_HERE,
31 crossThreadBind(&WebSharedWorkerImpl::countFeature,
32 crossThreadUnretained(m_worker), feature));
33 }
34
35 void WebSharedWorkerReportingProxyImpl::countDeprecation(
36 UseCounter::Feature feature) {
37 DCHECK(!isMainThread());
38 // Go through the same code path with countFeature() because a deprecation
39 // message is already shown on the worker console and a remaining work is just
40 // to record an API use.
41 countFeature(feature);
42 }
43
44 void WebSharedWorkerReportingProxyImpl::reportException(
45 const String& errorMessage,
46 std::unique_ptr<SourceLocation>,
47 int exceptionId) {
48 DCHECK(!isMainThread());
49 // Not suppported in SharedWorker.
50 }
51
52 void WebSharedWorkerReportingProxyImpl::reportConsoleMessage(
53 MessageSource,
54 MessageLevel,
55 const String& message,
56 SourceLocation*) {
57 DCHECK(!isMainThread());
58 // Not supported in SharedWorker.
59 }
60
61 void WebSharedWorkerReportingProxyImpl::postMessageToPageInspector(
62 const String& message) {
63 DCHECK(!isMainThread());
64 // The TaskType of Inspector tasks need to be Unthrottled because they need to
65 // run even on a suspended page.
66 m_parentFrameTaskRunners->get(TaskType::Unthrottled)
67 ->postTask(
68 BLINK_FROM_HERE,
69 crossThreadBind(&WebSharedWorkerImpl::postMessageToPageInspector,
70 crossThreadUnretained(m_worker), message));
71 }
72
73 void WebSharedWorkerReportingProxyImpl::didCloseWorkerGlobalScope() {
74 DCHECK(!isMainThread());
75 m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
76 ->postTask(
77 BLINK_FROM_HERE,
78 crossThreadBind(&WebSharedWorkerImpl::didCloseWorkerGlobalScope,
79 crossThreadUnretained(m_worker)));
80 }
81
82 void WebSharedWorkerReportingProxyImpl::didTerminateWorkerThread() {
83 DCHECK(!isMainThread());
84 m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
85 ->postTask(BLINK_FROM_HERE,
86 crossThreadBind(&WebSharedWorkerImpl::didTerminateWorkerThread,
87 crossThreadUnretained(m_worker)));
88 }
89
90 DEFINE_TRACE(WebSharedWorkerReportingProxyImpl) {
91 visitor->trace(m_parentFrameTaskRunners);
92 }
93
94 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698