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

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

Issue 124943003: Remove 'String::append' from some of the blink source. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporated review comments Created 6 years, 11 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 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/inspector/NetworkResourcesData.h" 30 #include "core/inspector/NetworkResourcesData.h"
31 31
32 #include "core/dom/DOMImplementation.h" 32 #include "core/dom/DOMImplementation.h"
33 #include "core/fetch/Resource.h" 33 #include "core/fetch/Resource.h"
34 #include "platform/MIMETypeRegistry.h" 34 #include "platform/MIMETypeRegistry.h"
35 #include "platform/SharedBuffer.h" 35 #include "platform/SharedBuffer.h"
36 #include "platform/network/ResourceResponse.h" 36 #include "platform/network/ResourceResponse.h"
37 #include "wtf/text/StringBuilder.h"
37 38
38 namespace { 39 namespace {
39 // 100MB 40 // 100MB
40 static size_t maximumResourcesContentSize = 100 * 1000 * 1000; 41 static size_t maximumResourcesContentSize = 100 * 1000 * 1000;
41 42
42 // 10MB 43 // 10MB
43 static size_t maximumSingleResourceContentSize = 10 * 1000 * 1000; 44 static size_t maximumSingleResourceContentSize = 10 * 1000 * 1000;
44 } 45 }
45 46
46 namespace WebCore { 47 namespace WebCore {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (!m_dataBuffer) 124 if (!m_dataBuffer)
124 m_dataBuffer = SharedBuffer::create(data, dataLength); 125 m_dataBuffer = SharedBuffer::create(data, dataLength);
125 else 126 else
126 m_dataBuffer->append(data, dataLength); 127 m_dataBuffer->append(data, dataLength);
127 } 128 }
128 129
129 size_t NetworkResourcesData::ResourceData::decodeDataToContent() 130 size_t NetworkResourcesData::ResourceData::decodeDataToContent()
130 { 131 {
131 ASSERT(!hasContent()); 132 ASSERT(!hasContent());
132 size_t dataLength = m_dataBuffer->size(); 133 size_t dataLength = m_dataBuffer->size();
133 m_content = m_decoder->decode(m_dataBuffer->data(), m_dataBuffer->size()); 134 StringBuilder content;
134 m_content.append(m_decoder->flush()); 135 content.append(m_decoder->decode(m_dataBuffer->data(), m_dataBuffer->size()) );
136 content.append(m_decoder->flush());
137 m_content = content.toString();
135 m_dataBuffer = nullptr; 138 m_dataBuffer = nullptr;
136 return contentSizeInBytes(m_content) - dataLength; 139 return contentSizeInBytes(m_content) - dataLength;
137 } 140 }
138 141
139 // NetworkResourcesData 142 // NetworkResourcesData
140 NetworkResourcesData::NetworkResourcesData() 143 NetworkResourcesData::NetworkResourcesData()
141 : m_contentSize(0) 144 : m_contentSize(0)
142 , m_maximumResourcesContentSize(maximumResourcesContentSize) 145 , m_maximumResourcesContentSize(maximumResourcesContentSize)
143 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize) 146 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize)
144 { 147 {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 String requestId = m_requestIdsDeque.takeFirst(); 398 String requestId = m_requestIdsDeque.takeFirst();
396 ResourceData* resourceData = resourceDataForRequestId(requestId); 399 ResourceData* resourceData = resourceDataForRequestId(requestId);
397 if (resourceData) 400 if (resourceData)
398 m_contentSize -= resourceData->evictContent(); 401 m_contentSize -= resourceData->evictContent();
399 } 402 }
400 return true; 403 return true;
401 } 404 }
402 405
403 } // namespace WebCore 406 } // namespace WebCore
404 407
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698