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

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

Issue 23444058: Use downloadToFile option when XHR downloads a Blob (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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) 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size()); 194 workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size());
195 } 195 }
196 196
197 void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data, int dataLength) 197 void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data, int dataLength)
198 { 198 {
199 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne eds to be an OwnPtr for usage with createCallbackTask. 199 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne eds to be an OwnPtr for usage with createCallbackTask.
200 memcpy(vector->data(), data, dataLength); 200 memcpy(vector->data(), data, dataLength);
201 m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerG lobalScopeDidReceiveData, m_workerClientWrapper, vector.release()), m_taskMode); 201 m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerG lobalScopeDidReceiveData, m_workerClientWrapper, vector.release()), m_taskMode);
202 } 202 }
203 203
204 static void workerGlobalScopeDidDownloadData(ScriptExecutionContext* context, Pa ssRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, int dataLength)
205 {
206 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
207 workerClientWrapper->didDownloadData(dataLength);
208 }
209
210 void WorkerThreadableLoader::MainThreadBridge::didDownloadData(int dataLength)
211 {
212 m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerG lobalScopeDidDownloadData, m_workerClientWrapper, dataLength), m_taskMode);
213 }
214
204 static void workerGlobalScopeDidReceiveCachedMetadata(ScriptExecutionContext* co ntext, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vec tor<char> > vectorData) 215 static void workerGlobalScopeDidReceiveCachedMetadata(ScriptExecutionContext* co ntext, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vec tor<char> > vectorData)
205 { 216 {
206 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 217 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
207 workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData ->size()); 218 workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData ->size());
208 } 219 }
209 220
210 void WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata(const ch ar* data, int dataLength) 221 void WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata(const ch ar* data, int dataLength)
211 { 222 {
212 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne eds to be an OwnPtr for usage with createCallbackTask. 223 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne eds to be an OwnPtr for usage with createCallbackTask.
213 memcpy(vector->data(), data, dataLength); 224 memcpy(vector->data(), data, dataLength);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 263 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
253 workerClientWrapper->didFailRedirectCheck(); 264 workerClientWrapper->didFailRedirectCheck();
254 } 265 }
255 266
256 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() 267 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck()
257 { 268 {
258 m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerG lobalScopeDidFailRedirectCheck, m_workerClientWrapper), m_taskMode); 269 m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerG lobalScopeDidFailRedirectCheck, m_workerClientWrapper), m_taskMode);
259 } 270 }
260 271
261 } // namespace WebCore 272 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698