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

Unified Diff: third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h

Issue 2193683004: Move ThreadableLoader to Oilpan heap (3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-threadable-loader
Patch Set: revert DocumentThreadableLoader changes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
index 02c0d8af0a64be25a73a7c945f3d0e9015760461..bcd683ee70200ca7ee1dabb3a5192b027c35b007 100644
--- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
+++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
@@ -56,9 +56,31 @@ class WorkerLoaderProxy;
struct CrossThreadResourceRequestData;
struct CrossThreadResourceTimingInfoData;
-// TODO(yhirano): Draw a diagram to illustrate the class relationship.
-// TODO(yhirano): Rename inner classes so that readers can see in which thread
-// they are living easily.
+// A WorkerThreadableLoader is a ThreadableLoader implementation intended to
+// be used in a WebWorker thread. Because Blink's ResourceFetcher and
+// ResourceLoader work only in the main thread, a WorkerThreadableLoader holds
+// a ThreadableLoader in the main thread and delegates tasks asynchronously
+// to the loader.
+//
+// CTP: CrossThreadPersistent
+// CTWP: CrossThreadWeakPersistent
+//
+// ----------------------------------------------------------------
+// +------------------------+
+// raw ptr | ThreadableLoaderClient |
+// +--------> | worker thread |
+// | +------------------------+
+// |
+// +----+------------------+ CTP +------------------------+
+// + WorkerThreadableLoader|<--------+ MainThreadLoaderHolder |
+// | worker thread +-------->| main thread |
+// +-----------------------+ CTWP +----------------------+-+
+// |
+// +------------------+ | Member
+// | ThreadableLoader | <---+
+// | main thread |
+// +------------------+
+//
class WorkerThreadableLoader final : public ThreadableLoader {
public:
static void loadResourceSynchronously(WorkerGlobalScope&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
@@ -101,8 +123,8 @@ private:
// ThreadableLoaderClient for a DocumentThreadableLoader and forward
// notifications to the associated WorkerThreadableLoader living in the
// worker thread.
- class Peer final : public GarbageCollectedFinalized<Peer>, public ThreadableLoaderClient, public WorkerThreadLifecycleObserver {
- USING_GARBAGE_COLLECTED_MIXIN(Peer);
+ class MainThreadLoaderHolder final : public GarbageCollectedFinalized<MainThreadLoaderHolder>, public ThreadableLoaderClient, public WorkerThreadLifecycleObserver {
+ USING_GARBAGE_COLLECTED_MIXIN(MainThreadLoaderHolder);
public:
static void createAndStart(
WorkerThreadableLoader*,
@@ -113,7 +135,7 @@ private:
const ResourceLoaderOptions&,
PassRefPtr<WaitableEventWithTasks>,
ExecutionContext*);
- ~Peer() override;
+ ~MainThreadLoaderHolder() override;
void overrideTimeout(unsigned long timeoutMillisecond);
void cancel();
@@ -134,7 +156,7 @@ private:
DECLARE_TRACE();
private:
- Peer(TaskForwarder*, WorkerThreadLifecycleContext*);
+ MainThreadLoaderHolder(TaskForwarder*, WorkerThreadLifecycleContext*);
void start(Document&, std::unique_ptr<CrossThreadResourceRequestData>, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
Member<TaskForwarder> m_forwarder;
@@ -145,7 +167,7 @@ private:
};
WorkerThreadableLoader(WorkerGlobalScope&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&, BlockingBehavior);
- void didStart(Peer*);
+ void didStart(MainThreadLoaderHolder*);
void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
void didReceiveResponse(unsigned long identifier, std::unique_ptr<CrossThreadResourceResponseData>, std::unique_ptr<WebDataConsumerHandle>);
@@ -166,8 +188,8 @@ private:
ResourceLoaderOptions m_resourceLoaderOptions;
BlockingBehavior m_blockingBehavior;
- // |*m_peer| lives in the main thread.
- CrossThreadPersistent<Peer> m_peer;
+ // |*m_mainThreadLoaderHolder| lives in the main thread.
+ CrossThreadPersistent<MainThreadLoaderHolder> m_mainThreadLoaderHolder;
};
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698