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

Side by Side Diff: Source/core/frame/UseCounter.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 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
OLDNEW
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
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 WebCore { 42 namespace WebCore {
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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 640
640 void UseCounter::countDeprecation(const Document& document, Feature feature) 641 void UseCounter::countDeprecation(const Document& document, Feature feature)
641 { 642 {
642 FrameHost* host = document.frameHost(); 643 FrameHost* host = document.frameHost();
643 LocalFrame* frame = document.frame(); 644 LocalFrame* frame = document.frame();
644 if (!host || !frame) 645 if (!host || !frame)
645 return; 646 return;
646 647
647 if (host->useCounter().recordMeasurement(feature)) { 648 if (host->useCounter().recordMeasurement(feature)) {
648 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); 649 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty());
649 frame->console().addMessage(DeprecationMessageSource, WarningMessageLeve l, host->useCounter().deprecationMessage(feature)); 650 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, host->useCounter().deprecationMessage(feature)));
650 } 651 }
651 } 652 }
652 653
653 String UseCounter::deprecationMessage(Feature feature) 654 String UseCounter::deprecationMessage(Feature feature)
654 { 655 {
655 switch (feature) { 656 switch (feature) {
656 // Quota 657 // Quota
657 case PrefixedStorageInfo: 658 case PrefixedStorageInfo:
658 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator. webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead."; 659 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator. webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.";
659 660
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 791 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
791 { 792 {
792 // FIXME: We may want to handle stylesheets that have multiple owners 793 // FIXME: We may want to handle stylesheets that have multiple owners
793 // http://crbug.com/242125 794 // http://crbug.com/242125
794 if (sheetContents && sheetContents->hasSingleOwnerNode()) 795 if (sheetContents && sheetContents->hasSingleOwnerNode())
795 return getFrom(sheetContents->singleOwnerDocument()); 796 return getFrom(sheetContents->singleOwnerDocument());
796 return 0; 797 return 0;
797 } 798 }
798 799
799 } // namespace WebCore 800 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698