OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "core/frame/UseCounter.h" | 28 #include "core/frame/UseCounter.h" |
29 | 29 |
30 #include "core/css/CSSStyleSheet.h" | 30 #include "core/css/CSSStyleSheet.h" |
31 #include "core/css/StyleSheetContents.h" | 31 #include "core/css/StyleSheetContents.h" |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/dom/ExecutionContext.h" | 33 #include "core/dom/ExecutionContext.h" |
34 #include "core/frame/LocalDOMWindow.h" | 34 #include "core/frame/LocalDOMWindow.h" |
35 #include "core/frame/FrameConsole.h" | 35 #include "core/frame/FrameConsole.h" |
36 #include "core/frame/FrameHost.h" | 36 #include "core/frame/FrameHost.h" |
37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/inspector/ConsoleMessage.h" |
38 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
39 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 static int totalPagesMeasuredCSSSampleId() { return 1; } | 44 static int totalPagesMeasuredCSSSampleId() { return 1; } |
44 | 45 |
45 int UseCounter::m_muteCount = 0; | 46 int UseCounter::m_muteCount = 0; |
46 | 47 |
47 // FIXME : This mapping should be autogenerated. This function should | 48 // FIXME : This mapping should be autogenerated. This function should |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 628 |
628 void UseCounter::countDeprecation(const Document& document, Feature feature) | 629 void UseCounter::countDeprecation(const Document& document, Feature feature) |
629 { | 630 { |
630 FrameHost* host = document.frameHost(); | 631 FrameHost* host = document.frameHost(); |
631 LocalFrame* frame = document.frame(); | 632 LocalFrame* frame = document.frame(); |
632 if (!host || !frame) | 633 if (!host || !frame) |
633 return; | 634 return; |
634 | 635 |
635 if (host->useCounter().recordMeasurement(feature)) { | 636 if (host->useCounter().recordMeasurement(feature)) { |
636 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); | 637 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); |
637 frame->console().addMessage(DeprecationMessageSource, WarningMessageLeve
l, host->useCounter().deprecationMessage(feature)); | 638 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou
rce, WarningMessageLevel, host->useCounter().deprecationMessage(feature))); |
638 } | 639 } |
639 } | 640 } |
640 | 641 |
641 // FIXME: Update other UseCounter::deprecationMessage() cases to use this. | 642 // FIXME: Update other UseCounter::deprecationMessage() cases to use this. |
642 static String replacedBy(const char* oldString, const char* newString) | 643 static String replacedBy(const char* oldString, const char* newString) |
643 { | 644 { |
644 return String::format("'%s' is deprecated. Please use '%s' instead.", oldStr
ing, newString); | 645 return String::format("'%s' is deprecated. Please use '%s' instead.", oldStr
ing, newString); |
645 } | 646 } |
646 | 647 |
647 String UseCounter::deprecationMessage(Feature feature) | 648 String UseCounter::deprecationMessage(Feature feature) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 826 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
826 { | 827 { |
827 // FIXME: We may want to handle stylesheets that have multiple owners | 828 // FIXME: We may want to handle stylesheets that have multiple owners |
828 // http://crbug.com/242125 | 829 // http://crbug.com/242125 |
829 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 830 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
830 return getFrom(sheetContents->singleOwnerDocument()); | 831 return getFrom(sheetContents->singleOwnerDocument()); |
831 return 0; | 832 return 0; |
832 } | 833 } |
833 | 834 |
834 } // namespace blink | 835 } // namespace blink |
OLD | NEW |