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

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 bool UseCounter::isCounted(Document& document, CSSPropertyID unresolvedProperty)
689 {
690 Frame* frame = document.frame();
691 if (!frame)
692 return false;
693 FrameHost* host = frame->host();
694 if (!host)
695 return false;
696 return host->useCounter().isCounted(unresolvedProperty);
697 }
698
683 void UseCounter::count(const ExecutionContext* context, Feature feature) 699 void UseCounter::count(const ExecutionContext* context, Feature feature)
684 { 700 {
685 if (!context) 701 if (!context)
686 return; 702 return;
687 if (context->isDocument()) { 703 if (context->isDocument()) {
688 count(*toDocument(context), feature); 704 count(*toDocument(context), feature);
689 return; 705 return;
690 } 706 }
691 if (context->isWorkerGlobalScope()) 707 if (context->isWorkerGlobalScope())
692 toWorkerGlobalScope(context)->countFeature(feature); 708 toWorkerGlobalScope(context)->countFeature(feature);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 775 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
760 { 776 {
761 // FIXME: We may want to handle stylesheets that have multiple owners 777 // FIXME: We may want to handle stylesheets that have multiple owners
762 // https://crbug.com/242125 778 // https://crbug.com/242125
763 if (sheetContents && sheetContents->hasSingleOwnerNode()) 779 if (sheetContents && sheetContents->hasSingleOwnerNode())
764 return getFrom(sheetContents->singleOwnerDocument()); 780 return getFrom(sheetContents->singleOwnerDocument());
765 return 0; 781 return 0;
766 } 782 }
767 783
768 } // namespace blink 784 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698