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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase past r181245 conflict Created 6 years, 3 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 19 matching lines...) Expand all
30 #include "config.h" 30 #include "config.h"
31 #include "core/loader/DocumentLoader.h" 31 #include "core/loader/DocumentLoader.h"
32 32
33 #include "core/FetchInitiatorTypeNames.h" 33 #include "core/FetchInitiatorTypeNames.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/DocumentParser.h" 35 #include "core/dom/DocumentParser.h"
36 #include "core/events/Event.h" 36 #include "core/events/Event.h"
37 #include "core/fetch/MemoryCache.h" 37 #include "core/fetch/MemoryCache.h"
38 #include "core/fetch/ResourceFetcher.h" 38 #include "core/fetch/ResourceFetcher.h"
39 #include "core/fetch/ResourceLoader.h" 39 #include "core/fetch/ResourceLoader.h"
40 #include "core/frame/FrameProtector.h"
41 #include "core/frame/LocalDOMWindow.h"
42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/csp/ContentSecurityPolicy.h"
40 #include "core/html/HTMLFrameOwnerElement.h" 44 #include "core/html/HTMLFrameOwnerElement.h"
41 #include "core/html/parser/TextResourceDecoder.h" 45 #include "core/html/parser/TextResourceDecoder.h"
42 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
43 #include "core/loader/FrameLoader.h" 47 #include "core/loader/FrameLoader.h"
44 #include "core/loader/FrameLoaderClient.h" 48 #include "core/loader/FrameLoaderClient.h"
45 #include "core/loader/UniqueIdentifier.h" 49 #include "core/loader/UniqueIdentifier.h"
46 #include "core/loader/appcache/ApplicationCacheHost.h" 50 #include "core/loader/appcache/ApplicationCacheHost.h"
47 #include "core/frame/LocalDOMWindow.h"
48 #include "core/frame/LocalFrame.h"
49 #include "core/frame/csp/ContentSecurityPolicy.h"
50 #include "core/page/FrameTree.h" 51 #include "core/page/FrameTree.h"
51 #include "core/page/Page.h" 52 #include "core/page/Page.h"
52 #include "core/frame/Settings.h" 53 #include "core/frame/Settings.h"
53 #include "core/inspector/ConsoleMessage.h" 54 #include "core/inspector/ConsoleMessage.h"
54 #include "platform/Logging.h" 55 #include "platform/Logging.h"
55 #include "platform/UserGestureIndicator.h" 56 #include "platform/UserGestureIndicator.h"
56 #include "platform/mhtml/ArchiveResource.h" 57 #include "platform/mhtml/ArchiveResource.h"
57 #include "platform/mhtml/ArchiveResourceCollection.h" 58 #include "platform/mhtml/ArchiveResourceCollection.h"
58 #include "platform/mhtml/MHTMLArchive.h" 59 #include "platform/mhtml/MHTMLArchive.h"
59 #include "platform/plugins/PluginData.h" 60 #include "platform/plugins/PluginData.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 frameLoader()->receivedMainResourceError(error); 171 frameLoader()->receivedMainResourceError(error);
171 clearMainResourceHandle(); 172 clearMainResourceHandle();
172 } 173 }
173 174
174 // Cancels the data source's pending loads. Conceptually, a data source only lo ads 175 // Cancels the data source's pending loads. Conceptually, a data source only lo ads
175 // one document at a time, but one document may have many related resources. 176 // one document at a time, but one document may have many related resources.
176 // stopLoading will stop all loads initiated by the data source, 177 // stopLoading will stop all loads initiated by the data source,
177 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job. 178 // but not loads initiated by child frames' data sources -- that's the WebFrame' s job.
178 void DocumentLoader::stopLoading() 179 void DocumentLoader::stopLoading()
179 { 180 {
180 RefPtr<LocalFrame> protectFrame(m_frame); 181 FrameProtector protectFrame(m_frame);
181 RefPtr<DocumentLoader> protectLoader(this); 182 RefPtr<DocumentLoader> protectLoader(this);
182 183
183 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin g() to return false. 184 // In some rare cases, calling FrameLoader::stopLoading could cause isLoadin g() to return false.
184 // (This can happen when there's a single XMLHttpRequest currently loading a nd stopLoading causes it 185 // (This can happen when there's a single XMLHttpRequest currently loading a nd stopLoading causes it
185 // to stop loading. Because of this, we need to save it so we don't return e arly. 186 // to stop loading. Because of this, we need to save it so we don't return e arly.
186 bool loading = isLoading(); 187 bool loading = isLoading();
187 188
188 if (m_committed) { 189 if (m_committed) {
189 // Attempt to stop the frame if the document loader is loading, or if it is done loading but 190 // Attempt to stop the frame if the document loader is loading, or if it is done loading but
190 // still parsing. Failure to do so can cause a world leak. 191 // still parsing. Failure to do so can cause a world leak.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 void DocumentLoader::dataReceived(Resource* resource, const char* data, int leng th) 533 void DocumentLoader::dataReceived(Resource* resource, const char* data, int leng th)
533 { 534 {
534 ASSERT(data); 535 ASSERT(data);
535 ASSERT(length); 536 ASSERT(length);
536 ASSERT_UNUSED(resource, resource == m_mainResource); 537 ASSERT_UNUSED(resource, resource == m_mainResource);
537 ASSERT(!m_response.isNull()); 538 ASSERT(!m_response.isNull());
538 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); 539 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading());
539 540
540 // Both unloading the old page and parsing the new page may execute JavaScri pt which destroys the datasource 541 // Both unloading the old page and parsing the new page may execute JavaScri pt which destroys the datasource
541 // by starting a new load, so retain temporarily. 542 // by starting a new load, so retain temporarily.
542 RefPtr<LocalFrame> protectFrame(m_frame); 543 FrameProtector protectFrame(m_frame);
543 RefPtr<DocumentLoader> protectLoader(this); 544 RefPtr<DocumentLoader> protectLoader(this);
544 545
545 m_applicationCacheHost->mainResourceDataReceived(data, length); 546 m_applicationCacheHost->mainResourceDataReceived(data, length);
546 m_timeOfLastDataReceived = monotonicallyIncreasingTime(); 547 m_timeOfLastDataReceived = monotonicallyIncreasingTime();
547 548
548 commitIfReady(); 549 commitIfReady();
549 if (!frameLoader()) 550 if (!frameLoader())
550 return; 551 return;
551 if (isArchiveMIMEType(response().mimeType())) 552 if (isArchiveMIMEType(response().mimeType()))
552 return; 553 return;
(...skipping 11 matching lines...) Expand all
564 } 565 }
565 566
566 void DocumentLoader::appendRedirect(const KURL& url) 567 void DocumentLoader::appendRedirect(const KURL& url)
567 { 568 {
568 m_redirectChain.append(url); 569 m_redirectChain.append(url);
569 } 570 }
570 571
571 void DocumentLoader::detachFromFrame() 572 void DocumentLoader::detachFromFrame()
572 { 573 {
573 ASSERT(m_frame); 574 ASSERT(m_frame);
574 RefPtr<LocalFrame> protectFrame(m_frame); 575 FrameProtector protectFrame(m_frame);
575 RefPtr<DocumentLoader> protectLoader(this); 576 RefPtr<DocumentLoader> protectLoader(this);
576 577
577 // It never makes sense to have a document loader that is detached from its 578 // It never makes sense to have a document loader that is detached from its
578 // frame have any loads active, so go ahead and kill all the loads. 579 // frame have any loads active, so go ahead and kill all the loads.
579 stopLoading(); 580 stopLoading();
580 581
581 m_applicationCacheHost->setApplicationCache(0); 582 m_applicationCacheHost->setApplicationCache(0);
582 InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this); 583 InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this);
583 m_frame = 0; 584 m_frame = 0;
584 } 585 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 824 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
824 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 825 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
825 { 826 {
826 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true); 827 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true);
827 if (!source.isNull()) 828 if (!source.isNull())
828 m_writer->appendReplacingData(source); 829 m_writer->appendReplacingData(source);
829 endWriting(m_writer.get()); 830 endWriting(m_writer.get());
830 } 831 }
831 832
832 } // namespace blink 833 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698