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

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

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 { 317 {
318 while (!m_clients.isEmpty()) { 318 while (!m_clients.isEmpty()) {
319 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin(); 319 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin();
320 for (int i = it->value; i; i--) { 320 for (int i = it->value; i; i--) {
321 m_finishedClients.add(it->key); 321 m_finishedClients.add(it->key);
322 m_clients.remove(it); 322 m_clients.remove(it);
323 } 323 }
324 } 324 }
325 } 325 }
326 326
327 void Resource::error(Resource::Status status) 327 void Resource::error(const ResourceError& error)
328 { 328 {
329 ASSERT(!error.isNull());
330 m_error = error;
329 if (!m_revalidatingRequest.isNull()) 331 if (!m_revalidatingRequest.isNull())
330 m_revalidatingRequest = ResourceRequest(); 332 m_revalidatingRequest = ResourceRequest();
331 333
332 if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded())) 334 if (m_error.isCancellation() || !isPreloaded())
333 memoryCache()->remove(this); 335 memoryCache()->remove(this);
334 336
335 setStatus(status); 337 setStatus(LoadError);
336 ASSERT(errorOccurred()); 338 ASSERT(errorOccurred());
337 m_data.clear(); 339 m_data.clear();
338 checkNotify(); 340 checkNotify();
339 markClientsAndObserversFinished(); 341 markClientsAndObserversFinished();
340 } 342 }
341 343
342 void Resource::finish() 344 void Resource::finish(double loadFinishTime)
343 { 345 {
344 ASSERT(m_revalidatingRequest.isNull()); 346 ASSERT(m_revalidatingRequest.isNull());
347 m_loadFinishTime = loadFinishTime;
345 if (!errorOccurred()) 348 if (!errorOccurred())
yhirano 2016/05/02 09:31:34 The CL description suggests we can make this branc
Nate Chapin 2016/05/02 19:32:24 I don't think it's guaranteed, because a DecodeErr
346 m_status = Cached; 349 m_status = Cached;
347 checkNotify(); 350 checkNotify();
348 markClientsAndObserversFinished(); 351 markClientsAndObserversFinished();
349 } 352 }
350 353
351 AtomicString Resource::httpContentType() const 354 AtomicString Resource::httpContentType() const
352 { 355 {
353 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower()); 356 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower());
354 } 357 }
355 358
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 case Resource::Media: 1077 case Resource::Media:
1075 return "Media"; 1078 return "Media";
1076 case Resource::Manifest: 1079 case Resource::Manifest:
1077 return "Manifest"; 1080 return "Manifest";
1078 } 1081 }
1079 ASSERT_NOT_REACHED(); 1082 ASSERT_NOT_REACHED();
1080 return "Unknown"; 1083 return "Unknown";
1081 } 1084 }
1082 1085
1083 } // namespace blink 1086 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698