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

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

Issue 22159002: Add 'didDispatchPingLoader' callback to FrameLoaderClient. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoaderClient.h ('k') | Source/testing/runner/TestRunner.h » ('j') | 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 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * 29 *
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 #include "core/loader/PingLoader.h" 33 #include "core/loader/PingLoader.h"
34 34
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/inspector/InspectorInstrumentation.h" 36 #include "core/inspector/InspectorInstrumentation.h"
37 #include "core/loader/FrameLoader.h" 37 #include "core/loader/FrameLoader.h"
38 #include "core/loader/FrameLoaderClient.h"
38 #include "core/loader/UniqueIdentifier.h" 39 #include "core/loader/UniqueIdentifier.h"
39 #include "core/page/Frame.h" 40 #include "core/page/Frame.h"
40 #include "core/platform/chromium/support/WrappedResourceRequest.h" 41 #include "core/platform/chromium/support/WrappedResourceRequest.h"
41 #include "core/platform/network/FormData.h" 42 #include "core/platform/network/FormData.h"
42 #include "core/platform/network/ResourceRequest.h" 43 #include "core/platform/network/ResourceRequest.h"
43 #include "core/platform/network/ResourceResponse.h" 44 #include "core/platform/network/ResourceResponse.h"
44 #include "public/platform/Platform.h" 45 #include "public/platform/Platform.h"
45 #include "public/platform/WebURLLoader.h" 46 #include "public/platform/WebURLLoader.h"
46 #include "weborigin/SecurityOrigin.h" 47 #include "weborigin/SecurityOrigin.h"
47 #include "weborigin/SecurityPolicy.h" 48 #include "weborigin/SecurityPolicy.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request, Secu rityOrigin::create(reportURL)->isSameSchemeHostPort(frame->document()->securityO rigin()) ? AllowStoredCredentials : DoNotAllowStoredCredentials)); 117 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request, Secu rityOrigin::create(reportURL)->isSameSchemeHostPort(frame->document()->securityO rigin()) ? AllowStoredCredentials : DoNotAllowStoredCredentials));
117 118
118 // Leak the ping loader, since it will kill itself as soon as it receives a response. 119 // Leak the ping loader, since it will kill itself as soon as it receives a response.
119 PingLoader* leakedPingLoader = pingLoader.leakPtr(); 120 PingLoader* leakedPingLoader = pingLoader.leakPtr();
120 UNUSED_PARAM(leakedPingLoader); 121 UNUSED_PARAM(leakedPingLoader);
121 } 122 }
122 123
123 PingLoader::PingLoader(Frame* frame, ResourceRequest& request, StoredCredentials credentialsAllowed) 124 PingLoader::PingLoader(Frame* frame, ResourceRequest& request, StoredCredentials credentialsAllowed)
124 : m_timeout(this, &PingLoader::timeout) 125 : m_timeout(this, &PingLoader::timeout)
125 { 126 {
127 frame->loader()->client()->didDispatchPingLoader(request.url());
128
126 unsigned long identifier = createUniqueIdentifier(); 129 unsigned long identifier = createUniqueIdentifier();
127 m_loader = adoptPtr(WebKit::Platform::current()->createURLLoader()); 130 m_loader = adoptPtr(WebKit::Platform::current()->createURLLoader());
128 ASSERT(m_loader); 131 ASSERT(m_loader);
129 WebKit::WrappedResourceRequest wrappedRequest(request); 132 WebKit::WrappedResourceRequest wrappedRequest(request);
130 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr edentials); 133 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr edentials);
131 m_loader->loadAsynchronously(wrappedRequest, this); 134 m_loader->loadAsynchronously(wrappedRequest, this);
132 135
133 InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame-> loader()->activeDocumentLoader(), request, ResourceResponse()); 136 InspectorInstrumentation::continueAfterPingLoader(frame, identifier, frame-> loader()->activeDocumentLoader(), request, ResourceResponse());
134 137
135 // If the server never responds, FrameLoader won't be able to cancel this lo ad and 138 // If the server never responds, FrameLoader won't be able to cancel this lo ad and
136 // we'll sit here waiting forever. Set a very generous timeout, just in case . 139 // we'll sit here waiting forever. Set a very generous timeout, just in case .
137 m_timeout.startOneShot(60000); 140 m_timeout.startOneShot(60000);
138 } 141 }
139 142
140 PingLoader::~PingLoader() 143 PingLoader::~PingLoader()
141 { 144 {
142 if (m_loader) 145 if (m_loader)
143 m_loader->cancel(); 146 m_loader->cancel();
144 } 147 }
145 148
146 } 149 }
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoaderClient.h ('k') | Source/testing/runner/TestRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698