OLD | NEW |
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 setEncodedSize(m_data->size()); | 327 setEncodedSize(m_data->size()); |
328 } | 328 } |
329 | 329 |
330 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) | 330 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) |
331 { | 331 { |
332 m_options.dataBufferingPolicy = dataBufferingPolicy; | 332 m_options.dataBufferingPolicy = dataBufferingPolicy; |
333 m_data.clear(); | 333 m_data.clear(); |
334 setEncodedSize(0); | 334 setEncodedSize(0); |
335 } | 335 } |
336 | 336 |
337 void Resource::markClientsFinished() | 337 void Resource::markClientsAndObserversFinished() |
338 { | 338 { |
339 while (!m_clients.isEmpty()) { | 339 while (!m_clients.isEmpty()) { |
340 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin(); | 340 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin(); |
341 for (int i = it->value; i; i--) { | 341 for (int i = it->value; i; i--) { |
342 m_finishedClients.add(it->key); | 342 m_finishedClients.add(it->key); |
343 m_clients.remove(it); | 343 m_clients.remove(it); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 void Resource::error(Resource::Status status) | 348 void Resource::error(Resource::Status status) |
349 { | 349 { |
350 if (!m_revalidatingRequest.isNull()) | 350 if (!m_revalidatingRequest.isNull()) |
351 m_revalidatingRequest = ResourceRequest(); | 351 m_revalidatingRequest = ResourceRequest(); |
352 | 352 |
353 if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded())) | 353 if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded())) |
354 memoryCache()->remove(this); | 354 memoryCache()->remove(this); |
355 | 355 |
356 setStatus(status); | 356 setStatus(status); |
357 ASSERT(errorOccurred()); | 357 ASSERT(errorOccurred()); |
358 m_data.clear(); | 358 m_data.clear(); |
359 checkNotify(); | 359 checkNotify(); |
360 markClientsFinished(); | 360 markClientsAndObserversFinished(); |
361 } | 361 } |
362 | 362 |
363 void Resource::finish() | 363 void Resource::finish() |
364 { | 364 { |
365 ASSERT(m_revalidatingRequest.isNull()); | 365 ASSERT(m_revalidatingRequest.isNull()); |
366 if (!errorOccurred()) | 366 if (!errorOccurred()) |
367 m_status = Cached; | 367 m_status = Cached; |
368 checkNotify(); | 368 checkNotify(); |
369 markClientsFinished(); | 369 markClientsAndObserversFinished(); |
370 } | 370 } |
371 | 371 |
372 AtomicString Resource::httpContentType() const | 372 AtomicString Resource::httpContentType() const |
373 { | 373 { |
374 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co
ntent_Type).lower()); | 374 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co
ntent_Type).lower()); |
375 } | 375 } |
376 | 376 |
377 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const | 377 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const |
378 { | 378 { |
379 String ignoredErrorDescription; | 379 String ignoredErrorDescription; |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 case Resource::Media: | 1100 case Resource::Media: |
1101 return "Media"; | 1101 return "Media"; |
1102 case Resource::Manifest: | 1102 case Resource::Manifest: |
1103 return "Manifest"; | 1103 return "Manifest"; |
1104 } | 1104 } |
1105 ASSERT_NOT_REACHED(); | 1105 ASSERT_NOT_REACHED(); |
1106 return "Unknown"; | 1106 return "Unknown"; |
1107 } | 1107 } |
1108 | 1108 |
1109 } // namespace blink | 1109 } // namespace blink |
OLD | NEW |