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

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

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 { 116 {
117 ASSERT(!m_frame || !isLoading()); 117 ASSERT(!m_frame || !isLoading());
118 ASSERT(!m_mainResource); 118 ASSERT(!m_mainResource);
119 ASSERT(!m_applicationCacheHost); 119 ASSERT(!m_applicationCacheHost);
120 } 120 }
121 121
122 DEFINE_TRACE(DocumentLoader) 122 DEFINE_TRACE(DocumentLoader)
123 { 123 {
124 visitor->trace(m_frame); 124 visitor->trace(m_frame);
125 visitor->trace(m_fetcher); 125 visitor->trace(m_fetcher);
126 // TODO(sof): start tracing ResourcePtr<>s (and m_mainResource.) 126 visitor->trace(m_mainResource);
127 visitor->trace(m_writer); 127 visitor->trace(m_writer);
128 visitor->trace(m_documentLoadTiming); 128 visitor->trace(m_documentLoadTiming);
129 visitor->trace(m_applicationCacheHost); 129 visitor->trace(m_applicationCacheHost);
130 visitor->trace(m_contentSecurityPolicy); 130 visitor->trace(m_contentSecurityPolicy);
131 } 131 }
132 132
133 unsigned long DocumentLoader::mainResourceIdentifier() const 133 unsigned long DocumentLoader::mainResourceIdentifier() const
134 { 134 {
135 return m_mainResource ? m_mainResource->identifier() : 0; 135 return m_mainResource ? m_mainResource->identifier() : 0;
136 } 136 }
(...skipping 13 matching lines...) Expand all
150 const ResourceRequest& DocumentLoader::request() const 150 const ResourceRequest& DocumentLoader::request() const
151 { 151 {
152 return m_request; 152 return m_request;
153 } 153 }
154 154
155 const KURL& DocumentLoader::url() const 155 const KURL& DocumentLoader::url() const
156 { 156 {
157 return m_request.url(); 157 return m_request.url();
158 } 158 }
159 159
160 ResourcePtr<Resource> DocumentLoader::startPreload(Resource::Type type, FetchReq uest& request) 160 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques t)
161 { 161 {
162 ResourcePtr<Resource> resource; 162 RefPtrWillBeRawPtr<Resource> resource = nullptr;
163 switch (type) { 163 switch (type) {
164 case Resource::Image: 164 case Resource::Image:
165 resource = ImageResource::fetch(request, fetcher()); 165 resource = ImageResource::fetch(request, fetcher());
166 break; 166 break;
167 case Resource::Script: 167 case Resource::Script:
168 resource = ScriptResource::fetch(request, fetcher()); 168 resource = ScriptResource::fetch(request, fetcher());
169 break; 169 break;
170 case Resource::CSSStyleSheet: 170 case Resource::CSSStyleSheet:
171 resource = CSSStyleSheetResource::fetch(request, fetcher()); 171 resource = CSSStyleSheetResource::fetch(request, fetcher());
172 break; 172 break;
(...skipping 13 matching lines...) Expand all
186 break; 186 break;
187 case Resource::LinkPreload: 187 case Resource::LinkPreload:
188 resource = RawResource::fetch(request, fetcher()); 188 resource = RawResource::fetch(request, fetcher());
189 break; 189 break;
190 default: 190 default:
191 ASSERT_NOT_REACHED(); 191 ASSERT_NOT_REACHED();
192 } 192 }
193 193
194 if (resource) 194 if (resource)
195 fetcher()->preloadStarted(resource.get()); 195 fetcher()->preloadStarted(resource.get());
196 return resource; 196 return resource.get();
197 } 197 }
198 198
199 void DocumentLoader::didChangePerformanceTiming() 199 void DocumentLoader::didChangePerformanceTiming()
200 { 200 {
201 if (frame() && frame()->isMainFrame() && m_state >= Committed) { 201 if (frame() && frame()->isMainFrame() && m_state >= Committed) {
202 frameLoader()->client()->didChangePerformanceTiming(); 202 frameLoader()->client()->didChangePerformanceTiming();
203 } 203 }
204 } 204 }
205 205
206 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource) 206 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource)
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 { 765 {
766 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 766 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
767 if (!source.isNull()) 767 if (!source.isNull())
768 m_writer->appendReplacingData(source); 768 m_writer->appendReplacingData(source);
769 endWriting(m_writer.get()); 769 endWriting(m_writer.get());
770 } 770 }
771 771
772 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 772 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
773 773
774 } // namespace blink 774 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698