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

Side by Side Diff: Source/WebCore/loader/cache/CachedRawResource.cpp

Issue 11571073: Merge 138174 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years 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/WebCore/loader/ResourceLoader.cpp ('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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 size_t incrementalDataLength = 0; 49 size_t incrementalDataLength = 0;
50 if (data) { 50 if (data) {
51 // If we are buffering data, then we are saving the buffer in m_data and need to manually 51 // If we are buffering data, then we are saving the buffer in m_data and need to manually
52 // calculate the incremental data. If we are not buffering, then m_data will be null and 52 // calculate the incremental data. If we are not buffering, then m_data will be null and
53 // the buffer contains only the incremental data. 53 // the buffer contains only the incremental data.
54 size_t previousDataLength = (m_options.shouldBufferData == BufferData) ? encodedSize() : 0; 54 size_t previousDataLength = (m_options.shouldBufferData == BufferData) ? encodedSize() : 0;
55 ASSERT(data->size() >= previousDataLength); 55 ASSERT(data->size() >= previousDataLength);
56 incrementalData = data->data() + previousDataLength; 56 incrementalData = data->data() + previousDataLength;
57 incrementalDataLength = data->size() - previousDataLength; 57 incrementalDataLength = data->size() - previousDataLength;
58 } 58 }
59 59
60 if (m_options.shouldBufferData == BufferData) { 60 if (m_options.shouldBufferData == BufferData) {
61 if (data) 61 if (data)
62 setEncodedSize(data->size()); 62 setEncodedSize(data->size());
63 m_data = data; 63 m_data = data;
64 } 64 }
65 65
66 DataBufferingPolicy dataBufferingPolicy = m_options.shouldBufferData;
66 if (incrementalDataLength) { 67 if (incrementalDataLength) {
67 CachedResourceClientWalker<CachedRawResourceClient> w(m_clients); 68 CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
68 while (CachedRawResourceClient* c = w.next()) 69 while (CachedRawResourceClient* c = w.next())
69 c->dataReceived(this, incrementalData, incrementalDataLength); 70 c->dataReceived(this, incrementalData, incrementalDataLength);
70 } 71 }
71 CachedResource::data(m_data, allDataReceived); 72 CachedResource::data(m_data, allDataReceived);
73
74 if (dataBufferingPolicy == BufferData && m_options.shouldBufferData == DoNot BufferData) {
75 if (m_loader)
76 m_loader->setShouldBufferData(DoNotBufferData);
77 clear();
78 }
72 } 79 }
73 80
74 void CachedRawResource::didAddClient(CachedResourceClient* c) 81 void CachedRawResource::didAddClient(CachedResourceClient* c)
75 { 82 {
76 if (m_response.isNull() || !hasClient(c)) 83 if (m_response.isNull() || !hasClient(c))
77 return; 84 return;
78 // The calls to the client can result in events running, potentially causing 85 // The calls to the client can result in events running, potentially causing
79 // this resource to be evicted from the cache and all clients to be removed, 86 // this resource to be evicted from the cache and all clients to be removed,
80 // so a protector is necessary. 87 // so a protector is necessary.
81 CachedResourceHandle<CachedRawResource> protect(this); 88 CachedResourceHandle<CachedRawResource> protect(this);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 211 }
205 212
206 void CachedRawResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co nst 213 void CachedRawResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co nst
207 { 214 {
208 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceRaw); 215 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceRaw);
209 CachedResource::reportMemoryUsage(memoryObjectInfo); 216 CachedResource::reportMemoryUsage(memoryObjectInfo);
210 } 217 }
211 218
212 219
213 } // namespace WebCore 220 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/loader/ResourceLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698