OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. All rights reserved. | 2 * Copyright (C) 2012 Google, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Clearing count bits is timing sensitive. | 63 // Clearing count bits is timing sensitive. |
64 m_countBits->clearAll(); | 64 m_countBits->clearAll(); |
65 } | 65 } |
66 | 66 |
67 void UseCounter::didCommitLoad() | 67 void UseCounter::didCommitLoad() |
68 { | 68 { |
69 updateMeasurements(); | 69 updateMeasurements(); |
70 } | 70 } |
71 | 71 |
72 void UseCounter::observe(Document* document, Feature feature) | 72 void UseCounter::count(Document* document, Feature feature) |
73 { | 73 { |
74 if (!document) | 74 if (!document) |
75 return; | 75 return; |
76 | 76 |
77 Page* page = document->page(); | 77 Page* page = document->page(); |
78 if (!page) | 78 if (!page) |
79 return; | 79 return; |
80 | 80 |
81 ASSERT(page->useCounter()->deprecationMessage(feature).isEmpty()); | 81 ASSERT(page->useCounter()->deprecationMessage(feature).isEmpty()); |
82 page->useCounter()->recordObservation(feature); | 82 page->useCounter()->recordMeasurement(feature); |
83 } | 83 } |
84 | 84 |
85 void UseCounter::observe(DOMWindow* domWindow, Feature feature) | 85 void UseCounter::count(DOMWindow* domWindow, Feature feature) |
86 { | 86 { |
87 ASSERT(domWindow); | 87 ASSERT(domWindow); |
88 observe(domWindow->document(), feature); | 88 count(domWindow->document(), feature); |
89 } | 89 } |
90 | 90 |
91 void UseCounter::measureDeprecatedFeature(ScriptExecutionContext* context, Featu
re feature) | 91 void UseCounter::countDeprecation(ScriptExecutionContext* context, Feature featu
re) |
92 { | 92 { |
93 if (!context || !context->isDocument()) | 93 if (!context || !context->isDocument()) |
94 return; | 94 return; |
95 UseCounter::measureDeprecatedFeature(toDocument(context), feature); | 95 UseCounter::countDeprecation(toDocument(context), feature); |
96 } | 96 } |
97 | 97 |
98 void UseCounter::measureDeprecatedFeature(DOMWindow* window, Feature feature) | 98 void UseCounter::countDeprecation(DOMWindow* window, Feature feature) |
99 { | 99 { |
100 if (!window) | 100 if (!window) |
101 return; | 101 return; |
102 UseCounter::measureDeprecatedFeature(window->document(), feature); | 102 UseCounter::countDeprecation(window->document(), feature); |
103 } | 103 } |
104 | 104 |
105 void UseCounter::measureDeprecatedFeature(Document* document, Feature feature) | 105 void UseCounter::countDeprecation(Document* document, Feature feature) |
106 { | 106 { |
107 if (!document) | 107 if (!document) |
108 return; | 108 return; |
109 | 109 |
110 Page* page = document->page(); | 110 Page* page = document->page(); |
111 if (!page) | 111 if (!page) |
112 return; | 112 return; |
113 | 113 |
114 if (page->useCounter()->recordObservation(feature)) { | 114 if (page->useCounter()->recordMeasurement(feature)) { |
115 ASSERT(!page->useCounter()->deprecationMessage(feature).isEmpty()); | 115 ASSERT(!page->useCounter()->deprecationMessage(feature).isEmpty()); |
116 page->console()->addMessage(DeprecationMessageSource, WarningMessageLeve
l, page->useCounter()->deprecationMessage(feature)); | 116 page->console()->addMessage(DeprecationMessageSource, WarningMessageLeve
l, page->useCounter()->deprecationMessage(feature)); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 String UseCounter::deprecationMessage(Feature feature) | 120 String UseCounter::deprecationMessage(Feature feature) |
121 { | 121 { |
122 switch (feature) { | 122 switch (feature) { |
123 // Content Security Policy | 123 // Content Security Policy |
124 case PrefixedContentSecurityPolicy: | 124 case PrefixedContentSecurityPolicy: |
(...skipping 20 matching lines...) Expand all Loading... |
145 case WebAudioLooping: | 145 case WebAudioLooping: |
146 return "AudioBufferSourceNode 'looping' attribute is deprecated. Use 'l
oop' instead."; | 146 return "AudioBufferSourceNode 'looping' attribute is deprecated. Use 'l
oop' instead."; |
147 | 147 |
148 // Features that aren't deprecated don't have a deprecation message. | 148 // Features that aren't deprecated don't have a deprecation message. |
149 default: | 149 default: |
150 return String(); | 150 return String(); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |