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

Side by Side Diff: Source/WebKit/chromium/src/AssociatedURLLoader.cpp

Issue 7530003: Merge 91789 - Cancel the load when an associated URL loader goes out of scope. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 AssociatedURLLoader::AssociatedURLLoader(PassRefPtr<WebFrameImpl> frameImpl, con st WebURLLoaderOptions& options) 208 AssociatedURLLoader::AssociatedURLLoader(PassRefPtr<WebFrameImpl> frameImpl, con st WebURLLoaderOptions& options)
209 : m_frameImpl(frameImpl) 209 : m_frameImpl(frameImpl)
210 , m_options(options) 210 , m_options(options)
211 , m_client(0) 211 , m_client(0)
212 { 212 {
213 ASSERT(m_frameImpl); 213 ASSERT(m_frameImpl);
214 } 214 }
215 215
216 AssociatedURLLoader::~AssociatedURLLoader() 216 AssociatedURLLoader::~AssociatedURLLoader()
217 { 217 {
218 if (m_clientAdapter) 218 cancel();
219 m_clientAdapter->clearClient();
220 } 219 }
221 220
222 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ 221 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
223 COMPILE_ASSERT(static_cast<int>(WebKit::webkit_name) == static_cast<int>(Web Core::webcore_name), mismatching_enums) 222 COMPILE_ASSERT(static_cast<int>(WebKit::webkit_name) == static_cast<int>(Web Core::webcore_name), mismatching_enums)
224 223
225 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny, DenyCrossOriginRequests); 224 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny, DenyCrossOriginRequests);
226 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc essControl, UseAccessControl); 225 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc essControl, UseAccessControl);
227 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow, AllowCrossOriginRequests); 226 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow, AllowCrossOriginRequests);
228 227
229 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data) 228 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data)
(...skipping 18 matching lines...) Expand all
248 247
249 const ResourceRequest& webcoreRequest = request.toResourceRequest(); 248 const ResourceRequest& webcoreRequest = request.toResourceRequest();
250 Document* webcoreDocument = m_frameImpl->frame()->document(); 249 Document* webcoreDocument = m_frameImpl->frame()->document();
251 m_clientAdapter = ClientAdapter::create(this, m_client, request.downloadToFi le()); 250 m_clientAdapter = ClientAdapter::create(this, m_client, request.downloadToFi le());
252 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAdapter .get(), webcoreRequest, options); 251 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAdapter .get(), webcoreRequest, options);
253 m_clientAdapter->enableErrorNotifications(); 252 m_clientAdapter->enableErrorNotifications();
254 } 253 }
255 254
256 void AssociatedURLLoader::cancel() 255 void AssociatedURLLoader::cancel()
257 { 256 {
258 if (m_loader) { 257 if (m_clientAdapter)
259 m_clientAdapter->clearClient(); 258 m_clientAdapter->clearClient();
259 if (m_loader)
260 m_loader->cancel(); 260 m_loader->cancel();
261 }
262 } 261 }
263 262
264 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 263 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
265 { 264 {
266 if (m_loader) 265 if (m_loader)
267 m_loader->setDefersLoading(defersLoading); 266 m_loader->setDefersLoading(defersLoading);
268 } 267 }
269 268
270 } // namespace WebKit 269 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698