Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef Deprecation_h | 5 #ifndef Deprecation_h |
| 6 #define Deprecation_h | 6 #define Deprecation_h |
| 7 | 7 |
| 8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 // "countDeprecation" sets the bit for this feature to 1, and sends a | 33 // "countDeprecation" sets the bit for this feature to 1, and sends a |
| 34 // deprecation warning to the console. Repeated calls are ignored. | 34 // deprecation warning to the console. Repeated calls are ignored. |
| 35 // | 35 // |
| 36 // Be considerate to developers' consoles: features should only send | 36 // Be considerate to developers' consoles: features should only send |
| 37 // deprecation warnings when we're actively interested in removing them from | 37 // deprecation warnings when we're actively interested in removing them from |
| 38 // the platform. | 38 // the platform. |
| 39 // | 39 // |
| 40 // For shared workers and service workers, the ExecutionContext* overload | 40 // For shared workers and service workers, the ExecutionContext* overload |
| 41 // doesn't count the usage but only sends a console warning. | 41 // doesn't count the usage but only sends a console warning. |
| 42 // TODO(lunalu): Deprecate UseCounter::Feature by WebFeature | |
| 42 static void CountDeprecation(const LocalFrame*, UseCounter::Feature); | 43 static void CountDeprecation(const LocalFrame*, UseCounter::Feature); |
| 43 static void CountDeprecation(ExecutionContext*, UseCounter::Feature); | 44 static void CountDeprecation(ExecutionContext*, UseCounter::Feature); |
| 44 static void CountDeprecation(const Document&, UseCounter::Feature); | 45 static void CountDeprecation(const Document&, UseCounter::Feature); |
| 46 static void CountDeprecation(const LocalFrame* frame, WebFeature feature) { | |
| 47 return CountDeprecation(frame, static_cast<UseCounter::Feature>(feature)); | |
| 48 } | |
| 49 static void CountDeprecation(ExecutionContext* exec_context, | |
| 50 WebFeature feature) { | |
| 51 return CountDeprecation(exec_context, | |
| 52 static_cast<UseCounter::Feature>(feature)); | |
|
Rick Byers
2017/05/23 19:51:49
ditto about preferring casting from the legacy typ
| |
| 53 } | |
| 54 static void CountDeprecation(const Document& document, WebFeature feature) { | |
| 55 return CountDeprecation(document, | |
| 56 static_cast<UseCounter::Feature>(feature)); | |
| 57 } | |
| 45 | 58 |
| 46 // Count only features if they're being used in an iframe which does not | 59 // Count only features if they're being used in an iframe which does not |
| 47 // have script access into the top level document. | 60 // have script access into the top level document. |
| 48 static void CountDeprecationCrossOriginIframe(const LocalFrame*, | 61 static void CountDeprecationCrossOriginIframe(const LocalFrame*, |
| 49 UseCounter::Feature); | 62 UseCounter::Feature); |
| 50 static void CountDeprecationCrossOriginIframe(const Document&, | 63 static void CountDeprecationCrossOriginIframe(const Document&, |
| 51 UseCounter::Feature); | 64 UseCounter::Feature); |
| 52 static String DeprecationMessage(UseCounter::Feature); | 65 static String DeprecationMessage(UseCounter::Feature); |
| 66 static void CountDeprecationCrossOriginIframe(const LocalFrame* frame, | |
| 67 WebFeature feature) { | |
| 68 return CountDeprecationCrossOriginIframe( | |
| 69 frame, static_cast<UseCounter::Feature>(feature)); | |
| 70 } | |
| 71 static void CountDeprecationCrossOriginIframe(const Document& document, | |
| 72 WebFeature feature) { | |
| 73 return CountDeprecationCrossOriginIframe( | |
| 74 document, static_cast<UseCounter::Feature>(feature)); | |
| 75 } | |
| 76 static String DeprecationMessage(WebFeature feature) { | |
| 77 return DeprecationMessage(static_cast<UseCounter::Feature>(feature)); | |
| 78 } | |
| 53 | 79 |
| 54 // Note: this is only public for tests. | 80 // Note: this is only public for tests. |
| 55 bool IsSuppressed(CSSPropertyID unresolved_property); | 81 bool IsSuppressed(CSSPropertyID unresolved_property); |
| 56 | 82 |
| 57 protected: | 83 protected: |
| 58 void Suppress(CSSPropertyID unresolved_property); | 84 void Suppress(CSSPropertyID unresolved_property); |
| 59 // CSSPropertyIDs that aren't deprecated return an empty string. | 85 // CSSPropertyIDs that aren't deprecated return an empty string. |
| 60 static String DeprecationMessage(CSSPropertyID unresolved_property); | 86 static String DeprecationMessage(CSSPropertyID unresolved_property); |
| 61 | 87 |
| 62 BitVector css_property_deprecation_bits_; | 88 BitVector css_property_deprecation_bits_; |
| 63 unsigned mute_count_; | 89 unsigned mute_count_; |
| 64 }; | 90 }; |
| 65 | 91 |
| 66 } // namespace blink | 92 } // namespace blink |
| 67 | 93 |
| 68 #endif // Deprecation_h | 94 #endif // Deprecation_h |
| OLD | NEW |