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

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

Issue 1274063003: [Loader] Make ThreadableLoader non-RefCounted and be managed by OwnPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reflect comments. Created 4 years, 9 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class ResourceResponse; 54 class ResourceResponse;
55 class WaitableEvent; 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 ThreadableLoaderOptions& option s, const ResourceLoaderOptions& resourceLoaderOptions) 64 static PassOwnPtr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGl obalScope, ThreadableLoaderClient* client, const ThreadableLoaderOptions& option s, const ResourceLoaderOptions& resourceLoaderOptions)
65 { 65 {
66 return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client, op tions, resourceLoaderOptions, LoadAsynchronously)); 66 return adoptPtr(new WorkerThreadableLoader(workerGlobalScope, client, op tions, resourceLoaderOptions, LoadAsynchronously));
67 } 67 }
68 68
69 ~WorkerThreadableLoader() override; 69 ~WorkerThreadableLoader() override;
70 70
71 void start(const ResourceRequest&) override; 71 void start(const ResourceRequest&) override;
72 72
73 void overrideTimeout(unsigned long timeout) override; 73 void overrideTimeout(unsigned long timeout) override;
74 74
75 void cancel() override; 75 void cancel() override;
76 76
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void forwardTaskToWorkerOnLoaderDone(PassOwnPtr<ExecutionContext Task>) = 0; 141 virtual void forwardTaskToWorkerOnLoaderDone(PassOwnPtr<ExecutionContext Task>) = 0;
142 142
143 // All executed on the main thread. 143 // All executed on the main thread.
144 void mainThreadCreateLoader(ThreadableLoaderOptions, ResourceLoaderOptio ns, ExecutionContext*); 144 void mainThreadCreateLoader(ThreadableLoaderOptions, ResourceLoaderOptio ns, ExecutionContext*);
145 void mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData>, const R eferrerPolicy, const String& outgoingReferrer); 145 void mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData>, const R eferrerPolicy, const String& outgoingReferrer);
146 void mainThreadDestroy(ExecutionContext*); 146 void mainThreadDestroy(ExecutionContext*);
147 void mainThreadOverrideTimeout(unsigned long timeoutMilliseconds, Execut ionContext*); 147 void mainThreadOverrideTimeout(unsigned long timeoutMilliseconds, Execut ionContext*);
148 void mainThreadCancel(ExecutionContext*); 148 void mainThreadCancel(ExecutionContext*);
149 149
150 // Only to be used on the main thread. 150 // Only to be used on the main thread.
151 RefPtr<ThreadableLoader> m_mainThreadLoader; 151 OwnPtr<ThreadableLoader> m_mainThreadLoader;
152 152
153 // ThreadableLoaderClientWrapper is to be used on the worker context thr ead. 153 // ThreadableLoaderClientWrapper is to be used on the worker context thr ead.
154 // The ref counting is done on either thread: 154 // The ref counting is done on either thread:
155 // - worker context's thread: held by the tasks 155 // - worker context's thread: held by the tasks
156 // - main thread: held by MainThreadBridgeBase 156 // - main thread: held by MainThreadBridgeBase
157 // Therefore, this must be a ThreadSafeRefCounted. 157 // Therefore, this must be a ThreadSafeRefCounted.
158 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; 158 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper;
159 159
160 // Used on the worker context thread. 160 // Used on the worker context thread.
161 RefPtr<WorkerLoaderProxy> m_loaderProxy; 161 RefPtr<WorkerLoaderProxy> m_loaderProxy;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; 200 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
201 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; 201 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper;
202 202
203 MainThreadBridgeBase* m_bridge; 203 MainThreadBridgeBase* m_bridge;
204 }; 204 };
205 205
206 } // namespace blink 206 } // namespace blink
207 207
208 #endif // WorkerThreadableLoader_h 208 #endif // WorkerThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698