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 16 matching lines...) Expand all Loading... |
27 #include "config.h" | 27 #include "config.h" |
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/FrameConsole.h" | 34 #include "core/frame/FrameConsole.h" |
35 #include "core/frame/FrameHost.h" | 35 #include "core/frame/FrameHost.h" |
36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/UseByOriginCounter.h" |
37 #include "core/inspector/ConsoleMessage.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 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); | 569 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); |
569 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObs
erver.CSSProperties", cssSampleId, maximumCSSSampleId()); | 570 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObs
erver.CSSProperties", cssSampleId, maximumCSSSampleId()); |
570 needsPagesMeasuredUpdate = true; | 571 needsPagesMeasuredUpdate = true; |
571 } | 572 } |
572 } | 573 } |
573 | 574 |
574 if (needsPagesMeasuredUpdate) | 575 if (needsPagesMeasuredUpdate) |
575 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObserve
r.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); | 576 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObserve
r.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); |
576 | 577 |
577 m_CSSFeatureBits.clearAll(); | 578 m_CSSFeatureBits.clearAll(); |
| 579 |
| 580 m_useByOriginCounter.updateMeasurementsAndClear(); |
578 } | 581 } |
579 | 582 |
580 void UseCounter::didCommitLoad() | 583 void UseCounter::didCommitLoad() |
581 { | 584 { |
582 updateMeasurements(); | 585 updateMeasurements(); |
583 } | 586 } |
584 | 587 |
585 void UseCounter::count(const Frame* frame, Feature feature) | 588 void UseCounter::count(const Frame* frame, Feature feature) |
586 { | 589 { |
587 if (!frame) | 590 if (!frame) |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 902 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
900 { | 903 { |
901 // FIXME: We may want to handle stylesheets that have multiple owners | 904 // FIXME: We may want to handle stylesheets that have multiple owners |
902 // http://crbug.com/242125 | 905 // http://crbug.com/242125 |
903 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 906 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
904 return getFrom(sheetContents->singleOwnerDocument()); | 907 return getFrom(sheetContents->singleOwnerDocument()); |
905 return 0; | 908 return 0; |
906 } | 909 } |
907 | 910 |
908 } // namespace blink | 911 } // namespace blink |
OLD | NEW |