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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 String filePath = response.downloadedFilePath(); 182 String filePath = response.downloadedFilePath();
183 if (!filePath.isEmpty()) { 183 if (!filePath.isEmpty()) {
184 OwnPtr<BlobData> blobData = BlobData::create(); 184 OwnPtr<BlobData> blobData = BlobData::create();
185 blobData->appendFile(filePath); 185 blobData->appendFile(filePath);
186 AtomicString mimeType; 186 AtomicString mimeType;
187 if (response.isHTTP()) 187 if (response.isHTTP())
188 mimeType = extractMIMETypeFromMediaType(response.httpHeaderField(HTT PNames::Content_Type)); 188 mimeType = extractMIMETypeFromMediaType(response.httpHeaderField(HTT PNames::Content_Type));
189 if (mimeType.isEmpty()) 189 if (mimeType.isEmpty())
190 mimeType = response.mimeType(); 190 mimeType = response.mimeType();
191 if (mimeType.isEmpty()) 191 if (mimeType.isEmpty())
192 mimeType = AtomicString("text/plain", AtomicString::ConstructFromLit eral); 192 mimeType = AtomicString("text/plain");
193 blobData->setContentType(mimeType); 193 blobData->setContentType(mimeType);
194 resourceData->setDownloadedFileBlob(BlobDataHandle::create(blobData.rele ase(), -1)); 194 resourceData->setDownloadedFileBlob(BlobDataHandle::create(blobData.rele ase(), -1));
195 } 195 }
196 } 196 }
197 197
198 void NetworkResourcesData::setResourceType(const String& requestId, InspectorPag eAgent::ResourceType type) 198 void NetworkResourcesData::setResourceType(const String& requestId, InspectorPag eAgent::ResourceType type)
199 { 199 {
200 ResourceData* resourceData = resourceDataForRequestId(requestId); 200 ResourceData* resourceData = resourceDataForRequestId(requestId);
201 if (!resourceData) 201 if (!resourceData)
202 return; 202 return;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 while (size > m_maximumResourcesContentSize - m_contentSize) { 382 while (size > m_maximumResourcesContentSize - m_contentSize) {
383 String requestId = m_requestIdsDeque.takeFirst(); 383 String requestId = m_requestIdsDeque.takeFirst();
384 ResourceData* resourceData = resourceDataForRequestId(requestId); 384 ResourceData* resourceData = resourceDataForRequestId(requestId);
385 if (resourceData) 385 if (resourceData)
386 m_contentSize -= resourceData->evictContent(); 386 m_contentSize -= resourceData->evictContent();
387 } 387 }
388 return true; 388 return true;
389 } 389 }
390 390
391 } // namespace blink 391 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698