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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/Cache.cpp

Issue 2177243002: Use per-frame TaskRunner instead of thread's default in DataConsumerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_consumer_handle_unique_ptr
Patch Set: update Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/cachestorage/Cache.h" 5 #include "modules/cachestorage/Cache.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8ThrowException.h" 12 #include "bindings/core/v8/V8ThrowException.h"
13 #include "bindings/modules/v8/V8Response.h" 13 #include "bindings/modules/v8/V8Response.h"
14 #include "core/dom/DOMException.h" 14 #include "core/dom/DOMException.h"
15 #include "core/dom/TaskRunnerHelper.h"
15 #include "core/inspector/ConsoleMessage.h" 16 #include "core/inspector/ConsoleMessage.h"
16 #include "modules/cachestorage/CacheStorageError.h" 17 #include "modules/cachestorage/CacheStorageError.h"
17 #include "modules/fetch/BodyStreamBuffer.h" 18 #include "modules/fetch/BodyStreamBuffer.h"
18 #include "modules/fetch/FetchDataLoader.h" 19 #include "modules/fetch/FetchDataLoader.h"
19 #include "modules/fetch/GlobalFetch.h" 20 #include "modules/fetch/GlobalFetch.h"
20 #include "modules/fetch/Request.h" 21 #include "modules/fetch/Request.h"
21 #include "modules/fetch/Response.h" 22 #include "modules/fetch/Response.h"
22 #include "platform/HTTPNames.h" 23 #include "platform/HTTPNames.h"
23 #include "platform/Histogram.h" 24 #include "platform/Histogram.h"
24 #include "platform/RuntimeEnabledFeatures.h" 25 #include "platform/RuntimeEnabledFeatures.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 if (m_completed) 301 if (m_completed)
301 return; 302 return;
302 m_completed = true; 303 m_completed = true;
303 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) 304 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
304 return; 305 return;
305 ScriptState* state = m_resolver->getScriptState(); 306 ScriptState* state = m_resolver->getScriptState();
306 ScriptState::Scope scope(state); 307 ScriptState::Scope scope(state);
307 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), e rrorMessage)); 308 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), e rrorMessage));
308 } 309 }
309 310
311 ScriptPromiseResolver* resolver()
312 {
313 return m_resolver;
314 }
315
310 DEFINE_INLINE_VIRTUAL_TRACE() 316 DEFINE_INLINE_VIRTUAL_TRACE()
311 { 317 {
312 visitor->trace(m_cache); 318 visitor->trace(m_cache);
313 visitor->trace(m_resolver); 319 visitor->trace(m_resolver);
314 } 320 }
315 321
316 private: 322 private:
317 bool m_completed = false; 323 bool m_completed = false;
318 int m_numberOfRemainingOperations; 324 int m_numberOfRemainingOperations;
319 Member<Cache> m_cache; 325 Member<Cache> m_cache;
(...skipping 21 matching lines...) Expand all
341 batchOperation.response = m_webResponse; 347 batchOperation.response = m_webResponse;
342 batchOperation.response.setBlobDataHandle(handle); 348 batchOperation.response.setBlobDataHandle(handle);
343 m_barrierCallback->onSuccess(m_index, batchOperation); 349 m_barrierCallback->onSuccess(m_index, batchOperation);
344 } 350 }
345 351
346 void didFetchDataLoadFailed() override 352 void didFetchDataLoadFailed() override
347 { 353 {
348 m_barrierCallback->onError("network error"); 354 m_barrierCallback->onError("network error");
349 } 355 }
350 356
357 WebTaskRunner* getTaskRunner() override
358 {
359 return TaskRunnerHelper::getUnthrottledTaskRunner(m_barrierCallback->res olver()->getExecutionContext());
360 }
361
351 DEFINE_INLINE_VIRTUAL_TRACE() 362 DEFINE_INLINE_VIRTUAL_TRACE()
352 { 363 {
353 visitor->trace(m_barrierCallback); 364 visitor->trace(m_barrierCallback);
354 FetchDataLoader::Client::trace(visitor); 365 FetchDataLoader::Client::trace(visitor);
355 } 366 }
356 367
357 private: 368 private:
358 const size_t m_index; 369 const size_t m_index;
359 Member<BarrierCallbackForPut> m_barrierCallback; 370 Member<BarrierCallbackForPut> m_barrierCallback;
360 371
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options)); 630 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options));
620 return promise; 631 return promise;
621 } 632 }
622 633
623 WebServiceWorkerCache* Cache::webCache() const 634 WebServiceWorkerCache* Cache::webCache() const
624 { 635 {
625 return m_webCache.get(); 636 return m_webCache.get();
626 } 637 }
627 638
628 } // namespace blink 639 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698