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

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

Issue 2857583003: Worker: Avoid sending IPC messages for features already counted (Closed)
Patch Set: wip Created 3 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/workers/MainThreadWorkletGlobalScope.h" 5 #include "core/workers/MainThreadWorkletGlobalScope.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/Deprecation.h" 10 #include "core/frame/Deprecation.h"
11 #include "core/frame/FrameConsole.h" 11 #include "core/frame/FrameConsole.h"
12 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
13 #include "core/inspector/MainThreadDebugger.h" 13 #include "core/inspector/MainThreadDebugger.h"
14 #include "core/probe/CoreProbes.h" 14 #include "core/probe/CoreProbes.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 MainThreadWorkletGlobalScope::MainThreadWorkletGlobalScope( 18 MainThreadWorkletGlobalScope::MainThreadWorkletGlobalScope(
19 LocalFrame* frame, 19 LocalFrame* frame,
20 const KURL& url, 20 const KURL& url,
21 const String& user_agent, 21 const String& user_agent,
22 PassRefPtr<SecurityOrigin> security_origin, 22 PassRefPtr<SecurityOrigin> security_origin,
23 v8::Isolate* isolate) 23 v8::Isolate* isolate)
24 : WorkletGlobalScope(url, user_agent, std::move(security_origin), isolate), 24 : WorkletGlobalScope(url, user_agent, std::move(security_origin), isolate),
25 ContextClient(frame) {} 25 ContextClient(frame) {}
26 26
27 MainThreadWorkletGlobalScope::~MainThreadWorkletGlobalScope() {} 27 MainThreadWorkletGlobalScope::~MainThreadWorkletGlobalScope() {}
28 28
29 void MainThreadWorkletGlobalScope::CountFeature(UseCounter::Feature feature) { 29 void MainThreadWorkletGlobalScope::ReportFeature(UseCounter::Feature feature) {
30 DCHECK(IsMainThread()); 30 DCHECK(IsMainThread());
31 // A parent document is on the same thread, so just record API use in the 31 // A parent document is on the same thread, so just record API use in the
32 // document's UseCounter. 32 // document's UseCounter.
33 UseCounter::Count(GetFrame(), feature); 33 UseCounter::Count(GetFrame(), feature);
34 } 34 }
35 35
36 void MainThreadWorkletGlobalScope::CountDeprecation( 36 void MainThreadWorkletGlobalScope::ReportDeprecation(
37 UseCounter::Feature feature) { 37 UseCounter::Feature feature) {
38 DCHECK(IsMainThread()); 38 DCHECK(IsMainThread());
39 // A parent document is on the same thread, so just record API use in the 39 // A parent document is on the same thread, so just record API use in the
40 // document's UseCounter. 40 // document's UseCounter.
41 AddDeprecationMessage(feature);
42 Deprecation::CountDeprecation(GetFrame(), feature); 41 Deprecation::CountDeprecation(GetFrame(), feature);
43 } 42 }
44 43
45 WorkerThread* MainThreadWorkletGlobalScope::GetThread() const { 44 WorkerThread* MainThreadWorkletGlobalScope::GetThread() const {
46 NOTREACHED(); 45 NOTREACHED();
47 return nullptr; 46 return nullptr;
48 } 47 }
49 48
50 // Implementation of the first half of the "fetch and invoke a worklet script" 49 // Implementation of the first half of the "fetch and invoke a worklet script"
51 // algorithm: 50 // algorithm:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return probe::ToCoreProbeSink(GetFrame()); 121 return probe::ToCoreProbeSink(GetFrame());
123 } 122 }
124 123
125 DEFINE_TRACE(MainThreadWorkletGlobalScope) { 124 DEFINE_TRACE(MainThreadWorkletGlobalScope) {
126 visitor->Trace(loader_map_); 125 visitor->Trace(loader_map_);
127 WorkletGlobalScope::Trace(visitor); 126 WorkletGlobalScope::Trace(visitor);
128 ContextClient::Trace(visitor); 127 ContextClient::Trace(visitor);
129 } 128 }
130 129
131 } // namespace blink 130 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698