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

Side by Side Diff: third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h

Issue 1682423002: Remove WebWaitableEvent and replace it with WaitableEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build Created 4 years, 10 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 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "wtf/ThreadingPrimitives.h" 45 #include "wtf/ThreadingPrimitives.h"
46 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
47 #include "wtf/text/WTFString.h" 47 #include "wtf/text/WTFString.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 class ExecutionContextTask; 51 class ExecutionContextTask;
52 class ResourceError; 52 class ResourceError;
53 class ResourceRequest; 53 class ResourceRequest;
54 class ResourceResponse; 54 class ResourceResponse;
55 class WebWaitableEvent; 55 class WaitableEvent;
56 class WorkerGlobalScope; 56 class WorkerGlobalScope;
57 class WorkerLoaderProxy; 57 class WorkerLoaderProxy;
58 struct CrossThreadResourceRequestData; 58 struct CrossThreadResourceRequestData;
59 59
60 class WorkerThreadableLoader final : public ThreadableLoader, private Threadable LoaderClientWrapper::ResourceTimingClient { 60 class WorkerThreadableLoader final : public ThreadableLoader, private Threadable LoaderClientWrapper::ResourceTimingClient {
61 USING_FAST_MALLOC(WorkerThreadableLoader); 61 USING_FAST_MALLOC(WorkerThreadableLoader);
62 public: 62 public:
63 static void loadResourceSynchronously(WorkerGlobalScope&, const ResourceRequ est&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoa derOptions&); 63 static void loadResourceSynchronously(WorkerGlobalScope&, const ResourceRequ est&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoa derOptions&);
64 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGl obalScope, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOp tions) 64 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGl obalScope, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOp tions)
65 { 65 {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 public: 175 public:
176 MainThreadSyncBridge(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderClie ntWrapper>, const ResourceRequest&, const ThreadableLoaderOptions&, const Resour ceLoaderOptions&, const ReferrerPolicy, const String& outgoingReferrer); 176 MainThreadSyncBridge(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderClie ntWrapper>, const ResourceRequest&, const ThreadableLoaderOptions&, const Resour ceLoaderOptions&, const ReferrerPolicy, const String& outgoingReferrer);
177 177
178 private: 178 private:
179 ~MainThreadSyncBridge() override; 179 ~MainThreadSyncBridge() override;
180 180
181 void forwardTaskToWorker(PassOwnPtr<ExecutionContextTask>) override; 181 void forwardTaskToWorker(PassOwnPtr<ExecutionContextTask>) override;
182 void forwardTaskToWorkerOnLoaderDone(PassOwnPtr<ExecutionContextTask>) o verride; 182 void forwardTaskToWorkerOnLoaderDone(PassOwnPtr<ExecutionContextTask>) o verride;
183 183
184 bool m_done; 184 bool m_done;
185 OwnPtr<WebWaitableEvent> m_loaderDoneEvent; 185 OwnPtr<WaitableEvent> m_loaderDoneEvent;
186 // Thread-safety: |m_clientTasks| can be written (i.e. Closures are adde d) 186 // Thread-safety: |m_clientTasks| can be written (i.e. Closures are adde d)
187 // on the main thread only before |m_loaderDoneEvent| is signaled and ca n be read 187 // on the main thread only before |m_loaderDoneEvent| is signaled and ca n be read
188 // on the worker context thread only after |m_loaderDoneEvent| is signal ed. 188 // on the worker context thread only after |m_loaderDoneEvent| is signal ed.
189 Vector<OwnPtr<ExecutionContextTask>> m_clientTasks; 189 Vector<OwnPtr<ExecutionContextTask>> m_clientTasks;
190 Mutex m_lock; 190 Mutex m_lock;
191 }; 191 };
192 192
193 WorkerThreadableLoader(WorkerGlobalScope&, ThreadableLoaderClient*, const Re sourceRequest&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&, Bl ockingBehavior); 193 WorkerThreadableLoader(WorkerGlobalScope&, ThreadableLoaderClient*, const Re sourceRequest&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&, Bl ockingBehavior);
194 194
195 void didReceiveResourceTiming(const ResourceTimingInfo&) override; 195 void didReceiveResourceTiming(const ResourceTimingInfo&) override;
196 196
197 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 197 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
198 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; 198 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper;
199 199
200 MainThreadBridgeBase* m_bridge; 200 MainThreadBridgeBase* m_bridge;
201 }; 201 };
202 202
203 } // namespace blink 203 } // namespace blink
204 204
205 #endif // WorkerThreadableLoader_h 205 #endif // WorkerThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698