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

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

Issue 1710733002: Move multipart resource handling to core/fetch (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup
Patch Set: Created 4 years, 9 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 ResourceClientWalker<ResourceClient> w(m_clients); 243 ResourceClientWalker<ResourceClient> w(m_clients);
244 while (ResourceClient* c = w.next()) 244 while (ResourceClient* c = w.next())
245 c->notifyFinished(this); 245 c->notifyFinished(this);
246 } 246 }
247 247
248 void Resource::appendData(const char* data, size_t length) 248 void Resource::appendData(const char* data, size_t length)
249 { 249 {
250 TRACE_EVENT0("blink", "Resource::appendData"); 250 TRACE_EVENT0("blink", "Resource::appendData");
251 ASSERT(m_revalidatingRequest.isNull()); 251 ASSERT(m_revalidatingRequest.isNull());
252 ASSERT(!errorOccurred()); 252 ASSERT(!errorOccurred());
hiroshige 2016/03/01 22:34:24 This assertion fails on mac bots in layout test ht
yhirano 2016/03/02 00:32:10 Nice catch! Fixed.
253 if (m_options.dataBufferingPolicy == DoNotBufferData) 253 if (m_options.dataBufferingPolicy == DoNotBufferData)
254 return; 254 return;
255 if (m_data) 255 if (m_data)
256 m_data->append(data, length); 256 m_data->append(data, length);
257 else 257 else
258 m_data = SharedBuffer::createPurgeable(data, length); 258 m_data = SharedBuffer::createPurgeable(data, length);
259 setEncodedSize(m_data->size()); 259 setEncodedSize(m_data->size());
260 } 260 }
261 261
262 void Resource::setResourceBuffer(PassRefPtr<SharedBuffer> resourceBuffer) 262 void Resource::setResourceBuffer(PassRefPtr<SharedBuffer> resourceBuffer)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 setStatus(status); 297 setStatus(status);
298 ASSERT(errorOccurred()); 298 ASSERT(errorOccurred());
299 m_data.clear(); 299 m_data.clear();
300 300
301 setLoading(false); 301 setLoading(false);
302 checkNotify(); 302 checkNotify();
303 markClientsFinished(); 303 markClientsFinished();
304 } 304 }
305 305
306 void Resource::finishOnePart()
307 {
308 setLoading(false);
309 checkNotify();
310 }
311
312 void Resource::finish() 306 void Resource::finish()
313 { 307 {
314 ASSERT(m_revalidatingRequest.isNull()); 308 ASSERT(m_revalidatingRequest.isNull());
315 ASSERT(!errorOccurred()); 309 setLoading(false);
316 finishOnePart(); 310 checkNotify();
317 markClientsFinished(); 311 markClientsFinished();
318 if (!errorOccurred()) 312 if (!errorOccurred())
319 m_status = Cached; 313 m_status = Cached;
320 } 314 }
321 315
322 AtomicString Resource::httpContentType() const 316 AtomicString Resource::httpContentType() const
323 { 317 {
324 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower()); 318 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower());
325 } 319 }
326 320
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 { 449 {
456 m_responseTimestamp = currentTime(); 450 m_responseTimestamp = currentTime();
457 451
458 if (!m_revalidatingRequest.isNull()) { 452 if (!m_revalidatingRequest.isNull()) {
459 if (response.httpStatusCode() == 304) { 453 if (response.httpStatusCode() == 304) {
460 revalidationSucceeded(response); 454 revalidationSucceeded(response);
461 return; 455 return;
462 } 456 }
463 revalidationFailed(); 457 revalidationFailed();
464 } 458 }
465
466 setResponse(response); 459 setResponse(response);
467 String encoding = response.textEncodingName(); 460 String encoding = response.textEncodingName();
468 if (!encoding.isNull()) 461 if (!encoding.isNull())
469 setEncoding(encoding); 462 setEncoding(encoding);
470 } 463 }
471 464
472 void Resource::setSerializedCachedMetadata(const char* data, size_t size) 465 void Resource::setSerializedCachedMetadata(const char* data, size_t size)
473 { 466 {
474 // We only expect to receive cached metadata from the platform once. 467 // We only expect to receive cached metadata from the platform once.
475 // If this triggers, it indicates an efficiency problem which is most 468 // If this triggers, it indicates an efficiency problem which is most
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 case Resource::Media: 1110 case Resource::Media:
1118 return "Media"; 1111 return "Media";
1119 case Resource::Manifest: 1112 case Resource::Manifest:
1120 return "Manifest"; 1113 return "Manifest";
1121 } 1114 }
1122 ASSERT_NOT_REACHED(); 1115 ASSERT_NOT_REACHED();
1123 return "Unknown"; 1116 return "Unknown";
1124 } 1117 }
1125 1118
1126 } // namespace blink 1119 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698