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

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

Issue 333823006: Revert "Allow XHR timeout attribute to be overridden after send(), per spec" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/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
103 void WorkerThreadableLoader::cancel() 98 void WorkerThreadableLoader::cancel()
104 { 99 {
105 m_bridge.cancel(); 100 m_bridge.cancel();
106 } 101 }
107 102
108 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge( 103 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(
109 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, 104 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper,
110 PassOwnPtr<ThreadableLoaderClient> clientBridge, 105 PassOwnPtr<ThreadableLoaderClient> clientBridge,
111 WorkerLoaderProxy& loaderProxy, 106 WorkerLoaderProxy& loaderProxy,
112 const ResourceRequest& request, 107 const ResourceRequest& request,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void WorkerThreadableLoader::MainThreadBridge::destroy() 147 void WorkerThreadableLoader::MainThreadBridge::destroy()
153 { 148 {
154 // Ensure that no more client callbacks are done in the worker context's thr ead. 149 // Ensure that no more client callbacks are done in the worker context's thr ead.
155 clearClientWrapper(); 150 clearClientWrapper();
156 151
157 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre ad. 152 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre ad.
158 m_loaderProxy.postTaskToLoader( 153 m_loaderProxy.postTaskToLoader(
159 createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThrea dAccess(this))); 154 createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThrea dAccess(this)));
160 } 155 }
161 156
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 createCallbackTask(&MainThreadBridge::mainThreadOverrideTimeout, AllowCr ossThreadAccess(this),
176 timeoutMilliseconds));
177 }
178
179 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext * context, MainThreadBridge* thisPtr) 157 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext * context, MainThreadBridge* thisPtr)
180 { 158 {
181 ASSERT(isMainThread()); 159 ASSERT(isMainThread());
182 ASSERT_UNUSED(context, context->isDocument()); 160 ASSERT_UNUSED(context, context->isDocument());
183 161
184 if (!thisPtr->m_mainThreadLoader) 162 if (!thisPtr->m_mainThreadLoader)
185 return; 163 return;
186 thisPtr->m_mainThreadLoader->cancel(); 164 thisPtr->m_mainThreadLoader->cancel();
187 thisPtr->m_mainThreadLoader = nullptr; 165 thisPtr->m_mainThreadLoader = nullptr;
188 } 166 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 { 224 {
247 m_clientBridge->didFailAccessControlCheck(error); 225 m_clientBridge->didFailAccessControlCheck(error);
248 } 226 }
249 227
250 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() 228 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck()
251 { 229 {
252 m_clientBridge->didFailRedirectCheck(); 230 m_clientBridge->didFailRedirectCheck();
253 } 231 }
254 232
255 } // namespace WebCore 233 } // namespace WebCore
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