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

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

Issue 273993002: Allow XHR timeout attribute to be overridden after send(), per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again Created 6 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/core/loader/WorkerThreadableLoader.h ('k') | Source/core/xml/XMLHttpRequest.cpp » ('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) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 signalled = blink::Platform::current()->waitMultipleEvents(events); 88 signalled = blink::Platform::current()->waitMultipleEvents(events);
89 } 89 }
90 if (signalled == shutdownEvent) { 90 if (signalled == shutdownEvent) {
91 loader->cancel(); 91 loader->cancel();
92 return; 92 return;
93 } 93 }
94 94
95 clientBridgePtr->run(); 95 clientBridgePtr->run();
96 } 96 }
97 97
98 void WorkerThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds)
99 {
100 m_bridge.overrideTimeout(timeoutMilliseconds);
101 }
102
98 void WorkerThreadableLoader::cancel() 103 void WorkerThreadableLoader::cancel()
99 { 104 {
100 m_bridge.cancel(); 105 m_bridge.cancel();
101 } 106 }
102 107
103 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge( 108 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(
104 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, 109 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper,
105 PassOwnPtr<ThreadableLoaderClient> clientBridge, 110 PassOwnPtr<ThreadableLoaderClient> clientBridge,
106 WorkerLoaderProxy& loaderProxy, 111 WorkerLoaderProxy& loaderProxy,
107 const ResourceRequest& request, 112 const ResourceRequest& request,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void WorkerThreadableLoader::MainThreadBridge::destroy() 152 void WorkerThreadableLoader::MainThreadBridge::destroy()
148 { 153 {
149 // Ensure that no more client callbacks are done in the worker context's thr ead. 154 // Ensure that no more client callbacks are done in the worker context's thr ead.
150 clearClientWrapper(); 155 clearClientWrapper();
151 156
152 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre ad. 157 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre ad.
153 m_loaderProxy.postTaskToLoader( 158 m_loaderProxy.postTaskToLoader(
154 createCrossThreadTask(&MainThreadBridge::mainThreadDestroy, AllowCrossTh readAccess(this))); 159 createCrossThreadTask(&MainThreadBridge::mainThreadDestroy, AllowCrossTh readAccess(this)));
155 } 160 }
156 161
162 void WorkerThreadableLoader::MainThreadBridge::mainThreadOverrideTimeout(Executi onContext* context, MainThreadBridge* thisPtr, unsigned long timeoutMilliseconds )
163 {
164 ASSERT(isMainThread());
165 ASSERT_UNUSED(context, context->isDocument());
166
167 if (!thisPtr->m_mainThreadLoader)
168 return;
169 thisPtr->m_mainThreadLoader->overrideTimeout(timeoutMilliseconds);
170 }
171
172 void WorkerThreadableLoader::MainThreadBridge::overrideTimeout(unsigned long tim eoutMilliseconds)
173 {
174 m_loaderProxy.postTaskToLoader(
175 createCrossThreadTask(&MainThreadBridge::mainThreadOverrideTimeout, Allo wCrossThreadAccess(this),
176 timeoutMilliseconds));
177 }
178
157 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext * context, MainThreadBridge* thisPtr) 179 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext * context, MainThreadBridge* thisPtr)
158 { 180 {
159 ASSERT(isMainThread()); 181 ASSERT(isMainThread());
160 ASSERT_UNUSED(context, context->isDocument()); 182 ASSERT_UNUSED(context, context->isDocument());
161 183
162 if (!thisPtr->m_mainThreadLoader) 184 if (!thisPtr->m_mainThreadLoader)
163 return; 185 return;
164 thisPtr->m_mainThreadLoader->cancel(); 186 thisPtr->m_mainThreadLoader->cancel();
165 thisPtr->m_mainThreadLoader = nullptr; 187 thisPtr->m_mainThreadLoader = nullptr;
166 } 188 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { 246 {
225 m_clientBridge->didFailAccessControlCheck(error); 247 m_clientBridge->didFailAccessControlCheck(error);
226 } 248 }
227 249
228 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() 250 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck()
229 { 251 {
230 m_clientBridge->didFailRedirectCheck(); 252 m_clientBridge->didFailRedirectCheck();
231 } 253 }
232 254
233 } // namespace blink 255 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/WorkerThreadableLoader.h ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698