Fix remaining bad uses of logDiagnosticMessageWithValue()
[WebKit-https.git] / Source / WebCore / page / DiagnosticLoggingKeys.cpp
1 /*
2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "DiagnosticLoggingKeys.h"
28
29 namespace WebCore {
30
31 String DiagnosticLoggingKeys::mediaLoadedKey()
32 {
33     return ASCIILiteral("mediaLoaded");
34 }
35
36 String DiagnosticLoggingKeys::mediaLoadingFailedKey()
37 {
38     return ASCIILiteral("mediaFailedLoading");
39 }
40
41 String DiagnosticLoggingKeys::memoryCacheEntryDecisionKey()
42 {
43     return ASCIILiteral("memoryCacheEntryDecision");
44 }
45
46 String DiagnosticLoggingKeys::memoryCacheUsageKey()
47 {
48     return ASCIILiteral("memoryCacheUsage");
49 }
50
51 String DiagnosticLoggingKeys::missingValidatorFieldsKey()
52 {
53     return ASCIILiteral("missingValidatorFields");
54 }
55
56 String DiagnosticLoggingKeys::pluginLoadedKey()
57 {
58     return ASCIILiteral("pluginLoaded");
59 }
60
61 String DiagnosticLoggingKeys::pluginLoadingFailedKey()
62 {
63     return ASCIILiteral("pluginFailedLoading");
64 }
65
66 String DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey()
67 {
68     return ASCIILiteral("postPageBackgroundingCPUUsage");
69 }
70
71 String DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey()
72 {
73     return ASCIILiteral("postPageBackgroundingMemoryUsage");
74 }
75
76 String DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey()
77 {
78     return ASCIILiteral("pageHandlesWebGLContextLoss");
79 }
80
81 String DiagnosticLoggingKeys::postPageLoadCPUUsageKey()
82 {
83     return ASCIILiteral("postPageLoadCPUUsage");
84 }
85
86 String DiagnosticLoggingKeys::postPageLoadMemoryUsageKey()
87 {
88     return ASCIILiteral("postPageLoadMemoryUsage");
89 }
90
91 String DiagnosticLoggingKeys::provisionalLoadKey()
92 {
93     return ASCIILiteral("provisionalLoad");
94 }
95
96 String DiagnosticLoggingKeys::pageContainsPluginKey()
97 {
98     return ASCIILiteral("pageContainsPlugin");
99 }
100
101 String DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey()
102 {
103     return ASCIILiteral("pageContainsAtLeastOnePlugin");
104 }
105
106 String DiagnosticLoggingKeys::pageContainsMediaEngineKey()
107 {
108     return ASCIILiteral("pageContainsMediaEngine");
109 }
110
111 String DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey()
112 {
113     return ASCIILiteral("pageContainsAtLeastOneMediaEngine");
114 }
115
116 String DiagnosticLoggingKeys::pageLoadedKey()
117 {
118     return ASCIILiteral("pageLoaded");
119 }
120
121 String DiagnosticLoggingKeys::playedKey()
122 {
123     return ASCIILiteral("played");
124 }
125
126 String DiagnosticLoggingKeys::engineFailedToLoadKey()
127 {
128     return ASCIILiteral("engineFailedToLoad");
129 }
130
131 String DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey()
132 {
133     return ASCIILiteral("entryRightlyNotWarmedUp");
134 }
135
136 String DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey()
137 {
138     return ASCIILiteral("entryWronglyNotWarmedUp");
139 }
140
141 String DiagnosticLoggingKeys::navigationKey()
142 {
143     return ASCIILiteral("navigation");
144 }
145
146 String DiagnosticLoggingKeys::needsRevalidationKey()
147 {
148     return ASCIILiteral("needsRevalidation");
149 }
150
151 String DiagnosticLoggingKeys::networkCacheKey()
152 {
153     return ASCIILiteral("networkCache");
154 }
155
156 String DiagnosticLoggingKeys::networkCacheFailureReasonKey()
157 {
158     return ASCIILiteral("networkCacheFailureReason");
159 }
160
161 String DiagnosticLoggingKeys::networkCacheUnusedReasonKey()
162 {
163     return ASCIILiteral("networkCacheUnusedReason");
164 }
165
166 String DiagnosticLoggingKeys::networkCacheReuseFailureKey()
167 {
168     return ASCIILiteral("networkCacheReuseFailure");
169 }
170
171 String DiagnosticLoggingKeys::networkKey()
172 {
173     return ASCIILiteral("network");
174 }
175
176 String DiagnosticLoggingKeys::networkProcessCrashedKey()
177 {
178     return ASCIILiteral("networkProcessCrashed");
179 }
180
181 String DiagnosticLoggingKeys::neverSeenBeforeKey()
182 {
183     return ASCIILiteral("neverSeenBefore");
184 }
185
186 String DiagnosticLoggingKeys::noKey()
187 {
188     return ASCIILiteral("no");
189 }
190
191 String DiagnosticLoggingKeys::noCacheKey()
192 {
193     return ASCIILiteral("noCache");
194 }
195
196 String DiagnosticLoggingKeys::noStoreKey()
197 {
198     return ASCIILiteral("noStore");
199 }
200
201 String DiagnosticLoggingKeys::nonVisibleStateKey()
202 {
203     return ASCIILiteral("nonVisibleState");
204 }
205
206 String DiagnosticLoggingKeys::notInMemoryCacheKey()
207 {
208     return ASCIILiteral("notInMemoryCache");
209 }
210
211 String DiagnosticLoggingKeys::pageCacheKey()
212 {
213     return ASCIILiteral("pageCache");
214 }
215
216 String DiagnosticLoggingKeys::pageCacheFailureKey()
217 {
218     return ASCIILiteral("pageCacheFailure");
219 }
220
221 String DiagnosticLoggingKeys::noDocumentLoaderKey()
222 {
223     return ASCIILiteral("noDocumentLoader");
224 }
225
226 String DiagnosticLoggingKeys::noLongerInCacheKey()
227 {
228     return ASCIILiteral("noLongerInCache");
229 }
230
231 String DiagnosticLoggingKeys::otherKey()
232 {
233     return ASCIILiteral("other");
234 }
235
236 String DiagnosticLoggingKeys::mainDocumentErrorKey()
237 {
238     return ASCIILiteral("mainDocumentError");
239 }
240
241 String DiagnosticLoggingKeys::mainResourceKey()
242 {
243     return ASCIILiteral("mainResource");
244 }
245
246 String DiagnosticLoggingKeys::isErrorPageKey()
247 {
248     return ASCIILiteral("isErrorPage");
249 }
250
251 String DiagnosticLoggingKeys::isExpiredKey()
252 {
253     return ASCIILiteral("isExpired");
254 }
255
256 String DiagnosticLoggingKeys::isReloadIgnoringCacheDataKey()
257 {
258     return ASCIILiteral("isReloadIgnoringCacheData");
259 }
260
261 String DiagnosticLoggingKeys::loadingKey()
262 {
263     return ASCIILiteral("loading");
264 }
265
266 String DiagnosticLoggingKeys::hasPluginsKey()
267 {
268     return ASCIILiteral("hasPlugins");
269 }
270
271 String DiagnosticLoggingKeys::httpsNoStoreKey()
272 {
273     return ASCIILiteral("httpsNoStore");
274 }
275
276 String DiagnosticLoggingKeys::imageKey()
277 {
278     return ASCIILiteral("image");
279 }
280
281 String DiagnosticLoggingKeys::inMemoryCacheKey()
282 {
283     return ASCIILiteral("inMemoryCache");
284 }
285
286 String DiagnosticLoggingKeys::inactiveKey()
287 {
288     return ASCIILiteral("inactive");
289 }
290
291 String DiagnosticLoggingKeys::internalErrorKey()
292 {
293     return ASCIILiteral("internalError");
294 }
295
296 String DiagnosticLoggingKeys::invalidSessionIDKey()
297 {
298     return ASCIILiteral("invalidSessionID");
299 }
300
301 String DiagnosticLoggingKeys::isAttachmentKey()
302 {
303     return ASCIILiteral("isAttachment");
304 }
305
306 String DiagnosticLoggingKeys::isConditionalRequestKey()
307 {
308     return ASCIILiteral("isConditionalRequest");
309 }
310
311 String DiagnosticLoggingKeys::isDisabledKey()
312 {
313     return ASCIILiteral("isDisabled");
314 }
315
316 String DiagnosticLoggingKeys::noCurrentHistoryItemKey()
317 {
318     return ASCIILiteral("noCurrentHistoryItem");
319 }
320
321 String DiagnosticLoggingKeys::quirkRedirectComingKey()
322 {
323     return ASCIILiteral("quirkRedirectComing");
324 }
325
326 String DiagnosticLoggingKeys::rawKey()
327 {
328     return ASCIILiteral("raw");
329 }
330
331 String DiagnosticLoggingKeys::redirectKey()
332 {
333     return ASCIILiteral("redirect");
334 }
335
336 String DiagnosticLoggingKeys::isLoadingKey()
337 {
338     return ASCIILiteral("isLoading");
339 }
340
341 String DiagnosticLoggingKeys::documentLoaderStoppingKey()
342 {
343     return ASCIILiteral("documentLoaderStopping");
344 }
345
346 String DiagnosticLoggingKeys::cannotSuspendActiveDOMObjectsKey()
347 {
348     return ASCIILiteral("cannotSuspendActiveDOMObjects");
349 }
350
351 String DiagnosticLoggingKeys::cpuUsageKey()
352 {
353     return ASCIILiteral("cpuUsage");
354 }
355
356 String DiagnosticLoggingKeys::createSharedBufferFailedKey()
357 {
358     return ASCIILiteral("createSharedBufferFailed");
359 }
360
361 String DiagnosticLoggingKeys::activeInForegroundTabKey()
362 {
363     return ASCIILiteral("activeInForegroundTab");
364 }
365
366 String DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey()
367 {
368     return ASCIILiteral("activeInBackgroundTabOnly");
369 }
370
371 String DiagnosticLoggingKeys::applicationCacheKey()
372 {
373     return ASCIILiteral("applicationCache");
374 }
375
376 String DiagnosticLoggingKeys::audioKey()
377 {
378     return ASCIILiteral("audio");
379 }
380
381 String DiagnosticLoggingKeys::backNavigationDeltaKey()
382 {
383     return ASCIILiteral("backNavigationDelta");
384 }
385
386 String DiagnosticLoggingKeys::canCacheKey()
387 {
388     return ASCIILiteral("canCache");
389 }
390
391 String DiagnosticLoggingKeys::cacheControlNoStoreKey()
392 {
393     return ASCIILiteral("cacheControlNoStore");
394 }
395
396 String DiagnosticLoggingKeys::cachedResourceRevalidationKey()
397 {
398     return ASCIILiteral("cachedResourceRevalidation");
399 }
400
401 String DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey()
402 {
403     return ASCIILiteral("cachedResourceRevalidationReason");
404 }
405
406 String DiagnosticLoggingKeys::deniedByClientKey()
407 {
408     return ASCIILiteral("deniedByClient");
409 }
410
411 String DiagnosticLoggingKeys::deviceMotionKey()
412 {
413     return ASCIILiteral("deviceMotion");
414 }
415
416 String DiagnosticLoggingKeys::deviceOrientationKey()
417 {
418     return ASCIILiteral("deviceOrientation");
419 }
420
421 String DiagnosticLoggingKeys::deviceProximityKey()
422 {
423     return ASCIILiteral("deviceProximity");
424 }
425
426 String DiagnosticLoggingKeys::diskCacheKey()
427 {
428     return ASCIILiteral("diskCache");
429 }
430
431 String DiagnosticLoggingKeys::diskCacheAfterValidationKey()
432 {
433     return ASCIILiteral("diskCacheAfterValidation");
434 }
435
436 String DiagnosticLoggingKeys::reloadKey()
437 {
438     return ASCIILiteral("reload");
439 }
440
441 String DiagnosticLoggingKeys::replaceKey()
442 {
443     return ASCIILiteral("replace");
444 }
445
446 String DiagnosticLoggingKeys::retrievalRequestKey()
447 {
448     return ASCIILiteral("retrievalRequest");
449 }
450
451 String DiagnosticLoggingKeys::resourceLoadedKey()
452 {
453     return ASCIILiteral("resourceLoaded");
454 }
455
456 String DiagnosticLoggingKeys::resourceResponseSourceKey()
457 {
458     return ASCIILiteral("resourceResponseSource");
459 }
460
461 String DiagnosticLoggingKeys::retrievalKey()
462 {
463     return ASCIILiteral("retrieval");
464 }
465
466 String DiagnosticLoggingKeys::revalidatingKey()
467 {
468     return ASCIILiteral("revalidating");
469 }
470
471 String DiagnosticLoggingKeys::reloadFromOriginKey()
472 {
473     return ASCIILiteral("reloadFromOrigin");
474 }
475
476 String DiagnosticLoggingKeys::sameLoadKey()
477 {
478     return ASCIILiteral("sameLoad");
479 }
480
481 String DiagnosticLoggingKeys::scriptKey()
482 {
483     return ASCIILiteral("script");
484 }
485
486 String DiagnosticLoggingKeys::streamingMedia()
487 {
488     return ASCIILiteral("streamingMedia");
489 }
490
491 String DiagnosticLoggingKeys::styleSheetKey()
492 {
493     return ASCIILiteral("styleSheet");
494 }
495
496 String DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey()
497 {
498     return ASCIILiteral("successfulSpeculativeWarmupWithRevalidation");
499 }
500
501 String DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey()
502 {
503     return ASCIILiteral("successfulSpeculativeWarmupWithoutRevalidation");
504 }
505
506 String DiagnosticLoggingKeys::svgDocumentKey()
507 {
508     return ASCIILiteral("svgDocument");
509 }
510
511 String DiagnosticLoggingKeys::synchronousMessageFailedKey()
512 {
513     return ASCIILiteral("synchronousMessageFailed");
514 }
515
516 String DiagnosticLoggingKeys::uncacheableStatusCodeKey()
517 {
518     return ASCIILiteral("uncacheableStatusCode");
519 }
520
521 String DiagnosticLoggingKeys::underMemoryPressureKey()
522 {
523     return ASCIILiteral("underMemoryPressure");
524 }
525
526 String DiagnosticLoggingKeys::unknownEntryRequestKey()
527 {
528     return ASCIILiteral("unknownEntryRequest");
529 }
530
531 String DiagnosticLoggingKeys::unlikelyToReuseKey()
532 {
533     return ASCIILiteral("unlikelyToReuse");
534 }
535
536 String DiagnosticLoggingKeys::unsupportedHTTPMethodKey()
537 {
538     return ASCIILiteral("unsupportedHTTPMethod");
539 }
540
541 String DiagnosticLoggingKeys::unsuspendableDOMObjectKey()
542 {
543     return ASCIILiteral("unsuspendableDOMObject");
544 }
545
546 String DiagnosticLoggingKeys::unusedKey()
547 {
548     return ASCIILiteral("unused");
549 }
550
551 String DiagnosticLoggingKeys::unusedReasonCredentialSettingsKey()
552 {
553     return ASCIILiteral("unused.reason.credentialSettings");
554 }
555
556 String DiagnosticLoggingKeys::unusedReasonErrorKey()
557 {
558     return ASCIILiteral("unused.reason.error");
559 }
560
561 String DiagnosticLoggingKeys::unusedReasonMustRevalidateNoValidatorKey()
562 {
563     return ASCIILiteral("unused.reason.mustRevalidateNoValidator");
564 }
565
566 String DiagnosticLoggingKeys::unusedReasonNoStoreKey()
567 {
568     return ASCIILiteral("unused.reason.noStore");
569 }
570
571 String DiagnosticLoggingKeys::unusedReasonRedirectChainKey()
572 {
573     return ASCIILiteral("unused.reason.redirectChain");
574 }
575
576 String DiagnosticLoggingKeys::unusedReasonReloadKey()
577 {
578     return ASCIILiteral("unused.reason.reload");
579 }
580
581 String DiagnosticLoggingKeys::unusedReasonTypeMismatchKey()
582 {
583     return ASCIILiteral("unused.reason.typeMismatch");
584 }
585
586 String DiagnosticLoggingKeys::usedKey()
587 {
588     return ASCIILiteral("used");
589 }
590
591 String DiagnosticLoggingKeys::userZoomActionKey()
592 {
593     return ASCIILiteral("userZoomAction");
594 }
595
596 String DiagnosticLoggingKeys::varyingHeaderMismatchKey()
597 {
598     return ASCIILiteral("varyingHeaderMismatch");
599 }
600
601 String DiagnosticLoggingKeys::videoKey()
602 {
603     return ASCIILiteral("video");
604 }
605
606 String DiagnosticLoggingKeys::visibleNonActiveStateKey()
607 {
608     return ASCIILiteral("visibleNonActiveState");
609 }
610
611 String DiagnosticLoggingKeys::visibleAndActiveStateKey()
612 {
613     return ASCIILiteral("visibleAndActiveState");
614 }
615
616 String DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey()
617 {
618     return ASCIILiteral("wastedSpeculativeWarmupWithRevalidation");
619 }
620
621 String DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey()
622 {
623     return ASCIILiteral("wastedSpeculativeWarmupWithoutRevalidation");
624 }
625
626 String DiagnosticLoggingKeys::webViewKey()
627 {
628     return ASCIILiteral("webView");
629 }
630
631 String DiagnosticLoggingKeys::yesKey()
632 {
633     return ASCIILiteral("yes");
634 }
635
636 String DiagnosticLoggingKeys::expiredKey()
637 {
638     return ASCIILiteral("expired");
639 }
640
641 String DiagnosticLoggingKeys::fontKey()
642 {
643     return ASCIILiteral("font");
644 }
645
646 String DiagnosticLoggingKeys::hasCalledWindowOpenKey()
647 {
648     return ASCIILiteral("hasCalledWindowOpen");
649 }
650
651 String DiagnosticLoggingKeys::hasOpenerKey()
652 {
653     return ASCIILiteral("hasOpener");
654 }
655
656 String DiagnosticLoggingKeys::prunedDueToMemoryPressureKey()
657 {
658     return ASCIILiteral("pruned.memoryPressure");
659 }
660
661 String DiagnosticLoggingKeys::prunedDueToMaxSizeReached()
662 {
663     return ASCIILiteral("pruned.capacityReached");
664 }
665
666 String DiagnosticLoggingKeys::prunedDueToProcessSuspended()
667 {
668     return ASCIILiteral("pruned.processSuspended");
669 }
670
671 String WebCore::DiagnosticLoggingKeys::notHTTPFamilyKey()
672 {
673     return ASCIILiteral("notHTTPFamily");
674 }
675
676 String WebCore::DiagnosticLoggingKeys::webGLStateKey()
677 {
678     return ASCIILiteral("webGLState");
679 }
680
681 String DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(uint64_t memoryUsage)
682 {
683     if (memoryUsage < 32 * MB)
684         return ASCIILiteral("below32");
685     if (memoryUsage < 64 * MB)
686         return ASCIILiteral("32to64");
687     if (memoryUsage < 128 * MB)
688         return ASCIILiteral("64to128");
689     if (memoryUsage < 256 * MB)
690         return ASCIILiteral("128to256");
691     if (memoryUsage < 512 * MB)
692         return ASCIILiteral("256to512");
693     if (memoryUsage < 1024 * MB)
694         return ASCIILiteral("512to1024");
695     if (memoryUsage < 2048 * MB)
696         return ASCIILiteral("1024to2048");
697     if (memoryUsage < 4096llu * MB)
698         return ASCIILiteral("2048to4096");
699     if (memoryUsage < 8192llu * MB)
700         return ASCIILiteral("4096to8192");
701     if (memoryUsage < 16384llu * MB)
702         return ASCIILiteral("8192to16384");
703     if (memoryUsage < 32768llu * MB)
704         return ASCIILiteral("16384to32768");
705     return ASCIILiteral("over32768");
706 }
707
708 String DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(double cpuUsage)
709 {
710     if (cpuUsage < 10)
711         return ASCIILiteral("below10");
712     if (cpuUsage < 20)
713         return ASCIILiteral("10to20");
714     if (cpuUsage < 40)
715         return ASCIILiteral("20to40");
716     if (cpuUsage < 60)
717         return ASCIILiteral("40to60");
718     if (cpuUsage < 80)
719         return ASCIILiteral("60to80");
720     return ASCIILiteral("over80");
721 }
722
723 String DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(double cpuUsage)
724 {
725     if (cpuUsage < 1)
726         return ASCIILiteral("below1");
727     if (cpuUsage < 5)
728         return ASCIILiteral("1to5");
729     if (cpuUsage < 10)
730         return ASCIILiteral("5to10");
731     if (cpuUsage < 30)
732         return ASCIILiteral("10to30");
733     if (cpuUsage < 50)
734         return ASCIILiteral("30to50");
735     if (cpuUsage < 70)
736         return ASCIILiteral("50to70");
737     return ASCIILiteral("over70");
738 }
739
740 } // namespace WebCore
741