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

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

Issue 1436793002: Oilpan: move NetworkResourcesData to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « third_party/WebKit/Source/core/inspector/NetworkResourcesData.h ('k') | no next file » | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 : m_requestId(requestId) 75 : m_requestId(requestId)
76 , m_loaderId(loaderId) 76 , m_loaderId(loaderId)
77 , m_base64Encoded(false) 77 , m_base64Encoded(false)
78 , m_isContentEvicted(false) 78 , m_isContentEvicted(false)
79 , m_type(InspectorPageAgent::OtherResource) 79 , m_type(InspectorPageAgent::OtherResource)
80 , m_httpStatusCode(0) 80 , m_httpStatusCode(0)
81 , m_cachedResource(nullptr) 81 , m_cachedResource(nullptr)
82 { 82 {
83 } 83 }
84 84
85 DEFINE_TRACE(NetworkResourcesData::ResourceData)
86 {
87 visitor->trace(m_xhrReplayData);
88 visitor->trace(m_cachedResource);
89 }
90
85 void NetworkResourcesData::ResourceData::setContent(const String& content, bool base64Encoded) 91 void NetworkResourcesData::ResourceData::setContent(const String& content, bool base64Encoded)
86 { 92 {
87 ASSERT(!hasData()); 93 ASSERT(!hasData());
88 ASSERT(!hasContent()); 94 ASSERT(!hasContent());
89 m_content = content; 95 m_content = content;
90 m_base64Encoded = base64Encoded; 96 m_base64Encoded = base64Encoded;
91 } 97 }
92 98
93 static size_t contentSizeInBytes(const String& content) 99 static size_t contentSizeInBytes(const String& content)
94 { 100 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // NetworkResourcesData 151 // NetworkResourcesData
146 NetworkResourcesData::NetworkResourcesData() 152 NetworkResourcesData::NetworkResourcesData()
147 : m_contentSize(0) 153 : m_contentSize(0)
148 , m_maximumResourcesContentSize(maximumResourcesContentSize) 154 , m_maximumResourcesContentSize(maximumResourcesContentSize)
149 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize) 155 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize)
150 { 156 {
151 } 157 }
152 158
153 NetworkResourcesData::~NetworkResourcesData() 159 NetworkResourcesData::~NetworkResourcesData()
154 { 160 {
155 clear(); 161 clear();
haraken 2015/11/11 10:11:27 It seems this destructor touches m_requestIdToReso
sof 2015/11/11 10:13:25 Quite right, didn't catch that in ps#1. No need to
156 } 162 }
157 163
164 DEFINE_TRACE(NetworkResourcesData)
165 {
166 visitor->trace(m_requestIdToResourceDataMap);
167 }
168
158 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId) 169 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId)
159 { 170 {
160 ensureNoDataForRequestId(requestId); 171 ensureNoDataForRequestId(requestId);
161 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId)); 172 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId));
162 } 173 }
163 174
164 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response) 175 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response)
165 { 176 {
166 ResourceData* resourceData = resourceDataForRequestId(requestId); 177 ResourceData* resourceData = resourceDataForRequestId(requestId);
167 if (!resourceData) 178 if (!resourceData)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 for (auto& request : m_reusedXHRReplayDataRequestIds) { 299 for (auto& request : m_reusedXHRReplayDataRequestIds) {
289 if (request.value == requestId) 300 if (request.value == requestId)
290 setXHRReplayData(request.key, xhrReplayData); 301 setXHRReplayData(request.key, xhrReplayData);
291 } 302 }
292 return; 303 return;
293 } 304 }
294 305
295 resourceData->setXHRReplayData(xhrReplayData); 306 resourceData->setXHRReplayData(xhrReplayData);
296 } 307 }
297 308
298 Vector<NetworkResourcesData::ResourceData*> NetworkResourcesData::resources() 309 WillBeHeapVector<RawPtrWillBeMember<NetworkResourcesData::ResourceData>> Network ResourcesData::resources()
299 { 310 {
300 Vector<ResourceData*> result; 311 WillBeHeapVector<RawPtrWillBeMember<ResourceData>> result;
301 for (auto& request : m_requestIdToResourceDataMap) 312 for (auto& request : m_requestIdToResourceDataMap)
302 result.append(request.value); 313 result.append(request.value);
303 return result; 314 return result;
304 } 315 }
305 316
306 Vector<String> NetworkResourcesData::removeResource(Resource* cachedResource) 317 Vector<String> NetworkResourcesData::removeResource(Resource* cachedResource)
307 { 318 {
308 Vector<String> result; 319 Vector<String> result;
309 for (auto& request : m_requestIdToResourceDataMap) { 320 for (auto& request : m_requestIdToResourceDataMap) {
310 ResourceData* resourceData = request.value; 321 ResourceData* resourceData = request.value;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 while (size > m_maximumResourcesContentSize - m_contentSize) { 382 while (size > m_maximumResourcesContentSize - m_contentSize) {
372 String requestId = m_requestIdsDeque.takeFirst(); 383 String requestId = m_requestIdsDeque.takeFirst();
373 ResourceData* resourceData = resourceDataForRequestId(requestId); 384 ResourceData* resourceData = resourceDataForRequestId(requestId);
374 if (resourceData) 385 if (resourceData)
375 m_contentSize -= resourceData->evictContent(); 386 m_contentSize -= resourceData->evictContent();
376 } 387 }
377 return true; 388 return true;
378 } 389 }
379 390
380 } // namespace blink 391 } // namespace blink
381
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/NetworkResourcesData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698