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

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

Issue 901143002: Support deprecation warnings in shared/service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 574 }
575 575
576 void UseCounter::count(const Frame* frame, Feature feature) 576 void UseCounter::count(const Frame* frame, Feature feature)
577 { 577 {
578 if (!frame) 578 if (!frame)
579 return; 579 return;
580 FrameHost* host = frame->host(); 580 FrameHost* host = frame->host();
581 if (!host) 581 if (!host)
582 return; 582 return;
583 583
584 ASSERT(host->useCounter().deprecationMessage(feature).isEmpty()); 584 ASSERT(deprecationMessage(feature).isEmpty());
585 host->useCounter().recordMeasurement(feature); 585 host->useCounter().recordMeasurement(feature);
586 } 586 }
587 587
588 void UseCounter::count(const Document& document, Feature feature) 588 void UseCounter::count(const Document& document, Feature feature)
589 { 589 {
590 count(document.frame(), feature); 590 count(document.frame(), feature);
591 } 591 }
592 592
593 void UseCounter::count(const ExecutionContext* context, Feature feature) 593 void UseCounter::count(const ExecutionContext* context, Feature feature)
594 { 594 {
(...skipping 30 matching lines...) Expand all
625 625
626 void UseCounter::countDeprecation(const LocalFrame* frame, Feature feature) 626 void UseCounter::countDeprecation(const LocalFrame* frame, Feature feature)
627 { 627 {
628 if (!frame) 628 if (!frame)
629 return; 629 return;
630 FrameHost* host = frame->host(); 630 FrameHost* host = frame->host();
631 if (!host) 631 if (!host)
632 return; 632 return;
633 633
634 if (host->useCounter().recordMeasurement(feature)) { 634 if (host->useCounter().recordMeasurement(feature)) {
635 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); 635 ASSERT(!deprecationMessage(feature).isEmpty());
636 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, host->useCounter().deprecationMessage(feature))); 636 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, deprecationMessage(feature)));
637 } 637 }
638 } 638 }
639 639
640 void UseCounter::countDeprecation(ExecutionContext* context, Feature feature) 640 void UseCounter::countDeprecation(ExecutionContext* context, Feature feature)
641 { 641 {
642 if (!context) 642 if (!context)
643 return; 643 return;
644 if (context->isDocument()) { 644 if (context->isDocument()) {
645 UseCounter::countDeprecation(*toDocument(context), feature); 645 UseCounter::countDeprecation(*toDocument(context), feature);
646 return; 646 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 881 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
882 { 882 {
883 // FIXME: We may want to handle stylesheets that have multiple owners 883 // FIXME: We may want to handle stylesheets that have multiple owners
884 // http://crbug.com/242125 884 // http://crbug.com/242125
885 if (sheetContents && sheetContents->hasSingleOwnerNode()) 885 if (sheetContents && sheetContents->hasSingleOwnerNode())
886 return getFrom(sheetContents->singleOwnerDocument()); 886 return getFrom(sheetContents->singleOwnerDocument());
887 return 0; 887 return 0;
888 } 888 }
889 889
890 } // namespace blink 890 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698