OLD | NEW |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Tells whether to skip serialization of a subresource. | 100 // Tells whether to skip serialization of a subresource. |
101 virtual bool ShouldSkipResource(ResourceHasCacheControlNoStoreHeader) { | 101 virtual bool ShouldSkipResource(ResourceHasCacheControlNoStoreHeader) { |
102 return false; | 102 return false; |
103 } | 103 } |
104 | 104 |
105 // Returns custom attributes that need to add in order to serialize the | 105 // Returns custom attributes that need to add in order to serialize the |
106 // element. | 106 // element. |
107 virtual Vector<Attribute> GetCustomAttributes(const Element&) { | 107 virtual Vector<Attribute> GetCustomAttributes(const Element&) { |
108 return Vector<Attribute>(); | 108 return Vector<Attribute>(); |
109 } | 109 } |
| 110 |
| 111 virtual bool ShouldCollectProblemMetric() { return false; } |
110 }; | 112 }; |
111 | 113 |
112 // Constructs a serializer that will write output to the given deque of | 114 // Constructs a serializer that will write output to the given deque of |
113 // SerializedResources and uses the Delegate for controlling some | 115 // SerializedResources and uses the Delegate for controlling some |
114 // serialization aspects. Callers need to ensure that both arguments stay | 116 // serialization aspects. Callers need to ensure that both arguments stay |
115 // alive until the FrameSerializer gets destroyed. | 117 // alive until the FrameSerializer gets destroyed. |
116 FrameSerializer(Deque<SerializedResource>&, Delegate&); | 118 FrameSerializer(Deque<SerializedResource>&, Delegate&); |
117 | 119 |
118 // Initiates the serialization of the frame. All serialized content and | 120 // Initiates the serialization of the frame. All serialized content and |
119 // retrieved resources are added to the Deque passed to the constructor. | 121 // retrieved resources are added to the Deque passed to the constructor. |
(...skipping 19 matching lines...) Expand all Loading... |
139 ResourceHasCacheControlNoStoreHeader, | 141 ResourceHasCacheControlNoStoreHeader, |
140 PassRefPtr<const SharedBuffer>, | 142 PassRefPtr<const SharedBuffer>, |
141 const KURL&); | 143 const KURL&); |
142 void AddImageToResources(ImageResourceContent*, const KURL&); | 144 void AddImageToResources(ImageResourceContent*, const KURL&); |
143 void AddFontToResources(FontResource*); | 145 void AddFontToResources(FontResource*); |
144 | 146 |
145 void RetrieveResourcesForProperties(const StylePropertySet*, Document&); | 147 void RetrieveResourcesForProperties(const StylePropertySet*, Document&); |
146 void RetrieveResourcesForCSSValue(const CSSValue&, Document&); | 148 void RetrieveResourcesForCSSValue(const CSSValue&, Document&); |
147 | 149 |
148 Deque<SerializedResource>* resources_; | 150 Deque<SerializedResource>* resources_; |
| 151 // This hashset is only used for de-duplicating resources to be serialized. |
149 HashSet<KURL> resource_urls_; | 152 HashSet<KURL> resource_urls_; |
150 | 153 |
151 bool is_serializing_css_; | 154 bool is_serializing_css_; |
152 | 155 |
153 Delegate& delegate_; | 156 Delegate& delegate_; |
| 157 |
| 158 // Variables for problem detection during serialization. |
| 159 int total_image_count_; |
| 160 int loaded_image_count_; |
| 161 int total_css_count_; |
| 162 int loaded_css_count_; |
| 163 bool should_collect_problem_metric_; |
154 }; | 164 }; |
155 | 165 |
156 } // namespace blink | 166 } // namespace blink |
157 | 167 |
158 #endif // FrameSerializer_h | 168 #endif // FrameSerializer_h |
OLD | NEW |