| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/dom/StyleEngine.h" | 32 #include "core/dom/StyleEngine.h" |
| 33 #include "core/frame/UseCounter.h" | 33 #include "core/frame/UseCounter.h" |
| 34 #include "core/inspector/InspectorTraceEvents.h" | 34 #include "core/inspector/InspectorTraceEvents.h" |
| 35 #include "core/loader/resource/CSSStyleSheetResource.h" | 35 #include "core/loader/resource/CSSStyleSheetResource.h" |
| 36 #include "platform/Histogram.h" | 36 #include "platform/Histogram.h" |
| 37 #include "platform/instrumentation/tracing/TraceEvent.h" | 37 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 38 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 // static |
| 43 const Document* StyleSheetContents::singleOwnerDocument( |
| 44 const StyleSheetContents* styleSheetContents) { |
| 45 // TODO(https://crbug.com/242125): We may want to handle stylesheets that have |
| 46 // multiple owners when this is used for UseCounter. |
| 47 if (styleSheetContents && styleSheetContents->hasSingleOwnerNode()) |
| 48 return styleSheetContents->singleOwnerDocument(); |
| 49 return nullptr; |
| 50 } |
| 51 |
| 42 // Rough size estimate for the memory cache. | 52 // Rough size estimate for the memory cache. |
| 43 unsigned StyleSheetContents::estimatedSizeInBytes() const { | 53 unsigned StyleSheetContents::estimatedSizeInBytes() const { |
| 44 // Note that this does not take into account size of the strings hanging from | 54 // Note that this does not take into account size of the strings hanging from |
| 45 // various objects. The assumption is that nearly all of of them are atomic | 55 // various objects. The assumption is that nearly all of of them are atomic |
| 46 // and would exist anyway. | 56 // and would exist anyway. |
| 47 unsigned size = sizeof(*this); | 57 unsigned size = sizeof(*this); |
| 48 | 58 |
| 49 // FIXME: This ignores the children of media rules. | 59 // FIXME: This ignores the children of media rules. |
| 50 // Most rules are StyleRules. | 60 // Most rules are StyleRules. |
| 51 size += ruleCount() * StyleRule::averageSizeInBytes(); | 61 size += ruleCount() * StyleRule::averageSizeInBytes(); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 visitor->trace(m_namespaceRules); | 702 visitor->trace(m_namespaceRules); |
| 693 visitor->trace(m_childRules); | 703 visitor->trace(m_childRules); |
| 694 visitor->trace(m_loadingClients); | 704 visitor->trace(m_loadingClients); |
| 695 visitor->trace(m_completedClients); | 705 visitor->trace(m_completedClients); |
| 696 visitor->trace(m_ruleSet); | 706 visitor->trace(m_ruleSet); |
| 697 visitor->trace(m_referencedFromResource); | 707 visitor->trace(m_referencedFromResource); |
| 698 visitor->trace(m_parserContext); | 708 visitor->trace(m_parserContext); |
| 699 } | 709 } |
| 700 | 710 |
| 701 } // namespace blink | 711 } // namespace blink |
| OLD | NEW |