OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WorkletModuleResponsesMapProxy_h |
| 6 #define WorkletModuleResponsesMapProxy_h |
| 7 |
| 8 #include "platform/heap/Heap.h" |
| 9 |
| 10 #include "core/CoreExport.h" |
| 11 #include "core/workers/WorkletModuleResponsesMap.h" |
| 12 #include "platform/WebTaskRunner.h" |
| 13 #include "platform/weborigin/KURL.h" |
| 14 #include "platform/wtf/Functional.h" |
| 15 #include "platform/wtf/Optional.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 class ModuleScriptCreationParams; |
| 20 |
| 21 // A proxy class to talk to WorkletModuleResponsesMap on the main thread from |
| 22 // WorkletGlobalScope on the worklet context thread. The constructor and all |
| 23 // public functions must be called on the worklet context thread. |
| 24 class CORE_EXPORT WorkletModuleResponsesMapProxy |
| 25 : public GarbageCollectedFinalized<WorkletModuleResponsesMapProxy> { |
| 26 public: |
| 27 using Client = WorkletModuleResponsesMap::Client; |
| 28 WorkletModuleResponsesMapProxy( |
| 29 WorkletModuleResponsesMap*, |
| 30 RefPtr<WebTaskRunner> outside_settings_task_runner, |
| 31 RefPtr<WebTaskRunner> inside_settings_task_runner); |
| 32 |
| 33 void ReadEntry(const KURL&, Client*); |
| 34 void UpdateEntry(const KURL&, const ModuleScriptCreationParams&); |
| 35 void InvalidateEntry(const KURL&); |
| 36 |
| 37 DECLARE_TRACE(); |
| 38 |
| 39 private: |
| 40 void ReadEntryOnMainThread(const KURL&, Client*); |
| 41 |
| 42 CrossThreadPersistent<WorkletModuleResponsesMap> module_responses_map_; |
| 43 RefPtr<WebTaskRunner> outside_settings_task_runner_; |
| 44 RefPtr<WebTaskRunner> inside_settings_task_runner_; |
| 45 }; |
| 46 |
| 47 } // namespace blink |
| 48 |
| 49 #endif // WorkletModuleResponsesMapProxy_h |
OLD | NEW |