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

Side by Side Diff: Source/core/page/PageSerializer.h

Issue 813453002: Oilpan: have PageSerializer accurately handle its GCed references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | Source/core/page/PageSerializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef PageSerializer_h 31 #ifndef PageSerializer_h
32 #define PageSerializer_h 32 #define PageSerializer_h
33 33
34 #include "platform/heap/Handle.h"
34 #include "platform/weborigin/KURL.h" 35 #include "platform/weborigin/KURL.h"
35 #include "platform/weborigin/KURLHash.h" 36 #include "platform/weborigin/KURLHash.h"
36 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
37 #include "wtf/ListHashSet.h" 38 #include "wtf/ListHashSet.h"
38 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class FontResource; 43 class FontResource;
43 class ImageResource; 44 class ImageResource;
44 class CSSStyleSheet; 45 class CSSStyleSheet;
45 class CSSValue; 46 class CSSValue;
46 class Document; 47 class Document;
47 class LocalFrame; 48 class LocalFrame;
48 class Page; 49 class Page;
49 class RenderObject; 50 class RenderObject;
50 class Resource; 51 class Resource;
51 class SharedBuffer; 52 class SharedBuffer;
52 class StylePropertySet; 53 class StylePropertySet;
53 54
54 struct SerializedResource; 55 struct SerializedResource;
55 56
56 // This class is used to serialize a page contents back to text (typically HTML) . 57 // This class is used to serialize a page contents back to text (typically HTML) .
57 // It serializes all the page frames and retrieves resources such as images and CSS stylesheets. 58 // It serializes all the page frames and retrieves resources such as images and CSS stylesheets.
58 class PageSerializer { 59 class PageSerializer final {
60 STACK_ALLOCATED();
59 public: 61 public:
60 explicit PageSerializer(Vector<SerializedResource>*); 62 explicit PageSerializer(Vector<SerializedResource>*);
61 63
62 // Initiates the serialization of the frame's page. All serialized content a nd retrieved 64 // Initiates the serialization of the frame's page. All serialized content a nd retrieved
63 // resources are added to the Vector passed to the constructor. The first re source in that 65 // resources are added to the Vector passed to the constructor. The first re source in that
64 // vector is the top frame serialized content. 66 // vector is the top frame serialized content.
65 void serialize(Page*); 67 void serialize(Page*);
66 68
67 KURL urlForBlankFrame(LocalFrame*); 69 KURL urlForBlankFrame(LocalFrame*);
68 70
69 private: 71 private:
70 void serializeFrame(LocalFrame*); 72 void serializeFrame(LocalFrame*);
71 73
72 // Serializes the stylesheet back to text and adds it to the resources if UR L is not-empty. 74 // Serializes the stylesheet back to text and adds it to the resources if UR L is not-empty.
73 // It also adds any resources included in that stylesheet (including any imp orted stylesheets and their own resources). 75 // It also adds any resources included in that stylesheet (including any imp orted stylesheets and their own resources).
74 void serializeCSSStyleSheet(CSSStyleSheet&, const KURL&); 76 void serializeCSSStyleSheet(CSSStyleSheet&, const KURL&);
75 77
76 bool shouldAddURL(const KURL&); 78 bool shouldAddURL(const KURL&);
77 79
78 void addToResources(Resource *, PassRefPtr<SharedBuffer>, const KURL&); 80 void addToResources(Resource *, PassRefPtr<SharedBuffer>, const KURL&);
79 void addImageToResources(ImageResource*, RenderObject*, const KURL&); 81 void addImageToResources(ImageResource*, RenderObject*, const KURL&);
80 void addFontToResources(FontResource*); 82 void addFontToResources(FontResource*);
81 83
82 void retrieveResourcesForProperties(const StylePropertySet*, Document&); 84 void retrieveResourcesForProperties(const StylePropertySet*, Document&);
83 void retrieveResourcesForCSSValue(CSSValue*, Document&); 85 void retrieveResourcesForCSSValue(CSSValue*, Document&);
84 86
85 Vector<SerializedResource>* m_resources; 87 Vector<SerializedResource>* m_resources;
86 ListHashSet<KURL> m_resourceURLs; 88 ListHashSet<KURL> m_resourceURLs;
87 HashMap<LocalFrame*, KURL> m_blankFrameURLs; 89
90 using BlankFrameURLMap = WillBeHeapHashMap<RawPtrWillBeMember<LocalFrame>, K URL>;
91 BlankFrameURLMap m_blankFrameURLs;
88 unsigned m_blankFrameCounter; 92 unsigned m_blankFrameCounter;
89 }; 93 };
90 94
91 } 95 } // namespace blink
92 96
93 #endif 97 #endif // PageSerializer_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/PageSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698