| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 XHRReplayData(ExecutionContext*, const AtomicString& method, const KURL&, bo
ol async, PassRefPtr<EncodedFormData>, bool includeCredentials); | 71 XHRReplayData(ExecutionContext*, const AtomicString& method, const KURL&, bo
ol async, PassRefPtr<EncodedFormData>, bool includeCredentials); |
| 72 | 72 |
| 73 AtomicString m_method; | 73 AtomicString m_method; |
| 74 KURL m_url; | 74 KURL m_url; |
| 75 bool m_async; | 75 bool m_async; |
| 76 RefPtr<EncodedFormData> m_formData; | 76 RefPtr<EncodedFormData> m_formData; |
| 77 HTTPHeaderMap m_headers; | 77 HTTPHeaderMap m_headers; |
| 78 bool m_includeCredentials; | 78 bool m_includeCredentials; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class NetworkResourcesData { | 81 class NetworkResourcesData final : public NoBaseWillBeGarbageCollectedFinalized<
NetworkResourcesData> { |
| 82 USING_FAST_MALLOC(NetworkResourcesData); | 82 USING_FAST_MALLOC_WILL_BE_REMOVED(NetworkResourcesData); |
| 83 public: | 83 public: |
| 84 class ResourceData { | 84 class ResourceData final : public NoBaseWillBeGarbageCollectedFinalized<Reso
urceData> { |
| 85 USING_FAST_MALLOC(ResourceData); | 85 USING_FAST_MALLOC_WILL_BE_REMOVED(ResourceData); |
| 86 friend class NetworkResourcesData; | 86 friend class NetworkResourcesData; |
| 87 public: | 87 public: |
| 88 ResourceData(const String& requestId, const String& loaderId); | 88 ResourceData(const String& requestId, const String& loaderId); |
| 89 | 89 |
| 90 String requestId() const { return m_requestId; } | 90 String requestId() const { return m_requestId; } |
| 91 String loaderId() const { return m_loaderId; } | 91 String loaderId() const { return m_loaderId; } |
| 92 | 92 |
| 93 String frameId() const { return m_frameId; } | 93 String frameId() const { return m_frameId; } |
| 94 void setFrameId(const String& frameId) { m_frameId = frameId; } | 94 void setFrameId(const String& frameId) { m_frameId = frameId; } |
| 95 | 95 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 126 | 126 |
| 127 Resource* cachedResource() const { return m_cachedResource; } | 127 Resource* cachedResource() const { return m_cachedResource; } |
| 128 void setResource(Resource* cachedResource) { m_cachedResource = cachedRe
source; } | 128 void setResource(Resource* cachedResource) { m_cachedResource = cachedRe
source; } |
| 129 | 129 |
| 130 XHRReplayData* xhrReplayData() const { return m_xhrReplayData.get(); } | 130 XHRReplayData* xhrReplayData() const { return m_xhrReplayData.get(); } |
| 131 void setXHRReplayData(XHRReplayData* xhrReplayData) { m_xhrReplayData =
xhrReplayData; } | 131 void setXHRReplayData(XHRReplayData* xhrReplayData) { m_xhrReplayData =
xhrReplayData; } |
| 132 | 132 |
| 133 BlobDataHandle* downloadedFileBlob() const { return m_downloadedFileBlob
.get(); } | 133 BlobDataHandle* downloadedFileBlob() const { return m_downloadedFileBlob
.get(); } |
| 134 void setDownloadedFileBlob(PassRefPtr<BlobDataHandle> blob) { m_download
edFileBlob = blob; } | 134 void setDownloadedFileBlob(PassRefPtr<BlobDataHandle> blob) { m_download
edFileBlob = blob; } |
| 135 | 135 |
| 136 DECLARE_TRACE(); |
| 136 private: | 137 private: |
| 137 bool hasData() const { return m_dataBuffer; } | 138 bool hasData() const { return m_dataBuffer; } |
| 138 size_t dataLength() const; | 139 size_t dataLength() const; |
| 139 void appendData(const char* data, size_t dataLength); | 140 void appendData(const char* data, size_t dataLength); |
| 140 size_t decodeDataToContent(); | 141 size_t decodeDataToContent(); |
| 141 | 142 |
| 142 String m_requestId; | 143 String m_requestId; |
| 143 String m_loaderId; | 144 String m_loaderId; |
| 144 String m_frameId; | 145 String m_frameId; |
| 145 KURL m_url; | 146 KURL m_url; |
| 146 String m_content; | 147 String m_content; |
| 147 RefPtrWillBePersistent<XHRReplayData> m_xhrReplayData; | 148 RefPtrWillBeMember<XHRReplayData> m_xhrReplayData; |
| 148 bool m_base64Encoded; | 149 bool m_base64Encoded; |
| 149 RefPtr<SharedBuffer> m_dataBuffer; | 150 RefPtr<SharedBuffer> m_dataBuffer; |
| 150 bool m_isContentEvicted; | 151 bool m_isContentEvicted; |
| 151 InspectorPageAgent::ResourceType m_type; | 152 InspectorPageAgent::ResourceType m_type; |
| 152 int m_httpStatusCode; | 153 int m_httpStatusCode; |
| 153 | 154 |
| 154 String m_mimeType; | 155 String m_mimeType; |
| 155 String m_textEncodingName; | 156 String m_textEncodingName; |
| 156 OwnPtr<TextResourceDecoder> m_decoder; | 157 OwnPtr<TextResourceDecoder> m_decoder; |
| 157 | 158 |
| 158 RefPtr<SharedBuffer> m_buffer; | 159 RefPtr<SharedBuffer> m_buffer; |
| 159 Resource* m_cachedResource; | 160 RawPtrWillBeMember<Resource> m_cachedResource; |
| 160 RefPtr<BlobDataHandle> m_downloadedFileBlob; | 161 RefPtr<BlobDataHandle> m_downloadedFileBlob; |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 NetworkResourcesData(); | 164 static PassOwnPtrWillBeRawPtr<NetworkResourcesData> create() |
| 164 | 165 { |
| 166 return adoptPtrWillBeNoop(new NetworkResourcesData); |
| 167 } |
| 165 ~NetworkResourcesData(); | 168 ~NetworkResourcesData(); |
| 166 | 169 |
| 167 void resourceCreated(const String& requestId, const String& loaderId); | 170 void resourceCreated(const String& requestId, const String& loaderId); |
| 168 void responseReceived(const String& requestId, const String& frameId, const
ResourceResponse&); | 171 void responseReceived(const String& requestId, const String& frameId, const
ResourceResponse&); |
| 169 void setResourceType(const String& requestId, InspectorPageAgent::ResourceTy
pe); | 172 void setResourceType(const String& requestId, InspectorPageAgent::ResourceTy
pe); |
| 170 InspectorPageAgent::ResourceType resourceType(const String& requestId); | 173 InspectorPageAgent::ResourceType resourceType(const String& requestId); |
| 171 void setResourceContent(const String& requestId, const String& content, bool
base64Encoded = false); | 174 void setResourceContent(const String& requestId, const String& content, bool
base64Encoded = false); |
| 172 void maybeAddResourceData(const String& requestId, const char* data, size_t
dataLength); | 175 void maybeAddResourceData(const String& requestId, const char* data, size_t
dataLength); |
| 173 void maybeDecodeDataToContent(const String& requestId); | 176 void maybeDecodeDataToContent(const String& requestId); |
| 174 void addResource(const String& requestId, Resource*); | 177 void addResource(const String& requestId, Resource*); |
| 175 ResourceData const* data(const String& requestId); | 178 ResourceData const* data(const String& requestId); |
| 176 Vector<String> removeResource(Resource*); | 179 Vector<String> removeResource(Resource*); |
| 177 void clear(const String& preservedLoaderId = String()); | 180 void clear(const String& preservedLoaderId = String()); |
| 178 | 181 |
| 179 void setResourcesDataSizeLimits(size_t maximumResourcesContentSize, size_t m
aximumSingleResourceContentSize); | 182 void setResourcesDataSizeLimits(size_t maximumResourcesContentSize, size_t m
aximumSingleResourceContentSize); |
| 180 void setXHRReplayData(const String& requestId, XHRReplayData*); | 183 void setXHRReplayData(const String& requestId, XHRReplayData*); |
| 181 XHRReplayData* xhrReplayData(const String& requestId); | 184 XHRReplayData* xhrReplayData(const String& requestId); |
| 182 Vector<ResourceData*> resources(); | 185 WillBeHeapVector<RawPtrWillBeMember<ResourceData>> resources(); |
| 183 | 186 |
| 187 DECLARE_TRACE(); |
| 184 private: | 188 private: |
| 189 NetworkResourcesData(); |
| 190 |
| 185 ResourceData* resourceDataForRequestId(const String& requestId); | 191 ResourceData* resourceDataForRequestId(const String& requestId); |
| 186 void ensureNoDataForRequestId(const String& requestId); | 192 void ensureNoDataForRequestId(const String& requestId); |
| 187 bool ensureFreeSpace(size_t); | 193 bool ensureFreeSpace(size_t); |
| 188 | 194 |
| 189 Deque<String> m_requestIdsDeque; | 195 Deque<String> m_requestIdsDeque; |
| 190 | 196 |
| 191 typedef HashMap<String, String> ReusedRequestIds; | 197 typedef HashMap<String, String> ReusedRequestIds; |
| 192 ReusedRequestIds m_reusedXHRReplayDataRequestIds; | 198 ReusedRequestIds m_reusedXHRReplayDataRequestIds; |
| 193 typedef HashMap<String, ResourceData*> ResourceDataMap; | 199 typedef WillBeHeapHashMap<String, RawPtrWillBeMember<ResourceData>> Resource
DataMap; |
| 194 ResourceDataMap m_requestIdToResourceDataMap; | 200 ResourceDataMap m_requestIdToResourceDataMap; |
| 195 size_t m_contentSize; | 201 size_t m_contentSize; |
| 196 size_t m_maximumResourcesContentSize; | 202 size_t m_maximumResourcesContentSize; |
| 197 size_t m_maximumSingleResourceContentSize; | 203 size_t m_maximumSingleResourceContentSize; |
| 198 }; | 204 }; |
| 199 | 205 |
| 200 } // namespace blink | 206 } // namespace blink |
| 201 | 207 |
| 202 | 208 |
| 203 #endif // !defined(NetworkResourcesData_h) | 209 #endif // !defined(NetworkResourcesData_h) |
| OLD | NEW |