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

Side by Side Diff: third_party/WebKit/Source/core/frame/Deprecation.cpp

Issue 2720213002: Removed FrameHost::deprecation() (Closed)
Patch Set: 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 | « no previous file | third_party/WebKit/Source/core/frame/FrameHost.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame/Deprecation.h" 5 #include "core/frame/Deprecation.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/FrameConsole.h" 9 #include "core/frame/FrameConsole.h"
10 #include "core/frame/FrameHost.h"
11 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
12 #include "core/inspector/ConsoleMessage.h" 11 #include "core/inspector/ConsoleMessage.h"
12 #include "core/page/Page.h"
13 #include "core/workers/WorkerOrWorkletGlobalScope.h" 13 #include "core/workers/WorkerOrWorkletGlobalScope.h"
14 14
15 namespace { 15 namespace {
16 16
17 enum Milestone { 17 enum Milestone {
18 M56, 18 M56,
19 M57, 19 M57,
20 M58, 20 M58,
21 M59, 21 M59,
22 M60, 22 M60,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 m_cssPropertyDeprecationBits.quickSet(unresolvedProperty); 94 m_cssPropertyDeprecationBits.quickSet(unresolvedProperty);
95 } 95 }
96 96
97 bool Deprecation::isSuppressed(CSSPropertyID unresolvedProperty) { 97 bool Deprecation::isSuppressed(CSSPropertyID unresolvedProperty) {
98 DCHECK(isCSSPropertyIDWithName(unresolvedProperty)); 98 DCHECK(isCSSPropertyIDWithName(unresolvedProperty));
99 return m_cssPropertyDeprecationBits.quickGet(unresolvedProperty); 99 return m_cssPropertyDeprecationBits.quickGet(unresolvedProperty);
100 } 100 }
101 101
102 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame, 102 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame,
103 CSSPropertyID unresolvedProperty) { 103 CSSPropertyID unresolvedProperty) {
104 FrameHost* host = frame ? frame->host() : nullptr; 104 Page* page = frame ? frame->page() : nullptr;
105 if (!host || host->deprecation().m_muteCount || 105 if (!page || page->deprecation().m_muteCount ||
106 host->deprecation().isSuppressed(unresolvedProperty)) 106 page->deprecation().isSuppressed(unresolvedProperty))
107 return; 107 return;
108 108
109 String message = deprecationMessage(unresolvedProperty); 109 String message = deprecationMessage(unresolvedProperty);
110 if (!message.isEmpty()) { 110 if (!message.isEmpty()) {
111 host->deprecation().suppress(unresolvedProperty); 111 page->deprecation().suppress(unresolvedProperty);
112 ConsoleMessage* consoleMessage = ConsoleMessage::create( 112 ConsoleMessage* consoleMessage = ConsoleMessage::create(
113 DeprecationMessageSource, WarningMessageLevel, message); 113 DeprecationMessageSource, WarningMessageLevel, message);
114 frame->console().addMessage(consoleMessage); 114 frame->console().addMessage(consoleMessage);
115 } 115 }
116 } 116 }
117 117
118 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) { 118 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) {
119 switch (unresolvedProperty) { 119 switch (unresolvedProperty) {
120 case CSSPropertyAliasMotionOffset: 120 case CSSPropertyAliasMotionOffset:
121 return replacedWillBeRemoved("motion-offset", "offset-distance", M58, 121 return replacedWillBeRemoved("motion-offset", "offset-distance", M58,
(...skipping 12 matching lines...) Expand all
134 134
135 default: 135 default:
136 return emptyString; 136 return emptyString;
137 } 137 }
138 } 138 }
139 139
140 void Deprecation::countDeprecation(const LocalFrame* frame, 140 void Deprecation::countDeprecation(const LocalFrame* frame,
141 UseCounter::Feature feature) { 141 UseCounter::Feature feature) {
142 if (!frame) 142 if (!frame)
143 return; 143 return;
144 FrameHost* host = frame->host(); 144 Page* page = frame->page();
145 if (!host || host->deprecation().m_muteCount) 145 if (!page || page->deprecation().m_muteCount)
146 return; 146 return;
147 147
148 if (!host->useCounter().hasRecordedMeasurement(feature)) { 148 if (!page->useCounter().hasRecordedMeasurement(feature)) {
149 host->useCounter().recordMeasurement(feature); 149 page->useCounter().recordMeasurement(feature);
150 ASSERT(!deprecationMessage(feature).isEmpty()); 150 ASSERT(!deprecationMessage(feature).isEmpty());
151 ConsoleMessage* consoleMessage = 151 ConsoleMessage* consoleMessage =
152 ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel, 152 ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel,
153 deprecationMessage(feature)); 153 deprecationMessage(feature));
154 frame->console().addMessage(consoleMessage); 154 frame->console().addMessage(consoleMessage);
155 } 155 }
156 } 156 }
157 157
158 void Deprecation::countDeprecation(ExecutionContext* context, 158 void Deprecation::countDeprecation(ExecutionContext* context,
159 UseCounter::Feature feature) { 159 UseCounter::Feature feature) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 "as of %s. See https://www.chromestatus.com/features/5030265697075200" 430 "as of %s. See https://www.chromestatus.com/features/5030265697075200"
431 " for more details.", milestoneString(M59)); 431 " for more details.", milestoneString(M59));
432 432
433 // Features that aren't deprecated don't have a deprecation message. 433 // Features that aren't deprecated don't have a deprecation message.
434 default: 434 default:
435 return String(); 435 return String();
436 } 436 }
437 } 437 }
438 438
439 } // namespace blink 439 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698