| 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 14 matching lines...) Expand all Loading... |
| 25 #include "core/css/StyleRule.h" | 25 #include "core/css/StyleRule.h" |
| 26 #include "core/css/StyleRuleImport.h" | 26 #include "core/css/StyleRuleImport.h" |
| 27 #include "core/css/StyleRuleNamespace.h" | 27 #include "core/css/StyleRuleNamespace.h" |
| 28 #include "core/css/parser/CSSParser.h" | 28 #include "core/css/parser/CSSParser.h" |
| 29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
| 30 #include "core/dom/Node.h" | 30 #include "core/dom/Node.h" |
| 31 #include "core/dom/StyleEngine.h" | 31 #include "core/dom/StyleEngine.h" |
| 32 #include "core/fetch/CSSStyleSheetResource.h" | 32 #include "core/fetch/CSSStyleSheetResource.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 "platform/Histogram.h" |
| 35 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
| 36 #include "platform/weborigin/SecurityOrigin.h" | 37 #include "platform/weborigin/SecurityOrigin.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 // Rough size estimate for the memory cache. | 41 // Rough size estimate for the memory cache. |
| 41 unsigned StyleSheetContents::estimatedSizeInBytes() const | 42 unsigned StyleSheetContents::estimatedSizeInBytes() const |
| 42 { | 43 { |
| 43 // Note that this does not take into account size of the strings hanging fro
m various objects. | 44 // Note that this does not take into account size of the strings hanging fro
m various objects. |
| 44 // The assumption is that nearly all of of them are atomic and would exist a
nyway. | 45 // The assumption is that nearly all of of them are atomic and would exist a
nyway. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 313 } |
| 313 | 314 |
| 314 const AtomicString& StyleSheetContents::namespaceURIFromPrefix(const AtomicStrin
g& prefix) | 315 const AtomicString& StyleSheetContents::namespaceURIFromPrefix(const AtomicStrin
g& prefix) |
| 315 { | 316 { |
| 316 return m_namespaces.get(prefix); | 317 return m_namespaces.get(prefix); |
| 317 } | 318 } |
| 318 | 319 |
| 319 void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach
edStyleSheet, const SecurityOrigin* securityOrigin) | 320 void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach
edStyleSheet, const SecurityOrigin* securityOrigin) |
| 320 { | 321 { |
| 321 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", Ins
pectorParseAuthorStyleSheetEvent::data(cachedStyleSheet)); | 322 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", Ins
pectorParseAuthorStyleSheetEvent::data(cachedStyleSheet)); |
| 323 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Style.AuthorStyleSheet.ParseTime"); |
| 322 | 324 |
| 323 bool isSameOriginRequest = securityOrigin && securityOrigin->canRequest(base
URL()); | 325 bool isSameOriginRequest = securityOrigin && securityOrigin->canRequest(base
URL()); |
| 324 | 326 |
| 325 // When the response was fetched via the Service Worker, the original URL ma
y not be same as the base URL. | 327 // When the response was fetched via the Service Worker, the original URL ma
y not be same as the base URL. |
| 326 // TODO(horo): When we will use the original URL as the base URL, we can rem
ove this check. crbug.com/553535 | 328 // TODO(horo): When we will use the original URL as the base URL, we can rem
ove this check. crbug.com/553535 |
| 327 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { | 329 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { |
| 328 const KURL originalURL(cachedStyleSheet->response().originalURLViaServic
eWorker()); | 330 const KURL originalURL(cachedStyleSheet->response().originalURLViaServic
eWorker()); |
| 329 // |originalURL| is empty when the response is created in the SW. | 331 // |originalURL| is empty when the response is created in the SW. |
| 330 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) | 332 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) |
| 331 isSameOriginRequest = false; | 333 isSameOriginRequest = false; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 visitor->trace(m_importRules); | 666 visitor->trace(m_importRules); |
| 665 visitor->trace(m_namespaceRules); | 667 visitor->trace(m_namespaceRules); |
| 666 visitor->trace(m_childRules); | 668 visitor->trace(m_childRules); |
| 667 visitor->trace(m_loadingClients); | 669 visitor->trace(m_loadingClients); |
| 668 visitor->trace(m_completedClients); | 670 visitor->trace(m_completedClients); |
| 669 visitor->trace(m_ruleSet); | 671 visitor->trace(m_ruleSet); |
| 670 visitor->trace(m_referencedFromResource); | 672 visitor->trace(m_referencedFromResource); |
| 671 } | 673 } |
| 672 | 674 |
| 673 } // namespace blink | 675 } // namespace blink |
| OLD | NEW |