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

Side by Side Diff: Source/core/inspector/NetworkResourcesData.cpp

Issue 74493002: Removed refcounting from TextResourceDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_step2
Patch Set: Compile fix Created 7 years, 1 month 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 | « Source/core/inspector/NetworkResourcesData.h ('k') | Source/core/loader/DocumentWriter.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 * 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 { 148 {
149 clear(); 149 clear();
150 } 150 }
151 151
152 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId) 152 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId)
153 { 153 {
154 ensureNoDataForRequestId(requestId); 154 ensureNoDataForRequestId(requestId);
155 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId)); 155 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId));
156 } 156 }
157 157
158 static PassRefPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName) 158 static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName)
159 { 159 {
160 RefPtr<TextResourceDecoder> decoder; 160 OwnPtr<TextResourceDecoder> decoder;
161 if (!textEncodingName.isEmpty()) 161 if (!textEncodingName.isEmpty())
162 decoder = TextResourceDecoder::create("text/plain", textEncodingName); 162 decoder = TextResourceDecoder::create("text/plain", textEncodingName);
163 else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) { 163 else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) {
164 decoder = TextResourceDecoder::create("application/xml"); 164 decoder = TextResourceDecoder::create("application/xml");
165 decoder->useLenientXMLDecoding(); 165 decoder->useLenientXMLDecoding();
166 } else if (equalIgnoringCase(mimeType, "text/html")) 166 } else if (equalIgnoringCase(mimeType, "text/html"))
167 decoder = TextResourceDecoder::create("text/html", "UTF-8"); 167 decoder = TextResourceDecoder::create("text/html", "UTF-8");
168 else if (mimeType == "text/plain") 168 else if (mimeType == "text/plain")
169 decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1"); 169 decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
170 return decoder; 170 return decoder.release();
171 } 171 }
172 172
173 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response) 173 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response)
174 { 174 {
175 ResourceData* resourceData = resourceDataForRequestId(requestId); 175 ResourceData* resourceData = resourceDataForRequestId(requestId);
176 if (!resourceData) 176 if (!resourceData)
177 return; 177 return;
178 resourceData->setFrameId(frameId); 178 resourceData->setFrameId(frameId);
179 resourceData->setUrl(response.url()); 179 resourceData->setUrl(response.url());
180 resourceData->setDecoder(createOtherResourceTextDecoder(response.mimeType(), response.textEncodingName())); 180 resourceData->setDecoder(createOtherResourceTextDecoder(response.mimeType(), response.textEncodingName()));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 String requestId = m_requestIdsDeque.takeFirst(); 389 String requestId = m_requestIdsDeque.takeFirst();
390 ResourceData* resourceData = resourceDataForRequestId(requestId); 390 ResourceData* resourceData = resourceDataForRequestId(requestId);
391 if (resourceData) 391 if (resourceData)
392 m_contentSize -= resourceData->evictContent(); 392 m_contentSize -= resourceData->evictContent();
393 } 393 }
394 return true; 394 return true;
395 } 395 }
396 396
397 } // namespace WebCore 397 } // namespace WebCore
398 398
OLDNEW
« no previous file with comments | « Source/core/inspector/NetworkResourcesData.h ('k') | Source/core/loader/DocumentWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698