Changeset 252227 in webkit
- Timestamp:
- Nov 7, 2019 6:35:32 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252226 r252227 1 2019-11-07 Chris Dumez <cdumez@apple.com> 2 3 Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache 4 https://bugs.webkit.org/show_bug.cgi?id=203985 5 6 Reviewed by Ryosuke Niwa. 7 8 Use ActiveDOMObject::queueTaskKeepingObjectAlive() in DOMCache and drop DOMCache::enqueueTask(). 9 10 * Modules/cache/DOMCache.cpp: 11 (WebCore::DOMCache::match): 12 (WebCore::DOMCache::matchAll): 13 (WebCore::DOMCache::addAll): 14 (WebCore::DOMCache::putWithResponseData): 15 (WebCore::DOMCache::put): 16 (WebCore::DOMCache::remove): 17 (WebCore::DOMCache::keys): 18 (WebCore::DOMCache::enqueueTask): Deleted. 19 * Modules/cache/DOMCache.h: 20 1 21 2019-11-07 Kenneth Russell <kbr@chromium.org> 2 22 -
trunk/Source/WebCore/Modules/cache/DOMCache.cpp
r251968 r252227 60 60 { 61 61 doMatch(WTFMove(info), WTFMove(options), [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](ExceptionOr<RefPtr<FetchResponse>>&& result) mutable { 62 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {62 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 63 63 if (result.hasException()) { 64 64 promise->reject(result.releaseException()); … … 124 124 if (!request) { 125 125 retrieveRecords(URL { }, [this, promise = WTFMove(promise)](Optional<Exception>&& exception) mutable { 126 enqueueTask([this, promise = WTFMove(promise), exception = WTFMove(exception)]() mutable {126 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [this, promise = WTFMove(promise), exception = WTFMove(exception)]() mutable { 127 127 if (exception) { 128 128 promise.reject(WTFMove(exception.value())); … … 135 135 } 136 136 queryCache(request.releaseNonNull(), WTFMove(options), [this, promise = WTFMove(promise)](ExceptionOr<Vector<CacheStorageRecord>>&& result) mutable { 137 enqueueTask([this, promise = WTFMove(promise), result = WTFMove(result)]() mutable {137 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [this, promise = WTFMove(promise), result = WTFMove(result)]() mutable { 138 138 if (result.hasException()) { 139 139 promise.reject(result.releaseException()); … … 243 243 auto taskHandler = FetchTasksHandler::create(*this, [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](ExceptionOr<Vector<Record>>&& result) mutable { 244 244 if (result.hasException()) { 245 enqueueTask([promise = WTFMove(promise), exception = result.releaseException()]() mutable {245 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), exception = result.releaseException()]() mutable { 246 246 promise.reject(WTFMove(exception)); 247 247 }); … … 249 249 } 250 250 batchPutOperation(result.releaseReturnValue(), [this, protectedThis = WTFMove(protectedThis), promise = WTFMove(promise)](ExceptionOr<void>&& result) mutable { 251 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {251 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 252 252 promise.settle(WTFMove(result)); 253 253 }); … … 314 314 { 315 315 if (responseBody.hasException()) { 316 enqueueTask([promise = WTFMove(promise), exception = responseBody.releaseException()]() mutable {316 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), exception = responseBody.releaseException()]() mutable { 317 317 promise.reject(WTFMove(exception)); 318 318 }); … … 324 324 body = buffer.releaseNonNull(); 325 325 batchPutOperation(request.get(), response.get(), WTFMove(body), [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](ExceptionOr<void>&& result) mutable { 326 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {326 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 327 327 promise.settle(WTFMove(result)); 328 328 }); … … 390 390 391 391 batchPutOperation(request.get(), response.get(), response->consumeBody(), [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](ExceptionOr<void>&& result) mutable { 392 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {392 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 393 393 promise.settle(WTFMove(result)); 394 394 }); … … 408 408 409 409 batchDeleteOperation(requestOrException.releaseReturnValue(), WTFMove(options), [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](ExceptionOr<bool>&& result) mutable { 410 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {410 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 411 411 promise.settle(WTFMove(result)); 412 412 }); … … 436 436 if (!request) { 437 437 retrieveRecords(URL { }, [this, promise = WTFMove(promise)](Optional<Exception>&& exception) mutable { 438 enqueueTask([this, promise = WTFMove(promise), exception = WTFMove(exception)]() mutable {438 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [this, promise = WTFMove(promise), exception = WTFMove(exception)]() mutable { 439 439 if (exception) { 440 440 promise.reject(WTFMove(exception.value())); … … 448 448 449 449 queryCache(request.releaseNonNull(), WTFMove(options), [this, protectedThis = makeRef(*this), promise = WTFMove(promise)](auto&& result) mutable { 450 enqueueTask([promise = WTFMove(promise), result = WTFMove(result)]() mutable {450 queueTaskKeepingObjectAlive(*this, TaskSource::DOMManipulation, [promise = WTFMove(promise), result = WTFMove(result)]() mutable { 451 451 if (result.hasException()) { 452 452 promise.reject(result.releaseException()); … … 608 608 } 609 609 610 void DOMCache::enqueueTask(Function<void()>&& task)611 {612 auto* context = scriptExecutionContext();613 if (!context)614 return;615 context->eventLoop().queueTask(TaskSource::DOMManipulation, *context, [protectedThis = makeRef(*this), pendingActivity = makePendingActivity(*this), task = WTFMove(task)] {616 task();617 });618 }619 620 610 } // namespace WebCore -
trunk/Source/WebCore/Modules/cache/DOMCache.h
r251968 r252227 85 85 DOMCacheEngine::Record toConnectionRecord(const FetchRequest&, FetchResponse&, DOMCacheEngine::ResponseBody&&); 86 86 87 void enqueueTask(Function<void()>&&);88 89 87 String m_name; 90 88 uint64_t m_identifier;
Note: See TracChangeset
for help on using the changeset viewer.