OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // | 80 // |
81 // case 2. xhr gets aborted and the worker context continues running. | 81 // case 2. xhr gets aborted and the worker context continues running. |
82 // The ThreadableLoaderClientWrapper has the underlying client cleare
d, so no more calls | 82 // The ThreadableLoaderClientWrapper has the underlying client cleare
d, so no more calls |
83 // go through it. All tasks posted from the worker object's thread t
o the worker context's | 83 // go through it. All tasks posted from the worker object's thread t
o the worker context's |
84 // thread do "ThreadableLoaderClientWrapper::ref" (automatically insi
de of the cross thread copy | 84 // thread do "ThreadableLoaderClientWrapper::ref" (automatically insi
de of the cross thread copy |
85 // done in createCrossThreadTask), so the ThreadableLoaderClientWrapp
er instance is there until all | 85 // done in createCrossThreadTask), so the ThreadableLoaderClientWrapp
er instance is there until all |
86 // tasks are executed. | 86 // tasks are executed. |
87 class MainThreadBridge final : public ThreadableLoaderClient { | 87 class MainThreadBridge final : public ThreadableLoaderClient { |
88 public: | 88 public: |
89 // All executed on the worker context's thread. | 89 // All executed on the worker context's thread. |
90 MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, PassOwnP
tr<ThreadableLoaderClient>, WorkerLoaderProxy&, const ResourceRequest&, const Th
readableLoaderOptions&, const ResourceLoaderOptions&, const String& outgoingRefe
rrer); | 90 MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, PassOwnP
tr<ThreadableLoaderClient>, PassRefPtr<WorkerLoaderProxy>, const ResourceRequest
&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&, const String& o
utgoingReferrer); |
91 void overrideTimeout(unsigned long timeoutMilliseconds); | 91 void overrideTimeout(unsigned long timeoutMilliseconds); |
92 void cancel(); | 92 void cancel(); |
93 void destroy(); | 93 void destroy(); |
94 | 94 |
95 private: | 95 private: |
96 // Executed on the worker context's thread. | 96 // Executed on the worker context's thread. |
97 void clearClientWrapper(); | 97 void clearClientWrapper(); |
98 | 98 |
99 // All executed on the main thread. | 99 // All executed on the main thread. |
100 static void mainThreadDestroy(ExecutionContext*, MainThreadBridge*); | 100 static void mainThreadDestroy(ExecutionContext*, MainThreadBridge*); |
(...skipping 14 matching lines...) Expand all Loading... |
115 | 115 |
116 // Only to be used on the main thread. | 116 // Only to be used on the main thread. |
117 RefPtr<ThreadableLoader> m_mainThreadLoader; | 117 RefPtr<ThreadableLoader> m_mainThreadLoader; |
118 OwnPtr<ThreadableLoaderClient> m_clientBridge; | 118 OwnPtr<ThreadableLoaderClient> m_clientBridge; |
119 | 119 |
120 // ThreadableLoaderClientWrapper is to be used on the worker context
thread. | 120 // ThreadableLoaderClientWrapper is to be used on the worker context
thread. |
121 // The ref counting is done on either thread. | 121 // The ref counting is done on either thread. |
122 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; | 122 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; |
123 | 123 |
124 // Used on the worker context thread. | 124 // Used on the worker context thread. |
125 WorkerLoaderProxy& m_loaderProxy; | 125 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
126 }; | 126 }; |
127 | 127 |
128 WorkerThreadableLoader(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderCl
ientWrapper>, PassOwnPtr<ThreadableLoaderClient>, const ResourceRequest&, const
ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 128 WorkerThreadableLoader(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderCl
ientWrapper>, PassOwnPtr<ThreadableLoaderClient>, const ResourceRequest&, const
ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
129 | 129 |
130 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 130 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
131 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; | 131 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; |
132 MainThreadBridge& m_bridge; | 132 MainThreadBridge& m_bridge; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
136 | 136 |
137 #endif // WorkerThreadableLoader_h | 137 #endif // WorkerThreadableLoader_h |
OLD | NEW |