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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 1843533005: Call imageNotifyFinished() just before ResourceClient::notifyFinished() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 setEncodedSize(m_data->size()); 260 setEncodedSize(m_data->size());
261 } 261 }
262 262
263 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) 263 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy)
264 { 264 {
265 m_options.dataBufferingPolicy = dataBufferingPolicy; 265 m_options.dataBufferingPolicy = dataBufferingPolicy;
266 m_data.clear(); 266 m_data.clear();
267 setEncodedSize(0); 267 setEncodedSize(0);
268 } 268 }
269 269
270 void Resource::markClientsFinished() 270 void Resource::markClientsAndObserversFinished()
271 { 271 {
272 while (!m_clients.isEmpty()) { 272 while (!m_clients.isEmpty()) {
273 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin(); 273 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin();
274 for (int i = it->value; i; i--) { 274 for (int i = it->value; i; i--) {
275 m_finishedClients.add(it->key); 275 m_finishedClients.add(it->key);
276 m_clients.remove(it); 276 m_clients.remove(it);
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 void Resource::error(Resource::Status status) 281 void Resource::error(Resource::Status status)
282 { 282 {
283 if (!m_revalidatingRequest.isNull()) 283 if (!m_revalidatingRequest.isNull())
284 m_revalidatingRequest = ResourceRequest(); 284 m_revalidatingRequest = ResourceRequest();
285 285
286 if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded())) 286 if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded()))
287 memoryCache()->remove(this); 287 memoryCache()->remove(this);
288 288
289 setStatus(status); 289 setStatus(status);
290 ASSERT(errorOccurred()); 290 ASSERT(errorOccurred());
291 m_data.clear(); 291 m_data.clear();
292 checkNotify(); 292 checkNotify();
293 markClientsFinished(); 293 markClientsAndObserversFinished();
294 } 294 }
295 295
296 void Resource::finish() 296 void Resource::finish()
297 { 297 {
298 ASSERT(m_revalidatingRequest.isNull()); 298 ASSERT(m_revalidatingRequest.isNull());
299 if (!errorOccurred()) 299 if (!errorOccurred())
300 m_status = Cached; 300 m_status = Cached;
301 checkNotify(); 301 checkNotify();
302 markClientsFinished(); 302 markClientsAndObserversFinished();
303 } 303 }
304 304
305 AtomicString Resource::httpContentType() const 305 AtomicString Resource::httpContentType() const
306 { 306 {
307 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower()); 307 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower());
308 } 308 }
309 309
310 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const 310 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const
311 { 311 {
312 String ignoredErrorDescription; 312 String ignoredErrorDescription;
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 case Resource::Media: 1087 case Resource::Media:
1088 return "Media"; 1088 return "Media";
1089 case Resource::Manifest: 1089 case Resource::Manifest:
1090 return "Manifest"; 1090 return "Manifest";
1091 } 1091 }
1092 ASSERT_NOT_REACHED(); 1092 ASSERT_NOT_REACHED();
1093 return "Unknown"; 1093 return "Unknown";
1094 } 1094 }
1095 1095
1096 } // namespace blink 1096 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698