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

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

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 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 | Annotate | Revision Log
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 "NetworkResourcesData.h" 30 #include "NetworkResourcesData.h"
31 31
32 #include "CachedResource.h" 32 #include "CachedResource.h"
33 #include "DOMImplementation.h" 33 #include "DOMImplementation.h"
34 #include "ResourceResponse.h" 34 #include "ResourceResponse.h"
35 #include "SharedBuffer.h" 35 #include "SharedBuffer.h"
36 #include "TextResourceDecoder.h" 36 #include "TextResourceDecoder.h"
37 #include <wtf/MemoryInstrumentationHashMap.h>
38 37
39 namespace { 38 namespace {
40 // 100MB 39 // 100MB
41 static size_t maximumResourcesContentSize = 100 * 1000 * 1000; 40 static size_t maximumResourcesContentSize = 100 * 1000 * 1000;
42 41
43 // 10MB 42 // 10MB
44 static size_t maximumSingleResourceContentSize = 10 * 1000 * 1000; 43 static size_t maximumSingleResourceContentSize = 10 * 1000 * 1000;
45 } 44 }
46 45
47 namespace WebCore { 46 namespace WebCore {
(...skipping 11 matching lines...) Expand all
59 58
60 XHRReplayData::XHRReplayData(const String &method, const KURL& url, bool async, PassRefPtr<FormData> formData, bool includeCredentials) 59 XHRReplayData::XHRReplayData(const String &method, const KURL& url, bool async, PassRefPtr<FormData> formData, bool includeCredentials)
61 : m_method(method) 60 : m_method(method)
62 , m_url(url) 61 , m_url(url)
63 , m_async(async) 62 , m_async(async)
64 , m_formData(formData) 63 , m_formData(formData)
65 , m_includeCredentials(includeCredentials) 64 , m_includeCredentials(includeCredentials)
66 { 65 {
67 } 66 }
68 67
69 void XHRReplayData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
70 {
71 MemoryClassInfo info(memoryObjectInfo, this);
72 info.addMember(m_method, "method");
73 info.addMember(m_url, "url");
74 info.addMember(m_formData, "formData");
75 info.addMember(m_headers, "headers");
76 }
77
78 // ResourceData 68 // ResourceData
79 NetworkResourcesData::ResourceData::ResourceData(const String& requestId, const String& loaderId) 69 NetworkResourcesData::ResourceData::ResourceData(const String& requestId, const String& loaderId)
80 : m_requestId(requestId) 70 : m_requestId(requestId)
81 , m_loaderId(loaderId) 71 , m_loaderId(loaderId)
82 , m_base64Encoded(false) 72 , m_base64Encoded(false)
83 , m_isContentEvicted(false) 73 , m_isContentEvicted(false)
84 , m_type(InspectorPageAgent::OtherResource) 74 , m_type(InspectorPageAgent::OtherResource)
85 , m_cachedResource(0) 75 , m_cachedResource(0)
86 { 76 {
87 } 77 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 size_t NetworkResourcesData::ResourceData::decodeDataToContent() 129 size_t NetworkResourcesData::ResourceData::decodeDataToContent()
140 { 130 {
141 ASSERT(!hasContent()); 131 ASSERT(!hasContent());
142 size_t dataLength = m_dataBuffer->size(); 132 size_t dataLength = m_dataBuffer->size();
143 m_content = m_decoder->decode(m_dataBuffer->data(), m_dataBuffer->size()); 133 m_content = m_decoder->decode(m_dataBuffer->data(), m_dataBuffer->size());
144 m_content.append(m_decoder->flush()); 134 m_content.append(m_decoder->flush());
145 m_dataBuffer = nullptr; 135 m_dataBuffer = nullptr;
146 return contentSizeInBytes(m_content) - dataLength; 136 return contentSizeInBytes(m_content) - dataLength;
147 } 137 }
148 138
149 void NetworkResourcesData::ResourceData::reportMemoryUsage(MemoryObjectInfo* mem oryObjectInfo) const
150 {
151 MemoryClassInfo info(memoryObjectInfo, this);
152 info.addMember(m_requestId, "requestId");
153 info.addMember(m_loaderId, "loaderId");
154 info.addMember(m_frameId, "frameId");
155 info.addMember(m_url, "url");
156 info.addMember(m_content, "content");
157 info.addMember(m_xhrReplayData, "xhrReplayData");
158 info.addMember(m_dataBuffer, "dataBuffer");
159 info.addMember(m_textEncodingName, "textEncodingName");
160 info.addMember(m_decoder, "decoder");
161 info.addMember(m_buffer, "buffer");
162 info.addMember(m_cachedResource, "cachedResource");
163 }
164
165 // NetworkResourcesData 139 // NetworkResourcesData
166 NetworkResourcesData::NetworkResourcesData() 140 NetworkResourcesData::NetworkResourcesData()
167 : m_contentSize(0) 141 : m_contentSize(0)
168 , m_maximumResourcesContentSize(maximumResourcesContentSize) 142 , m_maximumResourcesContentSize(maximumResourcesContentSize)
169 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize) 143 , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize)
170 { 144 {
171 } 145 }
172 146
173 NetworkResourcesData::~NetworkResourcesData() 147 NetworkResourcesData::~NetworkResourcesData()
174 { 148 {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 379
406 while (size > m_maximumResourcesContentSize - m_contentSize) { 380 while (size > m_maximumResourcesContentSize - m_contentSize) {
407 String requestId = m_requestIdsDeque.takeFirst(); 381 String requestId = m_requestIdsDeque.takeFirst();
408 ResourceData* resourceData = resourceDataForRequestId(requestId); 382 ResourceData* resourceData = resourceDataForRequestId(requestId);
409 if (resourceData) 383 if (resourceData)
410 m_contentSize -= resourceData->evictContent(); 384 m_contentSize -= resourceData->evictContent();
411 } 385 }
412 return true; 386 return true;
413 } 387 }
414 388
415 void NetworkResourcesData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
416 {
417 MemoryClassInfo info(memoryObjectInfo, this);
418 info.addMember(m_requestIdsDeque, "requestIdsDeque");
419 info.addMember(m_reusedXHRReplayDataRequestIds, "reusedXHRReplayDataRequestI ds");
420 info.addMember(m_requestIdToResourceDataMap, "requestIdToResourceDataMap");
421 }
422
423 } // namespace WebCore 389 } // namespace WebCore
424 390
OLDNEW
« no previous file with comments | « Source/core/inspector/NetworkResourcesData.h ('k') | Source/core/inspector/ScriptDebugListener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698