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

Side by Side Diff: Source/core/fetch/CSSStyleSheetResource.h

Issue 166633002: Prefetch @import files from CSS files. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplified and with selftests. Created 6 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 10 matching lines...) Expand all
21 21
22 This class provides all functionality needed for loading images, style sheet s and html 22 This class provides all functionality needed for loading images, style sheet s and html
23 pages from the web. It has a memory cache for these objects. 23 pages from the web. It has a memory cache for these objects.
24 */ 24 */
25 25
26 #ifndef CSSStyleSheetResource_h 26 #ifndef CSSStyleSheetResource_h
27 #define CSSStyleSheetResource_h 27 #define CSSStyleSheetResource_h
28 28
29 #include "core/fetch/ResourcePtr.h" 29 #include "core/fetch/ResourcePtr.h"
30 #include "core/fetch/StyleSheetResource.h" 30 #include "core/fetch/StyleSheetResource.h"
31 #include "core/html/parser/CSSPreloadScanner.h"
31 #include "heap/Handle.h" 32 #include "heap/Handle.h"
32 33
33 namespace WebCore { 34 namespace WebCore {
34 35
35 class CSSParserContext; 36 class CSSParserContext;
36 class ResourceClient; 37 class ResourceClient;
37 class StyleSheetContents; 38 class StyleSheetContents;
38 class TextResourceDecoder; 39 class TextResourceDecoder;
39 40
40 class CSSStyleSheetResource FINAL : public StyleSheetResource { 41 class CSSStyleSheetResource FINAL : public StyleSheetResource {
41 public: 42 public:
42 CSSStyleSheetResource(const ResourceRequest&, const String& charset); 43 CSSStyleSheetResource(const ResourceRequest&, const String& charset, Documen t*);
abarth-chromium 2014/02/26 19:13:36 You can't have a dependency from a subclass of Res
43 virtual ~CSSStyleSheetResource(); 44 virtual ~CSSStyleSheetResource();
44 45
45 const String sheetText(bool enforceMIMEType = true, bool* hasValidMIMEType = 0) const; 46 const String sheetText(bool enforceMIMEType = true, bool* hasValidMIMEType = 0) const;
46 47
47 virtual void didAddClient(ResourceClient*) OVERRIDE; 48 virtual void didAddClient(ResourceClient*) OVERRIDE;
48 virtual void setEncoding(const String&) OVERRIDE; 49 virtual void setEncoding(const String&) OVERRIDE;
49 virtual String encoding() const OVERRIDE; 50 virtual String encoding() const OVERRIDE;
50 51
51 PassRefPtrWillBeRawPtr<StyleSheetContents> restoreParsedStyleSheet(const CSS ParserContext&); 52 PassRefPtrWillBeRawPtr<StyleSheetContents> restoreParsedStyleSheet(const CSS ParserContext&);
52 void saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>); 53 void saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>);
53 54
54 protected: 55 protected:
55 virtual bool isSafeToUnlock() const OVERRIDE; 56 virtual bool isSafeToUnlock() const OVERRIDE;
56 virtual void destroyDecodedDataIfPossible() OVERRIDE; 57 virtual void destroyDecodedDataIfPossible() OVERRIDE;
57 58
58 private: 59 private:
59 bool canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const; 60 bool canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const;
60 virtual void checkNotify() OVERRIDE; 61 virtual void checkNotify() OVERRIDE;
62 virtual void appendData(const char*, int) OVERRIDE;
61 63
62 OwnPtr<TextResourceDecoder> m_decoder; 64 OwnPtr<TextResourceDecoder> m_decoder;
63 String m_decodedSheetText; 65 String m_decodedSheetText;
64 66
67 OwnPtr<CSSPreloadScanner> m_preloadScanner;
68 OwnPtr<HTMLResourcePreloader> m_preloader;
69 bool m_prescan;
abarth-chromium 2014/02/26 19:13:36 What do m_prescan mean? Does this mean m_isPreloa
70
65 RefPtrWillBePersistent<StyleSheetContents> m_parsedStyleSheetCache; 71 RefPtrWillBePersistent<StyleSheetContents> m_parsedStyleSheetCache;
66 }; 72 };
67 73
68 DEFINE_RESOURCE_TYPE_CASTS(CSSStyleSheet); 74 DEFINE_RESOURCE_TYPE_CASTS(CSSStyleSheet);
69 75
70 } 76 }
71 77
72 #endif 78 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698