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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 1829803002: [WeakMemoryCache] Do not lookup MemoryCache when adding resource to Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MemoryCache_MakeWeak2d
Patch Set: Do not expose DocumentLoader::mainResource() 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 finishedLoading(m_mainResource->loadFinishTime()); 253 finishedLoading(m_mainResource->loadFinishTime());
254 return; 254 return;
255 } 255 }
256 256
257 if (m_applicationCacheHost) 257 if (m_applicationCacheHost)
258 m_applicationCacheHost->failedLoadingMainResource(); 258 m_applicationCacheHost->failedLoadingMainResource();
259 m_state = MainResourceDone; 259 m_state = MainResourceDone;
260 260
261 // TODO(mkwst): Magic numbers bad. 261 // TODO(mkwst): Magic numbers bad.
262 if (m_mainResource->resourceError().errorCode() == -27) 262 if (m_mainResource->resourceError().errorCode() == -27)
263 InspectorInstrumentation::canceledAfterReceivedResourceResponse(m_frame, this, mainResourceIdentifier(), resource->response()); 263 InspectorInstrumentation::canceledAfterReceivedResourceResponse(m_frame, this, mainResourceIdentifier(), resource->response(), m_mainResource.get());
264 264
265 frameLoader()->loadFailed(this, m_mainResource->resourceError()); 265 frameLoader()->loadFailed(this, m_mainResource->resourceError());
266 clearMainResourceHandle(); 266 clearMainResourceHandle();
267 } 267 }
268 268
269 void DocumentLoader::finishedLoading(double finishTime) 269 void DocumentLoader::finishedLoading(double finishTime)
270 { 270 {
271 ASSERT(!m_frame->page()->defersLoading() || InspectorInstrumentation::isDebu ggerPaused(m_frame)); 271 ASSERT(!m_frame->page()->defersLoading() || InspectorInstrumentation::isDebu ggerPaused(m_frame));
272 272
273 double responseEndTime = finishTime; 273 double responseEndTime = finishTime;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 return false; 350 return false;
351 } 351 }
352 352
353 if (!canShowMIMEType(m_response.mimeType(), m_frame->page())) 353 if (!canShowMIMEType(m_response.mimeType(), m_frame->page()))
354 return false; 354 return false;
355 return true; 355 return true;
356 } 356 }
357 357
358 void DocumentLoader::cancelLoadAfterCSPDenied(const ResourceResponse& response) 358 void DocumentLoader::cancelLoadAfterCSPDenied(const ResourceResponse& response)
359 { 359 {
360 InspectorInstrumentation::canceledAfterReceivedResourceResponse(m_frame, thi s, mainResourceIdentifier(), response); 360 InspectorInstrumentation::canceledAfterReceivedResourceResponse(m_frame, thi s, mainResourceIdentifier(), response, m_mainResource.get());
361 361
362 setWasBlockedAfterCSP(); 362 setWasBlockedAfterCSP();
363 363
364 // Pretend that this was an empty HTTP 200 response. 364 // Pretend that this was an empty HTTP 200 response.
365 clearMainResourceHandle(); 365 clearMainResourceHandle();
366 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String() ); 366 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String() );
367 finishedLoading(monotonicallyIncreasingTime()); 367 finishedLoading(monotonicallyIncreasingTime());
368 368
369 return; 369 return;
370 } 370 }
(...skipping 21 matching lines...) Expand all
392 } 392 }
393 393
394 ASSERT(!m_frame->page()->defersLoading()); 394 ASSERT(!m_frame->page()->defersLoading());
395 395
396 m_response = response; 396 m_response = response;
397 397
398 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->getDataBuffe ringPolicy() != BufferData) 398 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->getDataBuffe ringPolicy() != BufferData)
399 m_mainResource->setDataBufferingPolicy(BufferData); 399 m_mainResource->setDataBufferingPolicy(BufferData);
400 400
401 if (!shouldContinueForResponse()) { 401 if (!shouldContinueForResponse()) {
402 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main Resource->identifier(), m_response); 402 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main Resource->identifier(), m_response, m_mainResource.get());
403 m_fetcher->stopFetching(); 403 m_fetcher->stopFetching();
404 return; 404 return;
405 } 405 }
406 406
407 if (m_response.isHTTP()) { 407 if (m_response.isHTTP()) {
408 int status = m_response.httpStatusCode(); 408 int status = m_response.httpStatusCode();
409 if ((status < 200 || status >= 300) && m_frame->owner()) 409 if ((status < 200 || status >= 300) && m_frame->owner())
410 m_frame->owner()->renderFallbackContent(); 410 m_frame->owner()->renderFallbackContent();
411 } 411 }
412 } 412 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 { 673 {
674 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); 674 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing);
675 if (!source.isNull()) 675 if (!source.isNull())
676 m_writer->appendReplacingData(source); 676 m_writer->appendReplacingData(source);
677 endWriting(m_writer.get()); 677 endWriting(m_writer.get());
678 } 678 }
679 679
680 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 680 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
681 681
682 } // namespace blink 682 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698