| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class ResourceError; | 47 class ResourceError; |
| 48 class ResourceRequest; | 48 class ResourceRequest; |
| 49 class WorkerGlobalScope; | 49 class WorkerGlobalScope; |
| 50 class WorkerLoaderProxy; | 50 class WorkerLoaderProxy; |
| 51 struct CrossThreadResourceRequestData; | 51 struct CrossThreadResourceRequestData; |
| 52 | 52 |
| 53 class WorkerThreadableLoader final : public ThreadableLoader { | 53 class WorkerThreadableLoader final : public ThreadableLoader, private Thread
ableLoaderClientWrapper::ResourceTimingClient { |
| 54 WTF_MAKE_FAST_ALLOCATED(WorkerThreadableLoader); | 54 WTF_MAKE_FAST_ALLOCATED(WorkerThreadableLoader); |
| 55 public: | 55 public: |
| 56 static void loadResourceSynchronously(WorkerGlobalScope&, const Resource
Request&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const Resourc
eLoaderOptions&); | 56 static void loadResourceSynchronously(WorkerGlobalScope&, const Resource
Request&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const Resourc
eLoaderOptions&); |
| 57 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope& work
erGlobalScope, PassRefPtr<ThreadableLoaderClientWrapper> clientWrapper, PassOwnP
tr<ThreadableLoaderClient> clientBridge, const ResourceRequest& request, const T
hreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOpti
ons) | 57 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope& work
erGlobalScope, PassRefPtr<ThreadableLoaderClientWrapper> clientWrapper, PassOwnP
tr<ThreadableLoaderClient> clientBridge, const ResourceRequest& request, const T
hreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOpti
ons) |
| 58 { | 58 { |
| 59 return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client
Wrapper, clientBridge, request, options, resourceLoaderOptions)); | 59 return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client
Wrapper, clientBridge, request, options, resourceLoaderOptions)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual ~WorkerThreadableLoader(); | 62 virtual ~WorkerThreadableLoader(); |
| 63 | 63 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void mainThreadCancel(ExecutionContext*); | 106 void mainThreadCancel(ExecutionContext*); |
| 107 virtual void didSendData(unsigned long long bytesSent, unsigned long
long totalBytesToBeSent) override; | 107 virtual void didSendData(unsigned long long bytesSent, unsigned long
long totalBytesToBeSent) override; |
| 108 virtual void didReceiveResponse(unsigned long identifier, const Reso
urceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; | 108 virtual void didReceiveResponse(unsigned long identifier, const Reso
urceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; |
| 109 virtual void didReceiveData(const char*, unsigned dataLength) overri
de; | 109 virtual void didReceiveData(const char*, unsigned dataLength) overri
de; |
| 110 virtual void didDownloadData(int dataLength) override; | 110 virtual void didDownloadData(int dataLength) override; |
| 111 virtual void didReceiveCachedMetadata(const char*, int dataLength) o
verride; | 111 virtual void didReceiveCachedMetadata(const char*, int dataLength) o
verride; |
| 112 virtual void didFinishLoading(unsigned long identifier, double finis
hTime) override; | 112 virtual void didFinishLoading(unsigned long identifier, double finis
hTime) override; |
| 113 virtual void didFail(const ResourceError&) override; | 113 virtual void didFail(const ResourceError&) override; |
| 114 virtual void didFailAccessControlCheck(const ResourceError&) overrid
e; | 114 virtual void didFailAccessControlCheck(const ResourceError&) overrid
e; |
| 115 virtual void didFailRedirectCheck() override; | 115 virtual void didFailRedirectCheck() override; |
| 116 virtual void didReceiveResourceTiming(const ResourceTimingInfo&) ove
rride; |
| 116 | 117 |
| 117 // Only to be used on the main thread. | 118 // Only to be used on the main thread. |
| 118 RefPtr<ThreadableLoader> m_mainThreadLoader; | 119 RefPtr<ThreadableLoader> m_mainThreadLoader; |
| 119 OwnPtr<ThreadableLoaderClient> m_clientBridge; | 120 OwnPtr<ThreadableLoaderClient> m_clientBridge; |
| 120 | 121 |
| 121 // ThreadableLoaderClientWrapper is to be used on the worker context
thread. | 122 // ThreadableLoaderClientWrapper is to be used on the worker context
thread. |
| 122 // The ref counting is done on either thread. | 123 // The ref counting is done on either thread. |
| 123 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; | 124 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; |
| 124 | 125 |
| 125 // Used on the worker context thread. | 126 // Used on the worker context thread. |
| 126 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 127 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 WorkerThreadableLoader(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderCl
ientWrapper>, PassOwnPtr<ThreadableLoaderClient>, const ResourceRequest&, const
ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 130 WorkerThreadableLoader(WorkerGlobalScope&, PassRefPtr<ThreadableLoaderCl
ientWrapper>, PassOwnPtr<ThreadableLoaderClient>, const ResourceRequest&, const
ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
| 130 | 131 |
| 132 void didReceiveResourceTiming(const ResourceTimingInfo&) override; |
| 133 |
| 131 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 134 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
| 132 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; | 135 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; |
| 133 MainThreadBridge& m_bridge; | 136 MainThreadBridge& m_bridge; |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace blink | 139 } // namespace blink |
| 137 | 140 |
| 138 #endif // WorkerThreadableLoader_h | 141 #endif // WorkerThreadableLoader_h |
| OLD | NEW |