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

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

Issue 1711703002: Add internals.isCSSPropertyUseCounted functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 * 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 { 673 {
674 Frame* frame = document.frame(); 674 Frame* frame = document.frame();
675 if (!frame) 675 if (!frame)
676 return false; 676 return false;
677 FrameHost* host = frame->host(); 677 FrameHost* host = frame->host();
678 if (!host) 678 if (!host)
679 return false; 679 return false;
680 return host->useCounter().hasRecordedMeasurement(feature); 680 return host->useCounter().hasRecordedMeasurement(feature);
681 } 681 }
682 682
683 bool UseCounter::isCounted(CSSPropertyID unresolvedProperty)
684 {
685 return m_CSSFeatureBits.quickGet(unresolvedProperty);
686 }
687
688
689 bool UseCounter::isCounted(Document& document, const String& string)
690 {
691 Frame* frame = document.frame();
692 if (!frame)
693 return false;
694 FrameHost* host = frame->host();
695 if (!host)
696 return false;
697 return host->useCounter().isCounted(cssPropertyID(string));
alancutter (OOO until 2018) 2016/02/24 02:45:52 ASSERT not CSSPropertyInvalid.
nainar 2016/02/24 03:34:25 Done.
698 }
699
683 void UseCounter::count(const ExecutionContext* context, Feature feature) 700 void UseCounter::count(const ExecutionContext* context, Feature feature)
684 { 701 {
685 if (!context) 702 if (!context)
686 return; 703 return;
687 if (context->isDocument()) { 704 if (context->isDocument()) {
688 count(*toDocument(context), feature); 705 count(*toDocument(context), feature);
689 return; 706 return;
690 } 707 }
691 if (context->isWorkerGlobalScope()) 708 if (context->isWorkerGlobalScope())
692 toWorkerGlobalScope(context)->countFeature(feature); 709 toWorkerGlobalScope(context)->countFeature(feature);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 776 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
760 { 777 {
761 // FIXME: We may want to handle stylesheets that have multiple owners 778 // FIXME: We may want to handle stylesheets that have multiple owners
762 // https://crbug.com/242125 779 // https://crbug.com/242125
763 if (sheetContents && sheetContents->hasSingleOwnerNode()) 780 if (sheetContents && sheetContents->hasSingleOwnerNode())
764 return getFrom(sheetContents->singleOwnerDocument()); 781 return getFrom(sheetContents->singleOwnerDocument());
765 return 0; 782 return 0;
766 } 783 }
767 784
768 } // namespace blink 785 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698